[sqlalchemy] Re: Adding method to ORM mapped object

2009-08-11 Thread tom
>From what I see, you forgot the "self" argument in the getRendered function definition. def getRendered(self): return '%s\n%s' % (self.title, self.content) On Aug 10, 5:00 am, Andreas wrote: > Arghh... I got it. > The problem was that I wasn't querying through a session, but doing a >

[sqlalchemy] Re: Adding method to ORM mapped object

2009-08-09 Thread Andreas
Arghh... I got it. The problem was that I wasn't querying through a session, but doing a selection without one, so the object wasn't bound to the class ... Some old code fragment. Quite as you said. Thanks for your help :) --~--~-~--~~~---~--~~ You received this me

[sqlalchemy] Re: Adding method to ORM mapped object

2009-08-09 Thread Michael Bayer
On Aug 9, 2009, at 9:35 PM, Andreas wrote: > > On Aug 10, 3:18 am, Michael Bayer wrote: >> On Aug 9, 2009, at 9:00 PM, Andreas wrote: > >>> The problem ist that the mapper call overwrites anything, I can't >>> access getRendered the normal way. Is there an easy work'round or >>> do I >>> have

[sqlalchemy] Re: Adding method to ORM mapped object

2009-08-09 Thread Andreas
On Aug 10, 3:18 am, Michael Bayer wrote: > On Aug 9, 2009, at 9:00 PM, Andreas wrote: > > The problem ist that the mapper call overwrites anything, I can't > > access getRendered the normal way. Is there an easy work'round or do I > > have to assemble the rendered output outside the object? The

[sqlalchemy] Re: Adding method to ORM mapped object

2009-08-09 Thread Michael Bayer
On Aug 9, 2009, at 9:00 PM, Andreas wrote: > > Hi! > > I was just curious, if it is possible to add a method to an ORM mapped > object, because I'd like to assemble a string within that object. > > Here's what I'd like to do: > > class page(): >def __init__(self, name, title, content): >