Ñò ]®œIc@sÑdZddkZddkZddkZyeWn#ej oddklZnXddklZddk l Z ddk l Z ei eƒZdddedeed „Zddd „Zd „ZdS(sCaching decoratoriÿÿÿÿN(tSet(t decorator(tasbool(t get_pylonst cache_defaulttnevers content-typescontent-lengthc  sW|otiƒ‰nd‰tˆƒ‰‡‡‡‡‡‡‡‡fd†}t|ƒS(s4Cache decorator utilizing Beaker. Caches action or other function that returns a pickle-able object as a result. Optional arguments: ``key`` None - No variable key, uses function name as key "cache_default" - Uses all function arguments as the key string - Use kwargs[key] as key list - Use [kwargs[k] for k in list] as key ``expire`` Time in seconds before cache expires, or the string "never". Defaults to "never" ``type`` Type of cache to use: dbm, memory, file, memcached, or None for Beaker's default ``query_args`` Uses the query arguments as the key, defaults to False ``cache_headers`` A tuple of header names indicating response headers that will also be cached. ``invalidate_on_startup`` If True, the cache will be invalidated each time the application starts or is restarted. ``cache_response`` Determines whether the response at the time beaker_cache is used should be cached or not, defaults to True. .. note:: When cache_response is set to False, the cache_headers argument is ignored as none of the response is cached. If cache_enabled is set to False in the .ini file, then cache is disabled globally. c s)tˆƒ‰tidˆ ˆ ˆˆƒˆiiddƒ}t|ƒptidƒˆˆˆŽSˆ o•ˆoˆiiiƒ‰n#ˆi ƒ‰ˆi t ˆˆƒƒˆ djoEt ˆ t ƒo t‡fd†ˆ Dƒƒ‰qúhˆˆ ˆ 6‰qnd‰d}ˆoˆd}ntˆˆ|ƒ\}‰ˆoˆˆdSs ittypeRc sbtidˆˆƒˆˆˆŽ}ˆi}|i}|i}td|d|ddd|ƒ}|S(Ns.Creating new cache copy with key: %s, type: %stheaderststatustcookiestcontent(tlogtdebugtresponset headerlistR tdicttNone(tresultt glob_responseR R t full_response(targstfunctkwargst cache_keyR tpylons(s;/usr/lib/python2.6/site-packages/pylons/decorators/cache.pyt create_funchs     t createfunct expiretimet starttimeR R RN(RRRtconfigtgetRtrequesttGETtmixedtcopytupdatet_make_dict_from_argst isinstancetlistRRtcreate_cache_keytcachet get_cachet get_valueRtlowerRR ( RRRtenabledtselft namespacetmy_cachet cache_expireRRRt_[1]theader(t query_argsR tb_kwargstexpiretkeytcache_responseR!t cache_headers(RR RRRRs;/usr/lib/python2.6/site-packages/pylons/decorators/cache.pytwrapper@sJ            .N(ttimeRtsetR( R;R:R R8R=tinvalidate_on_startupR<R9R>((R!R8R9R:R;R=R R<s;/usr/lib/python2.6/site-packages/pylons/decorators/cache.pyt beaker_caches ) $=c Cséd}t|dƒo|i}|i}|i}n |i}|oL|ddig}|iƒD]\}}|d||fqb~ƒ7}n| o|ot|ddƒ}n|od|i|if|fS|i|fSdS(s7Get a cache namespace and key used by the beaker_cache decorator. Example:: from pylons import cache from pylons.decorators.cache import create_cache_key namespace, key = create_cache_key(MyController.some_method) cache.get_cache(namespace).remove(key) tim_funct s%s=%st __class__s%s.%sN( Rthasattrtim_classRCt__name__tjoint iteritemstgetattrt __module__(RR R2tklsRR6R tv((s;/usr/lib/python2.6/site-packages/pylons/decorators/cache.pyR,s     9cCsSh}xFtti|ƒdƒD]+\}}|djo||||s$     j