fixed problem with recent cache commit
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.00.0 (2012-07-16 22:48:56) dev
|
Version 2.00.0 (2012-07-17 10:35:39) dev
|
||||||
|
|||||||
+5
-7
@@ -381,6 +381,8 @@ class CacheOnDisk(CacheAbstract):
|
|||||||
|
|
||||||
class CacheAction(object):
|
class CacheAction(object):
|
||||||
def __init__(self,func,key,time_expire,cache,cache_model):
|
def __init__(self,func,key,time_expire,cache,cache_model):
|
||||||
|
self.__name__ = func.__name__
|
||||||
|
self.__doc__ = func.__doc__
|
||||||
self.func = func
|
self.func = func
|
||||||
self.key = key
|
self.key = key
|
||||||
self.time_expire = time_expire
|
self.time_expire = time_expire
|
||||||
@@ -388,9 +390,9 @@ class CacheAction(object):
|
|||||||
self.cache_model = cache_model
|
self.cache_model = cache_model
|
||||||
def __call__(self,*a,**b):
|
def __call__(self,*a,**b):
|
||||||
if not self.key:
|
if not self.key:
|
||||||
key2 = self.func.__name__+':'+repr(a)+':'+repr(b)
|
key2 = self.__name__+':'+repr(a)+':'+repr(b)
|
||||||
else:
|
else:
|
||||||
key2 = self.key.replace('%(name)s',self.func.__name__)\
|
key2 = self.key.replace('%(name)s',self.__name__)\
|
||||||
.replace('%(args)s',str(a)).replace('%(vars)s',str(b))
|
.replace('%(args)s',str(a)).replace('%(vars)s',str(b))
|
||||||
cache_model = self.cache_model
|
cache_model = self.cache_model
|
||||||
if not cache_model or isinstance(cache_model,str):
|
if not cache_model or isinstance(cache_model,str):
|
||||||
@@ -473,11 +475,7 @@ class Cache(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def tmp(func,cache=self,cache_model=cache_model):
|
def tmp(func,cache=self,cache_model=cache_model):
|
||||||
action = CacheAction(func,key,time_expire,self,cache_model)
|
return CacheAction(func,key,time_expire,self,cache_model)
|
||||||
action.__name___ = func.__name__
|
|
||||||
action.__doc__ = func.__doc__
|
|
||||||
return action
|
|
||||||
|
|
||||||
return tmp
|
return tmp
|
||||||
|
|
||||||
def lazy_lazy_cache(key=None,time_expire=None,cache_model='ram'):
|
def lazy_lazy_cache(key=None,time_expire=None,cache_model='ram'):
|
||||||
|
|||||||
@@ -2170,6 +2170,8 @@ class PostgreSQLAdapter(BaseAdapter):
|
|||||||
return varquote_aux(name,'"%s"')
|
return varquote_aux(name,'"%s"')
|
||||||
|
|
||||||
def adapt(self,obj):
|
def adapt(self,obj):
|
||||||
|
#if self.driver == self.drivers.get('pg8000'):
|
||||||
|
# obj = str(obj).replace('%','%%')
|
||||||
return psycopg2_adapt(obj).getquoted()
|
return psycopg2_adapt(obj).getquoted()
|
||||||
|
|
||||||
def sequence_name(self,table):
|
def sequence_name(self,table):
|
||||||
|
|||||||
Reference in New Issue
Block a user