From: INADA Naoki Date: Tue, 2 Jun 2015 13:05:18 +0000 (+0900) Subject: baked: Support initial args for cache key X-Git-Tag: rel_1_0_5~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=36d2b40cf55bc0f4e850e9ec4e905f0051f573f2;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git 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,)) --- diff --git a/lib/sqlalchemy/ext/baked.py b/lib/sqlalchemy/ext/baked.py index 65d6a86031..96e1f1312f 100644 --- a/lib/sqlalchemy/ext/baked.py +++ b/lib/sqlalchemy/ext/baked.py @@ -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