On 9/21/07, Gaetan de Menten <[EMAIL PROTECTED]> wrote:
> > + def get(cls, id):
> > + for field in cls._descriptor.fields.values():
> > + if field.primary_key:
> > + idname = field.colname
> > + break
> > + else:
> > + idname = 'id'
> > +
> > + idarg = { idname: id }
> > + return cls.query().filter_by(**idarg).first()
> > + get = classmethod(get)
>
> You're correct to think we need to re-add a get method, though there
> is a simpler way to do so:
>
> def get(cls, *args, **kwargs):
> return cls._descriptor.objectstore.session.get(*args, **kwargs)
> get = classmethod(get)
>
> This is now commited to trunk.
Hmmm. This should have read:
def get(cls, *args, **kwargs):
return cls.query().get(*args, **kwargs)
get = classmethod(get)
I guess I wasn't fully awake when I wrote that. Sorry about that. This
is now properly fixed in trunk.
--
Gaƫtan de Menten
http://openhex.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SQLElixir" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---