%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/opt/alt/python27/lib/python2.7/site-packages/mako/
Upload File :
Create Path :
Current File : //proc/self/root/opt/alt/python27/lib/python2.7/site-packages/mako/lookup.pyo

�
�ǚPc@s�ddlZddlZddlZddlZddlmZmZddlmZyddl	Z	Wnddl
Z	nXdefd��YZdefd��YZ
dS(i����N(t
exceptionstutil(tTemplatetTemplateCollectioncBs5eZdZd�Zdd�Zd�Zd�ZRS(s<Represent a collection of :class:`.Template` objects,
    identifiable via URI.

    A :class:`.TemplateCollection` is linked to the usage of
    all template tags that address other templates, such
    as ``<%include>``, ``<%namespace>``, and ``<%inherit>``.
    The ``file`` attribute of each of those tags refers
    to a string URI that is passed to that :class:`.Template`
    object's :class:`.TemplateCollection` for resolution.

    :class:`.TemplateCollection` is an abstract class,
    with the usual default implementation being :class:`.TemplateLookup`.

     cCs1y|j|�tSWntjk
r,tSXdS(s�Return ``True`` if this :class:`.TemplateLookup` is
        capable of returning a :class:`.Template` object for the
        given ``uri``.

        :param uri: String URI of the template to be resolved.

        N(tget_templatetTrueRtTemplateLookupExceptiontFalse(tselfturi((s</opt/alt/python27/lib/python2.7/site-packages/mako/lookup.pythas_template s

cCs
t��dS(s�Return a :class:`.Template` object corresponding to the given
        ``uri``.

        The default implementation raises
        :class:`.NotImplementedError`. Implementations should
        raise :class:`.TemplateLookupException` if the given ``uri``
        cannot be resolved.

        :param uri: String URI of the template to be resolved.
        :param relativeto: if present, the given ``uri`` is assumed to
         be relative to this URI.

        N(tNotImplementedError(RR	t
relativeto((s</opt/alt/python27/lib/python2.7/site-packages/mako/lookup.pyR.scCs|S(saConvert the given ``filename`` to a URI relative to
           this :class:`.TemplateCollection`.((RR	tfilename((s</opt/alt/python27/lib/python2.7/site-packages/mako/lookup.pytfilename_to_uri>scCs|S(s�Adjust the given ``uri`` based on the calling ``filename``.

        When this method is called from the runtime, the
        ``filename`` parameter is taken directly to the ``filename``
        attribute of the calling template. Therefore a custom
        :class:`.TemplateCollection` subclass can place any string
        identifier desired in the ``filename`` parameter of the
        :class:`.Template` objects it constructs and have them come back
        here.

        ((RR	R
((s</opt/alt/python27/lib/python2.7/site-packages/mako/lookup.pyt
adjust_uriDsN(t__name__t
__module__t__doc__R
tNoneRRR(((s</opt/alt/python27/lib/python2.7/site-packages/mako/lookup.pyRs
		tTemplateLookupcBs�eZdZd
d
eded
eed
dd
ded
d
d
d
d
d
ded
ed
d
d�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�ZRS(s�	Represent a collection of templates that locates template source files
    from the local filesystem.

    The primary argument is the ``directories`` argument, the list of
    directories to search:

    .. sourcecode:: python

        lookup = TemplateLookup(["/path/to/templates"])
        some_template = lookup.get_template("/index.html")

    The :class:`.TemplateLookup` can also be given :class:`.Template` objects
    programatically using :meth:`.put_string` or :meth:`.put_template`:

    .. sourcecode:: python

        lookup = TemplateLookup()
        lookup.put_string("base.html", '''
            <html><body>${self.next()}</body></html>
        ''')
        lookup.put_string("hello.html", '''
            <%include file='base.html'/>

            Hello, world !
        ''')


    :param directories: A list of directory names which will be
     searched for a particular template URI. The URI is appended
     to each directory and the filesystem checked.

    :param collection_size: Approximate size of the collection used
     to store templates. If left at its default of ``-1``, the size
     is unbounded, and a plain Python dictionary is used to
     relate URI strings to :class:`.Template` instances.
     Otherwise, a least-recently-used cache object is used which
     will maintain the size of the collection approximately to
     the number given.

    :param filesystem_checks: When at its default value of ``True``,
     each call to :meth:`.TemplateLookup.get_template()` will
     compare the filesystem last modified time to the time in
     which an existing :class:`.Template` object was created.
     This allows the :class:`.TemplateLookup` to regenerate a
     new :class:`.Template` whenever the original source has
     been updated. Set this to ``False`` for a very minor
     performance increase.

    :param modulename_callable: A callable which, when present,
     is passed the path of the source file as well as the
     requested URI, and then returns the full path of the
     generated Python module file. This is used to inject
     alternate schemes for Python module location. If left at
     its default of ``None``, the built in system of generation
     based on ``module_directory`` plus ``uri`` is used.

    All other keyword parameters available for
    :class:`.Template` are mirrored here. When new
    :class:`.Template` objects are created, the keywords
    established with this :class:`.TemplateLookup` are passed on
    to each new :class:`.Template`.

    i����tstricttbeakercCs�gtj|d�D]}tj|�^q|_||_||_||_||_|dkrji}n|r�|j
d|�n|r�|j
d|�n|r�|j
d|�ni|d6|d6|d6|d6|	d6|d	6|
d
6|d6|d6|d
6|d6|
d6|d6|d6|d6|d6|d6|d6|_|dkr]i|_i|_
n$tj|�|_tj|�|_
tj�|_dS(Ntdirturlttypetformat_exceptionst
error_handlertdisable_unicodetbytestring_passthroughtoutput_encodingt
cache_impltencoding_errorstinput_encodingtmodule_directoryt
module_writert
cache_argst
cache_enabledtdefault_filterstbuffer_filterststrict_undefinedtimportstenable_looptpreprocessori����((Rtto_listt	posixpathtnormpathtdirectoriesR"tmodulename_callabletfilesystem_checkstcollection_sizeRt
setdefaultt
template_argst_collectiont
_uri_cachetLRUCachet	threadingtLockt_mutex(RR/R"R1R2RRRRRR R$RR%t
cache_typet	cache_dirt	cache_urlR0R#R&R'R(R)R*R!R+td((s</opt/alt/python27/lib/python2.7/site-packages/mako/lookup.pyt__init__�sN.					
	cCs�y/|jr#|j||j|�S|j|SWn�tk
r�tjdd|�}xe|jD]C}tjtj	||��}t
jj|�r^|j
||�Sq^Wtjd|��nXdS(s�Return a :class:`.Template` object corresponding to the given
        ``uri``.

        .. note:: The ``relativeto`` argument is not supported here at the moment.

        s^\/+tsCant locate template for uri %rN(R1t_checkR5tKeyErrortretsubR/R-R.tjointostpathtisfilet_loadRtTopLevelLookupException(RR	tuRtsrcfile((s</opt/alt/python27/lib/python2.7/site-packages/mako/lookup.pyR�s	
cCs�||f}||jkr&|j|S|ddkr�|dk	rktjtj|�|�}|j|<q�d|}|j|<n|}|j|<|S(s9Adjust the given ``uri`` based on the given relative URI.it/N(R6RR-REtdirname(RR	Rtkeytv((s</opt/alt/python27/lib/python2.7/site-packages/mako/lookup.pyR�s#cCsDy|j|SWn.tk
r?|j|�}||j|<|SXdS(saConvert the given ``filename`` to a URI relative to
           this :class:`.TemplateCollection`.N(R6RBt_relativeize(RR
tvalue((s</opt/alt/python27/lib/python2.7/site-packages/mako/lookup.pyRs

cCsRtj|�}x<|jD]-}|dt|�!|kr|t|�SqWdSdS(skReturn the portion of a filename that is 'relative'
           to the directories in this lookup.

        iN(R-R.R/tlenR(RR
R((s</opt/alt/python27/lib/python2.7/site-packages/mako/lookup.pyRQs
c
Cs�|jj�z�y|j|SWntk
r2nXym|jdk	rZ|j||�}nd}td|dtj|�d|d||j	�|j|<}|SWn|jj
|d��nXWd|jj�XdS(NR	R
tlookuptmodule_filename(R:tacquireR5RBR0RRR-R.R4tpoptrelease(RR
R	RUttemplate((s</opt/alt/python27/lib/python2.7/site-packages/mako/lookup.pyRIs*

cCs�|jdkr|SyYtj|j�}|jj|tjkrg|jj|d�|j	|j|�S|SWn7t
k
r�|jj|d�tjd|��nXdS(NsCant locate template for uri %r(
R
RRFtstattmodulet_modified_timetST_MTIMER5RWRItOSErrorRR(RR	RYt
template_stat((s</opt/alt/python27/lib/python2.7/site-packages/mako/lookup.pyRA=s	
cCs)t|d|d||j�|j|<dS(s�Place a new :class:`.Template` object into this
        :class:`.TemplateLookup`, based on the given string of
        ``text``.

        RTR	N(RR4R5(RR	ttext((s</opt/alt/python27/lib/python2.7/site-packages/mako/lookup.pyt
put_stringOs
cCs||j|<dS(s�Place a new :class:`.Template` object into this
        :class:`.TemplateLookup`, based on the given
        :class:`.Template` object.

        N(R5(RR	RY((s</opt/alt/python27/lib/python2.7/site-packages/mako/lookup.pytput_template[sN((RRRRRRR?RRRRQRIRARaRb(((s</opt/alt/python27/lib/python2.7/site-packages/mako/lookup.pyRRsD?0				
			(RFRZR-RCtmakoRRt
mako.templateRR8tdummy_threadingtobjectRR(((s</opt/alt/python27/lib/python2.7/site-packages/mako/lookup.pyt<module>s0B

Zerion Mini Shell 1.0