What am I doing wrong with my pydo.Field class?
Hamish Lawson <[email protected]> Fri, 7 Oct 2005 22:37:48 +0100
| Newsgroups | gmane.comp.web.skunkweb |
|---|---|
| Message-ID | <[email protected]> |
I've defined a class derived from pydo.Field as follows:
class XMLPara(pydo.Field):
def __get__(self, obj, type_):
"""descriptor method"""
if obj is None:
return None
return tidy(obj[self.name])
I then use it in my schema as follows:
class Researcher(ResExpTable):
fields = (
pydo.Unique('USERNAME'),
XMLPara('RES_EXP'),
....
However a print statement in XMLPara.__get__ indicates that 'obj' is
always None. Am I defining and using XMLPara correctly?
Hamish
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl