/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/loaders.pyo (13218B)
Ñò e¤Ic @s#dZddklZyddklZWn#ej oddklZnXddkl Z ddk l Z l Z l Z d„Zdefd „ƒYZd efd „ƒYZd efd „ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdS(s  jinja2.loaders ~~~~~~~~~~~~~~ Jinja loader classes. :copyright: (c) 2009 by the Jinja Team. :license: BSD, see LICENSE for more details. iÿÿÿÿ(tpath(tsha1(tnew(tTemplateNotFound(tLRUCachetopen_if_existst internalcodecCs“g}x†|idƒD]u}ti|jp*tioti|jp|tijot|ƒ‚q|o|djo|i|ƒqqW|S(s‰Split a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error. t/t.(tsplitRtseptaltseptpardirRtappend(ttemplatetpiecestpiece((s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pytsplit_template_pathst BaseLoadercBs)eZdZd„Zedd„ƒZRS(sÍBaseclass for all loaders. Subclass this and override `get_source` to implement a custom loading mechanism. The environment provides a `get_template` method that calls the loader's `load` method to get the :class:`Template` object. A very basic example for a loader that looks up templates on the file system could look like this:: from jinja2 import BaseLoader, TemplateNotFound from os.path import join, exists, getmtime class MyLoader(BaseLoader): def __init__(self, path): self.path = path def get_source(self, environment, template): path = join(self.path, template) if not exists(path): raise TemplateNotFound(template) mtime = getmtime(path) with file(path) as f: source = f.read().decode('utf-8') return source, path, lambda: mtime == getmtime(path) cCst|ƒ‚dS(sËGet the template source, filename and reload helper for a template. It's passed the environment and template name and has to return a tuple in the form ``(source, filename, uptodate)`` or raise a `TemplateNotFound` error if it can't locate the template. The source part of the returned tuple must be the source of the template as unicode string or a ASCII bytestring. The filename should be the name of the file on the filesystem if it was loaded from there, otherwise `None`. The filename is used by python for the tracebacks if no loader extension is used. The last item in the tuple is the `uptodate` function. If auto reloading is enabled it's always called to check if the template changed. No arguments are passed so the function must store the old state somewhere (for example in a closure). If it returns `False` the template will be reloaded. N(R(tselft environmentR((s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyt get_source>sc Cséd}|djo h}n|i||ƒ\}}}|i}|dj o%|i||||ƒ} | i}n|djo|i|||ƒ}n|dj o*| idjo|| _|i| ƒn|ii||||ƒS(scLoads a template. This method looks up the template in the cache or loads one by calling :meth:`get_source`. Subclasses should not override this method as loaders working on collections of other loaders (such as :class:`PrefixLoader` or :class:`ChoiceLoader`) will not call this method but `get_source` directly. N( tNoneRtbytecode_cachet get_buckettcodetcompilet set_bucketttemplate_classt from_code( RRtnametglobalsRtsourcetfilenametuptodatetbcctbucket((s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pytloadRs       N(t__name__t __module__t__doc__RRRR%(((s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyR#s tFileSystemLoadercBs#eZdZdd„Zd„ZRS(s=Loads templates from the file system. This loader can find templates in folders on the file system and is the preferred way to load them. The loader takes the path to the templates as string, or if multiple locations are wanted a list of them which is then looked up in the given order: >>> loader = FileSystemLoader('/path/to/templates') >>> loader = FileSystemLoader(['/path/to/templates', '/other/path']) Per default the template encoding is ``'utf-8'`` which can be changed by setting the `encoding` parameter to something else. sutf-8cCs9t|tƒo |g}nt|ƒ|_||_dS(N(t isinstancet basestringtlistt searchpathtencoding(RR-R.((s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyt__init__ˆs cs·t|ƒ}x˜|iD]}ti||Œ‰tˆƒ}|djoqnz|iƒi|iƒ}Wd|i ƒXti ˆƒ‰‡‡fd†}|ˆ|fSWt |ƒ‚dS(Ncs2ytiˆƒˆjSWntj otSXdS(N(RtgetmtimetOSErrortFalse((tmtimeR!(s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyR"›s( RR-RtjoinRRtreadtdecodeR.tcloseR0R(RRRRR-tftcontentsR"((R3R!s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyRŽs     (R&R'R(R/R(((s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyR)ys  t PackageLoadercBs&eZdZddd„Zd„ZRS(s+Load templates from python eggs or packages. It is constructed with the name of the python package and the path to the templates in that package: >>> loader = PackageLoader('mypackage', 'views') If the package path is not given, ``'templates'`` is assumed. Per default the template encoding is ``'utf-8'`` which can be changed by setting the `encoding` parameter to something else. Due to the nature of eggs it's only possible to reload templates if the package was loaded from the file system and not a zip file. t templatessutf-8cCseddkl}l}l}||ƒ}||_|ƒ|_t||ƒ|_||_||_ dS(Niÿÿÿÿ(tDefaultProvidertResourceManagert get_provider( t pkg_resourcesR<R=R>R.tmanagerR*tfilesystem_boundtprovidert package_path(Rt package_nameRCR.R<R=R>RB((s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyR/³s    csÐt|ƒ}di|ift|ƒƒ}|ii|ƒpt|ƒ‚nd‰}|io=|ii |i |ƒ‰t i ˆƒ‰‡‡fd†}n|ii |i |ƒ}|i|iƒˆ|fS(NRcs2ytiˆƒˆjSWntj otSXdS(N(RR0R1R2((R3R!(s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyR"Ès(RR4RCttupleRBt has_resourceRRRAtget_resource_filenameR@RR0tget_resource_stringR6R.(RRRRtpR"R ((R3R!s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyR¾s   (R&R'R(R/R(((s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyR:¤s  t DictLoadercBs eZdZd„Zd„ZRS(sLoads a template from a python dict. It's passed a dict of unicode strings bound to template names. This loader is useful for unittesting: >>> loader = DictLoader({'index.html': 'source here'}) Because auto reloading is rarely useful this is disabled per default. cCs ||_dS(N(tmapping(RRK((s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyR/ÛscsJˆˆijo*ˆiˆ‰ˆd‡‡‡fd†fStˆƒ‚dS(NcsˆˆiiˆƒjS((RKtget((R RR(s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pytás(RKRR(RRR((RR Rs4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyRÞs (R&R'R(R/R(((s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyRJÒs tFunctionLoadercBs eZdZd„Zd„ZRS(s»A loader that is passed a function which does the loading. The function becomes the name of the template passed and has to return either an unicode string with the template source, a tuple in the form ``(source, filename, uptodatefunc)`` or `None` if the template does not exist. >>> def load_template(name): ... if name == 'index.html' ... return '...' ... >>> loader = FunctionLoader(load_template) The `uptodatefunc` is a function that is called if autoreload is enabled and has to return `True` if the template is still up to date. For more details have a look at :meth:`BaseLoader.get_source` which has the same return value. cCs ||_dS(N(t load_func(RRO((s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyR/÷scCsN|i|ƒ}|djot|ƒ‚nt|tƒo|ddfS|S(N(RORRR*R+(RRRtrv((s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyRús  (R&R'R(R/R(((s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyRNås t PrefixLoadercBs#eZdZdd„Zd„ZRS(sA loader that is passed a dict of loaders where each loader is bound to a prefix. The prefix is delimited from the template by a slash per default, which can be changed by setting the `delimiter` argument to something else. >>> loader = PrefixLoader({ ... 'app1': PackageLoader('mypackage.app1'), ... 'app2': PackageLoader('mypackage.app2') ... }) By loading ``'app1/index.html'`` the file from the app1 package is loaded, by loading ``'app2/index.html'`` the file from the second. RcCs||_||_dS(N(RKt delimiter(RRKRR((s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyR/s cCsdy,|i|idƒ\}}|i|}Wn%ttfj ot|ƒ‚nX|i||ƒS(Ni(R RRRKt ValueErrortKeyErrorRR(RRRtprefixtloader((s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyRs (R&R'R(R/R(((s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyRQs  t ChoiceLoadercBs eZdZd„Zd„ZRS(s—This loader works like the `PrefixLoader` just that no prefix is specified. If a template could not be found by one loader the next one is tried. >>> loader = ChoiceLoader([ ... FileSystemLoader('/path/to/user/templates'), ... PackageLoader('mypackage') ... ]) This is useful if you want to allow users to override builtin templates from a different location. cCs ||_dS(N(tloaders(RRX((s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyR/-scCsNx;|iD]0}y|i||ƒSWq tj oq Xq Wt|ƒ‚dS(N(RXRR(RRRRV((s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyR0s  (R&R'R(R/R(((s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyRWs  N(R(tosRthashlibRt ImportErrortshaRtjinja2.exceptionsRt jinja2.utilsRRRRtobjectRR)R:RJRNRQRW(((s4/usr/lib64/python2.6/site-packages/jinja2/loaders.pyt s V+.