def cache_required(func):
 def wrapper(self, *args, **kwargs):
  if (not self.has_cached_criterias()):
   log.debug(u'None cached data. Synchronizing...')
   self.synchronize_database()
  return func(self, *args, **kwargs)
 return wrapper

def cache_required ( func ) : def wrapper ( self , * args , ** kwargs ) : if ( not self . has_cached_criterias ( ) ) : log . debug ( u'None cached data. Synchronizing...' ) self . synchronize_database ( ) return func ( self , * args , ** kwargs ) return wrapper
decorator for ensuring cached data into db .