Ñò
ûãtHc @ sÓ d Z y d d k l Z Wn) e j
o d e f d „ ƒ YZ n Xd d k Z d d k l Z d d k Z d d k l Z l
Z
l Z l Z l
Z
l Z d d k l Z d d
d d d
d g Z d Z e i d d f j o
d „ Z n
d „ Z d e f d „ ƒ YZ d
e f d „ ƒ YZ d e f d „ ƒ YZ d e f d „ ƒ YZ d e f d „ ƒ YZ d „ Z d „ Z d „ Z d e f d „ ƒ YZ d
e f d „ ƒ YZ! e! i" Z" e! i# Z# e! i$ Z$ e! i% Z% d S( s Basic templating functionality.iÿÿÿÿ( t dequeR c B s e Z d „ Z d „ Z RS( c C s | i d | ƒ d S( Ni ( t insert( t selft x( ( s: /usr/lib64/python2.6/site-packages/genshi/template/base.pyt
appendleft s c C s
| i d ƒ S( Ni ( t pop( R ( ( s: /usr/lib64/python2.6/site-packages/genshi/template/base.pyt popleft s ( t __name__t
__module__R R ( ( ( s: /usr/lib64/python2.6/site-packages/genshi/template/base.pyR s N( t StringIO( t Attrst Streamt StreamEventKindt STARTt TEXTt _ensure( t
ParseErrort Contextt Templatet
TemplateErrort TemplateRuntimeErrort TemplateSyntaxErrort BadDirectiveErrors restructuredtext eni i c C s | i d S( i ( t frames( t ctxt( ( s: /usr/lib64/python2.6/site-packages/genshi/template/base.pyt " s c C s | S( ( ( R ( ( s: /usr/lib64/python2.6/site-packages/genshi/template/base.pyR $ s c B s e Z d Z d d d d „ Z RS( s? Base exception class for errors related to template processing.iÿÿÿÿc C sƒ | d j o
d } n | | _ | d j p
| d j o d | i | | f } n t i | | ƒ | | _ | | _ | | _ d S( s9 Create the exception.
:param message: the error message
:param filename: the filename of the template
:param lineno: the number of line in the template at which the error
occurred
:param offset: the column number at which the error occurred
s i s %s (%s, line %d)N( t Nonet msgt Exceptiont __init__t filenamet linenot offset( R t messageR R R ( ( s: /usr/lib64/python2.6/site-packages/genshi/template/base.pyR * s
N( R R t __doc__R R ( ( ( s: /usr/lib64/python2.6/site-packages/genshi/template/base.pyR ' s c B s e Z d Z d d d d „ Z RS( s| Exception raised when an expression in a template causes a Python syntax
error, or the template is not well-formed.
iÿÿÿÿc C s] t | t ƒ o3 | i d j o# t | ƒ i d | i d ƒ } n t i | | | | ƒ d S( s8 Create the exception
:param message: the error message
:param filename: the filename of the template
:param lineno: the number of line in the template at which the error
occurred
:param offset: the column number at which the error occurred
s
(line %d)t N( t
isinstancet SyntaxErrorR R t strt replaceR R ( R R! R R R ( ( s: /usr/lib64/python2.6/site-packages/genshi/template/base.pyR C s #N( R R R" R R ( ( ( s: /usr/lib64/python2.6/site-packages/genshi/template/base.pyR > s c B s e Z d Z d d d „ Z RS( sñ Exception raised when an unknown directive is encountered when parsing
a template.
An unknown directive is any attribute using the namespace for directives,
with a local name that doesn't match any registered directive.
iÿÿÿÿc C s t i | d | | | ƒ d S( sø Create the exception
:param name: the name of the directive
:param filename: the filename of the template
:param lineno: the number of line in the template at which the error
occurred
s bad directive "%s"N( R R ( R t nameR R ( ( s: /usr/lib64/python2.6/site-packages/genshi/template/base.pyR Y s N( R R R" R R ( ( ( s: /usr/lib64/python2.6/site-packages/genshi/template/base.pyR Q s c B s e Z d Z RS( sf Exception raised when an the evaluation of a Python expression in a
template causes an error.
( R R R" ( ( ( s: /usr/lib64/python2.6/site-packages/genshi/template/base.pyR e s c B s˜ e Z d Z d „ Z d „ Z d „ Z e Z d „ Z d „ Z d „ Z d „ Z
d d „ Z d d „ Z
d
„ Z d „ Z d „ Z d
„ Z d „ Z RS( sp Container for template input data.
A context provides a stack of scopes (represented by dictionaries).
Template directives such as loops can push a new scope on the stack with
data that should only be available inside the loop. When the loop
terminates, that scope can get popped off the stack again.
>>> ctxt = Context(one='foo', other=1)
>>> ctxt.get('one')
'foo'
>>> ctxt.get('other')
1
>>> ctxt.push(dict(one='frost'))
>>> ctxt.get('one')
'frost'
>>> ctxt.get('other')
1
>>> ctxt.pop()
{'one': 'frost'}
>>> ctxt.get('one')
'foo'
c s‡ t | g ƒ ˆ _ ˆ i i ˆ _ ˆ i i ˆ _ g ˆ _ g ˆ _ ‡ f d † } d ‡ f d † } | i d | ƒ | i d | ƒ d S( sZ Initialize the template context with the given keyword arguments as
data.
c s
| ˆ j S( s] Return whether a variable with the specified name exists in the
expression scope.( ( R( ( R ( s: /usr/lib64/python2.6/site-packages/genshi/template/base.pyt defined s c s ˆ i | | ƒ S( sˆ If a variable of the specified name is defined, return its value.
Otherwise, return the provided default value, or ``None``.( t get( R( t default( R ( s: /usr/lib64/python2.6/site-packages/genshi/template/base.pyt value_of“ s R) R, N(
R R R R R t pusht _match_templatest
_choice_stackR t
setdefault( R t dataR) R, ( ( R s: /usr/lib64/python2.6/site-packages/genshi/template/base.pyR „ s c C s t t | i ƒ ƒ S( N( t reprt listR ( R ( ( s: /usr/lib64/python2.6/site-packages/genshi/template/base.pyt __repr__š s c C s | i | ƒ d d j S( su Return whether a variable exists in any of the scopes.
:param key: the name of the variable
i N( t _findR ( R t key( ( s: /usr/lib64/python2.6/site-packages/genshi/template/base.pyt __contains__ s c C s0 x) | i D] } | | j o | | =q
q
Wd S( sa Remove a variable from all scopes.
:param key: the name of the variable
N( R ( R R6 t frame( ( s: /usr/lib64/python2.6/site-packages/genshi/template/base.pyt __delitem__¥ s
c C s6 | i | ƒ \ } } | d j o t | ƒ ‚ n | S( s Get a variables's value, starting at the current scope and going
upward.
:param key: the name of the variable
:return: the variable value
:raises KeyError: if the requested variable wasn't found in any scope
N( R5 R t KeyError( R R6 t valueR8 ( ( s: /usr/lib64/python2.6/site-packages/genshi/template/base.pyt __getitem__® s
c C s t | i ƒ ƒ S( s‰ Return the number of distinctly named variables in the context.
:return: the number of variables in the context
( t lent items( R ( ( s: /usr/lib64/python2.6/site-packages/genshi/template/base.pyt __len__» s c C s | | i d |