Hello,

Guess I haven't understood all the magic behind object mapping...

I have a class like this :

class MyClass(object):

    __init__(self, name):

        self = session.query(MyClass).filter(MyClass.name==name).one()
        print self.name # Outputs 'joe'

And I'm expecting that my instance of MyClass has its attributes filled
with the correct values, they are instead empty, while issuing for
example print self.name inside the __init__ method reports the expected
values :

>>> obj = MyClass('joe')
>>> obj.name
>>>

I've tried prepending __init__ with the @orm.reconstructor stuff without
success too.

Could someone enlighten me, and show me the way to handle this the right
way ?

Regards.


-- 
f3d

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to