> When I create an instance using pet('Jack', 'dog'), I get the
> following error:
>
> __call__() takes exactly 1 argument (3 given)
>
> If I change it to pet(name='Jack', species='dog'), it works just
> fine.
>
> Orest
u need to have these:
def __call__( self, **kwargs)
hashkey=tuple( kwargs.items() )
...query.get_by( **kwargs ),
and u have to use that via pet(name='Jack', species='dog').
if u want it pet('Jack', 'dog'), u should have *args as well as **kwargs.
so u can have either or both *args/**kwargs; and that is all-your-args.
hashkey should be over all-your-args, query.get should over
all-your-args. if u have *args, u should cater for it in the
query.get() which will need the inspect stuff, create a dict from that +
the kwargs, and pass the resulting union to get(**allyourargs). u can
also raise errors for duplicating arguments if u want - i.e. mime
completely the argument handling of a funccall.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" 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/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---