/usr/lib64/python2.6/site-packages/jinja2
NameSizeModeActions
bccache.py112940644editdlrm
bccache.pyc134770644editdlrm
bccache.pyo134770644editdlrm
compiler.py559230644editdlrm
compiler.pyc509150644editdlrm
compiler.pyo508450644editdlrm
constants.py62290644editdlrm
constants.pyc76970644editdlrm
constants.pyo76970644editdlrm
debug.py99270644editdlrm
debug.pyc101660644editdlrm
debug.pyo100940644editdlrm
defaults.py10500644editdlrm
defaults.pyc16140644editdlrm
defaults.pyo16140644editdlrm
environment.py346510644editdlrm
environment.pyc345220644editdlrm
environment.pyo341030644editdlrm
exceptions.py30730644editdlrm
exceptions.pyc47210644editdlrm
exceptions.pyo47210644editdlrm
ext.py181070644editdlrm
ext.pyc176810644editdlrm
ext.pyo176140644editdlrm
filters.py218060644editdlrm
filters.pyc247740644editdlrm
filters.pyo247740644editdlrm
lexer.py246640644editdlrm
lexer.pyc205660644editdlrm
lexer.pyo203970644editdlrm
loaders.py115070644editdlrm
loaders.pyc132180644editdlrm
loaders.pyo132180644editdlrm
meta.py28460644editdlrm
meta.pyc36670644editdlrm
meta.pyo36670644editdlrm
nodes.py234640644editdlrm
nodes.pyc381880644editdlrm
nodes.pyo376930644editdlrm
optimizer.py23020644editdlrm
optimizer.pyc28730644editdlrm
optimizer.pyo28730644editdlrm
parser.py306760644editdlrm
parser.pyc288520644editdlrm
parser.pyo288520644editdlrm
runtime.py176050644editdlrm
runtime.pyc214470644editdlrm
runtime.pyo214110644editdlrm
sandbox.py92600644editdlrm
sandbox.pyc97180644editdlrm
sandbox.pyo97180644editdlrm
tests.py32660644editdlrm
tests.pyc49220644editdlrm
tests.pyo49220644editdlrm
utils.py248940644editdlrm
utils.pyc315080644editdlrm
utils.pyo315080644editdlrm
visitor.py33160644editdlrm
visitor.pyc38500644editdlrm
visitor.pyo38500644editdlrm
_ipysupport.py9490644editdlrm
_ipysupport.pyc17760644editdlrm
_ipysupport.pyo17760644editdlrm
_speedups.so82320755editdlrm
_stringdefs.py4042560644editdlrm
_stringdefs.pyc2085250644editdlrm
_stringdefs.pyo2085250644editdlrm
__init__.py21950644editdlrm
__init__.pyc23960644editdlrm
__init__.pyo23960644editdlrm
Edit: /usr/lib64/python2.6/site-packages/jinja2/bccache.pyc (13477B)
Ñò îºÓXc@sKdZddklZlZddkZddkZddkZddkZddk l Z ddkZddk Z ddk Z yddk lZWn#ej oddklZnXddklZdZd id ƒeied ƒZd efd „ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdS(sÉ jinja2.bccache ~~~~~~~~~~~~~~ This module implements the bytecode cache system Jinja is optionally using. This is useful if you have very complex template situations and the compiliation of all those templates slow down your application too much. Situations where this is useful are often forking web applications that are initialized on the first request. :copyright: (c) 2009 by the Jinja Team. :license: BSD. iÿÿÿÿ(tpathtlistdirN(tStringIO(tsha1(tnew(topen_if_existsitj2tasciiitBucketcBsDeZdZd„Zd„Zd„Zd„Zd„Zd„ZRS(suBuckets are used to store the bytecode for one template. It's created and initialized by the bytecode cache and passed to the loading functions. The buckets get an internal checksum from the cache assigned and use this to automatically reject outdated cache material. Individual bytecode cache subclasses don't have to care about cache invalidation. cCs)||_||_||_|iƒdS(N(t environmenttkeytchecksumtreset(tselfR R R ((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pyt__init__.s   cCs d|_dS(s)Resets the bucket (unloads the bytecode).N(tNonetcode(R ((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pyR 4scCs¡|ittƒƒ}|tjo|iƒdSti|ƒ}|i|jo|iƒdSt|tƒot i|ƒ|_ nt i |iƒƒ|_ dS(s/Loads bytecode from a file or file like object.N( treadtlentbc_magicR tpickletloadR t isinstancetfiletmarshalRtloads(R tftmagicR ((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pyt load_bytecode8s   cCs‡|idjotdƒ‚n|itƒti|i|dƒt|t ƒot i|i|ƒn|it i |iƒƒdS(s;Dump the bytecode into the file or file like object passed.scan't write empty bucketiN( RRt TypeErrortwriteRRtdumpR RRRtdumps(R R((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pytwrite_bytecodeKs cCs|it|ƒƒdS(sLoad bytecode from a string.N(RR(R tstring((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pytbytecode_from_stringVscCs tƒ}|i|ƒ|iƒS(sReturn the bytecode as string.(RR!tgetvalue(R tout((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pytbytecode_to_stringZs  ( t__name__t __module__t__doc__RR RR!R#R&(((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pyR%s    t BytecodeCachecBsPeZdZd„Zd„Zd„Zdd„Zd„Zd„Z d„Z RS( sßTo implement your own bytecode cache you have to subclass this class and override :meth:`load_bytecode` and :meth:`dump_bytecode`. Both of these methods are passed a :class:`~jinja2.bccache.Bucket`. A very basic bytecode cache that saves the bytecode on the file system:: from os import path class MyCache(BytecodeCache): def __init__(self, directory): self.directory = directory def load_bytecode(self, bucket): filename = path.join(self.directory, bucket.key) if path.exists(filename): with file(filename, 'rb') as f: bucket.load_bytecode(f) def dump_bytecode(self, bucket): filename = path.join(self.directory, bucket.key) with file(filename, 'wb') as f: bucket.write_bytecode(f) A more advanced version of a filesystem based bytecode cache is part of Jinja2. cCs tƒ‚dS(s¹Subclasses have to override this method to load bytecode into a bucket. If they are not able to find code in the cache for the bucket, it must not do anything. N(tNotImplementedError(R tbucket((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pyR~scCs tƒ‚dS(sÀSubclasses have to override this method to write the bytecode from a bucket back to the cache. If it unable to do so it must not fail silently but raise an exception. N(R+(R R,((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pyt dump_bytecode…scCsdS(s»Clears the cache. This method is not used by Jinja2 but should be implemented to allow applications to clear the bytecode cache used by a particular environment. N((R ((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pytclearŒscCsdt|idƒƒ}|dj o8t|tƒo|idƒ}n|id|ƒn|iƒS(s3Returns the unique hash key for this template name.sutf-8t|N(RtencodeRRtunicodetupdatet hexdigest(R tnametfilenamethash((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pyt get_cache_key’s  cCst|idƒƒiƒS(s"Returns a checksum for the source.sutf-8(RR0R3(R tsource((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pytget_source_checksum›scCsD|i||ƒ}|i|ƒ}t|||ƒ}|i|ƒ|S(swReturn a cache bucket for the given template. All arguments are mandatory but filename may be `None`. (R7R9RR(R R R4R5R8R R R,((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pyt get_bucketŸs  cCs|i|ƒdS(sPut the bucket into the cache.N(R-(R R,((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pyt set_bucket©sN( R'R(R)RR-R.RR7R9R:R;(((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pyR*as     tFileSystemBytecodeCachecBsJeZdZddd„Zd„Zd„Zd„Zd„Zd„Z RS( sïA bytecode cache that stores bytecode on the filesystem. It accepts two arguments: The directory where the cache items are stored and a pattern string that is used to build the filename. If no directory is specified a default cache directory is selected. On Windows the user's temp directory is used, on UNIX systems a directory is created for the user in the system temp directory. The pattern can be used to have multiple separate caches operate on the same directory. The default pattern is ``'__jinja2_%s.cache'``. ``%s`` is replaced with the cache key. >>> bcc = FileSystemBytecodeCache('/tmp/jinja_cache', '%s.cache') This bytecode cache supports clearing of the cache using the clear method. s__jinja2_%s.cachecCs3|djo|iƒ}n||_||_dS(N(Rt_get_default_cache_dirt directorytpattern(R R>R?((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pyRÀs  cCstiƒ}tidjo|Sttdƒptdƒ‚ndtiƒ}tii||ƒ}yti |t i ƒWn/t j o#}|i t ijo‚q¯nXti|ƒ}|itiƒjp0t i|iƒ pt i|iƒt i jotd|ƒ‚n|S(NtnttgetuidsJCannot determine safe temp directory. You need to explicitly provide one.s_jinja2-cache-%dsFTemporary directory '%s' has an incorrect owner, permissions, or type.(ttempfilet gettempdirtosR4thasattrt RuntimeErrorRARtjointmkdirtstattS_IRWXUtOSErrorterrnotEEXISTtlstattst_uidtS_ISDIRtst_modetS_IMODE(R ttmpdirtdirnamet actual_dirtetactual_dir_stat((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pyR=Æs&  cCsti|i|i|iƒS(N(RRGR>R?R (R R,((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pyt_get_cache_filenameãscCsLt|i|ƒdƒ}|dj o#z|i|ƒWd|iƒXndS(Ntrb(RRXRRtclose(R R,R((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pyRæs  cCs;t|i|ƒdƒ}z|i|ƒWd|iƒXdS(Ntwb(RRXR!RZ(R R,R((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pyR-îsc Cszddkl}tit|iƒ|idƒ}xA|D]9}y|ti|i|ƒƒWq9t j oq9Xq9WdS(Niÿÿÿÿ(tremovet*( RDR\tfnmatchtfilterRR>R?RRGRK(R R\tfilesR5((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pyR.õs"N( R'R(R)RRR=RXRR-R.(((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pyR<®s    tMemcachedBytecodeCachecBs/eZdZddd„Zd„Zd„ZRS(sñThis class implements a bytecode cache that uses a memcache cache for storing the information. It does not enforce a specific memcache library (tummy's memcache or cmemcache) but will accept any class that provides the minimal interface required. Libraries compatible with this class: - `werkzeug `_.contrib.cache - `python-memcached `_ - `cmemcache `_ (Unfortunately the django cache interface is not compatible because it does not support storing binary data, only unicode. You can however pass the underlying cache client to the bytecode cache which is available as `django.core.cache.cache._client`.) The minimal interface for the client passed to the constructor is this: .. class:: MinimalClientInterface .. method:: set(key, value[, timeout]) Stores the bytecode in the cache. `value` is a string and `timeout` the timeout of the key. If timeout is not provided a default timeout or no timeout should be assumed, if it's provided it's an integer with the number of seconds the cache item should exist. .. method:: get(key) Returns the value for the cache key. If the item does not exist in the cache the return value must be `None`. The other arguments to the constructor are the prefix for all keys that is added before the actual cache key and the timeout for the bytecode in the cache system. We recommend a high (or no) timeout. This bytecode cache does not support clearing of used items in the cache. The clear method is a no-operation function. sjinja2/bytecode/cCs||_||_||_dS(N(tclienttprefixttimeout(R RbRcRd((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pyR,s  cCs>|ii|i|iƒ}|dj o|i|ƒndS(N(RbtgetRcR RR#(R R,R((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pyR1s cCsT|i|i|iƒf}|idj o||if7}n|ii|ŒdS(N(RcR R&RdRRbtset(R R,targs((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pyR-6sN(R'R(R)RRRR-(((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pyRas( (R)RDRRRRBtcPickleRR^t cStringIORRLRIthashlibRt ImportErrortshaRt jinja2.utilsRt bc_versionR0R RtobjectRR*R<Ra(((s4/usr/lib64/python2.6/site-packages/jinja2/bccache.pyts(       <MT