Ñò
ñG“Ic @ sR d Z d d k Z d d d „ ƒ YZ d e f d „ ƒ YZ d d
d „ ƒ YZ d S( s:
Just string.Template, backported for use with Python 2.3
iÿÿÿÿNt _multimapc B s e Z d Z d „ Z d „ Z RS( s‡ Helper class for combining multiple mappings.
Used by .{safe_,}substitute() to combine the mapping and keyword
arguments.
c C s | | _ | | _ d S( N( t _primaryt
_secondary( t selft primaryt secondary( ( s= /usr/lib/python2.6/site-packages/webob/util/stringtemplate.pyt __init__
s c C s1 y | i | SWn t j
o | i | SXd S( N( R t KeyErrorR ( R t key( ( s= /usr/lib/python2.6/site-packages/webob/util/stringtemplate.pyt __getitem__ s ( t __name__t
__module__t __doc__R R ( ( ( s= /usr/lib/python2.6/site-packages/webob/util/stringtemplate.pyR s t _TemplateMetaclassc B s e Z d Z d „ Z RS( s/
%(delim)s(?:
(?P%(delim)s) | # Escape sequence of two delimiters
(?P%(id)s) | # delimiter and a Python identifier
{(?P%(id)s)} | # delimiter and a braced identifier
(?P) # Other ill-formed delimiter exprs
)
c C sƒ t t | ƒ i | | | ƒ d | j o
| i } n+ t i h t i | i ƒ d 6| i d 6} t i | t i t i
Bƒ | _ d S( Nt patternt delimt id( t superR
R R t _ret escapet delimitert idpatternt compilet
IGNORECASEt VERBOSE( t clst namet basest dctR ( ( s= /usr/lib/python2.6/site-packages/webob/util/stringtemplate.pyR " s
( R
R R R ( ( ( s= /usr/lib/python2.6/site-packages/webob/util/stringtemplate.pyR
s t Templatec B sD e Z d Z e Z d Z d Z d „ Z d „ Z d „ Z d „ Z
RS( s. A string class for supporting $-substitutions.t $s [_a-z][_a-z0-9]*c C s
| | _ d S( N( t template( R R ( ( s= /usr/lib/python2.6/site-packages/webob/util/stringtemplate.pyR 5 s c C s | i d ƒ } | i | i t ƒ } | p d } d } n* | t d i | d ƒ ƒ } t | ƒ } t d | | f ƒ ‚ d S( Nt invalidi t iÿÿÿÿs. Invalid placeholder in string: line %d, col %d( t startR t
splitlinest Truet lent joint
ValueError( R t mot it linest colnot lineno( ( s= /usr/lib/python2.6/site-packages/webob/util/stringtemplate.pyt _invalid: s
c s„ t | ƒ d j o t d ƒ ‚ n | p
| ‰ n) | o t | | d ƒ ‰ n | d ‰ ‡ ‡ f d † } ˆ i i | ˆ i ƒ S( Ni s Too many positional argumentsi c sš | i d ƒ p
| i d ƒ } | d j o ˆ | } d | S| i d ƒ d j o ˆ i S| i d ƒ d j o ˆ i | ƒ n t d ˆ i ƒ ‚ d S( Nt namedt braceds %st escapedR s# Unrecognized named group in pattern( t groupt NoneR R- R' R ( R( R. t val( t mappingR ( s= /usr/lib/python2.6/site-packages/webob/util/stringtemplate.pyt convertP s
( R% t TypeErrorR R t subR ( R t argst kwsR5 ( ( R R4 s= /usr/lib/python2.6/site-packages/webob/util/stringtemplate.pyt
substituteF s
c s„ t | ƒ d j o t d ƒ ‚ n | p
| ‰ n) | o t | | d ƒ ‰ n | d ‰ ‡ ‡ f d † } ˆ i i | ˆ i ƒ S( Ni s Too many positional argumentsi c sö | i d ƒ } | d j o2 y d ˆ | SWqN t j
o ˆ i | SXn | i d ƒ } | d j o: y d ˆ | SWq¤ t j
o ˆ i d | d SXn | i d ƒ d j o ˆ i S| i d ƒ d j o ˆ i St d ˆ i ƒ ‚ d S( NR. s %sR/ t {t }R0 R s# Unrecognized named group in pattern( R1 R2 R R R' R ( R( R. R/ ( R4 R ( s= /usr/lib/python2.6/site-packages/webob/util/stringtemplate.pyR5 j s$
( R% R6 R R R7 R ( R R8 R9 R5 ( ( R R4 s= /usr/lib/python2.6/site-packages/webob/util/stringtemplate.pyt safe_substitute` s
( R
R R R
t
__metaclass__R R R R- R: R= ( ( ( s= /usr/lib/python2.6/site-packages/webob/util/stringtemplate.pyR . s ( ( ( R t reR R t typeR
R ( ( ( s= /usr/lib/python2.6/site-packages/webob/util/stringtemplate.pyt s