[lxml-dev] [objectify] __setText method not usable from python classes
Holger Joukl
Holger.Joukl at LBBW.de
Wed Feb 21 15:28:51 CET 2007
Hi,
I've experimented with the ObjectifiedDataElement.__setText method a bit
and found that it is unusable from within python data elements due to
Python's name mangling.
E.g. you can't have s.th. like
def _init(self):
self.__setText("try this")
or
def _init(self):
ObjectifiedDataElement.__setText(self, "try this")
This results in
AttributeError: type object 'objectify.ObjectifiedDataElement' has no
attribute '_DatetimeElement__setText
Confusingly __setText has no notion of being private when used from the
outside, you can well do
>>> objectify.ObjectifiedDataElement.__setText(msg.d, "1900")
>>>
Maybe use just a single leading underscore and rename it to _setText?
Holger
Der Inhalt dieser E-Mail ist vertraulich. Falls Sie nicht der angegebene
Empfänger sind oder falls diese E-Mail irrtümlich an Sie adressiert wurde,
verständigen Sie bitte den Absender sofort und löschen Sie die E-Mail
sodann. Das unerlaubte Kopieren sowie die unbefugte Übermittlung sind nicht
gestattet. Die Sicherheit von Übermittlungen per E-Mail kann nicht
garantiert werden. Falls Sie eine Bestätigung wünschen, fordern Sie bitte
den Inhalt der E-Mail als Hardcopy an.
The contents of this e-mail are confidential. If you are not the named
addressee or if this transmission has been addressed to you in error,
please notify the sender immediately and then delete this e-mail. Any
unauthorized copying and transmission is forbidden. E-Mail transmission
cannot be guaranteed to be secure. If verification is required, please
request a hard copy version.
Landesbank Baden-Württemberg
Anstalt des öffentlichen Rechts
Hauptsitze: Stuttgart, Karlsruhe, Mannheim
More information about the lxml-dev
mailing list