baked: Support initial args for cache key

When making baked query in classmethod of declarative base,
cls should be added in cache key.

    @as_declarative
    class Base(object):

        @classmethod
        def baked_query(cls):
            return bakery(lambda: session.query(cls), (cls,))
This commit is contained in:
INADA Naoki
2015-06-02 22:05:18 +09:00
parent 0766c80b9c
commit 36d2b40cf5
+2 -2
View File
@@ -49,8 +49,8 @@ class BakedQuery(object):
_bakery = util.LRUCache(size)
def call(initial_fn):
return cls(_bakery, initial_fn)
def call(initial_fn, args=()):
return cls(_bakery, initial_fn, args)
return call