On Oct 12, 2010, at 7:39 AM, Julien Cigar wrote:
> Hello,
>
> any idea why with
>
> # Query
>
> class BaseQuery(orm.Query):
> @dynamic
> def method_a(self):
> ...
> def method_b(self):
> ...
>
> class FooQuery(BaseQuery):
> ...
>
> class BarQuery(FooQuery):
> @dynamic
> def method_c(self):
> ...
>
> # Models
>
> class BaseModel(object):
> query = Session.query_property(BaseQuery)
>
> #
>
> myQuery = type('PolymorphicQuery, (content.BaseQuery, ), func_list)(BaseModel)
>
> where "func_list" containing all the functions decorated by @dynamic the
> following fail? :
>
> - myQuery.get(45) fails with: AttributeError: 'NoneType' object has no
> attribute 'identity_map'
> - myQuery.method_a().all() fails with: AttributeError: 'NoneType' object has
> no attribute '_autoflush'
> - etc
>
> My goal is to be able to build a custom Query object to use with the
> .with_polymorphic() function ..
I've just grepped through all the source, examples and tests plus the wiki
trying to find what @dynamic is. Seems like something I'd have come up with
in the past but I've no clue at the moment what that is.
--
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.