Ńņ
÷Ń{Ic @ s³ d d k Z d d k Z d d k Z d d k Z e i d j o d d k l Z n d d k l Z d d k
l Z l Z l
Z
d d k l Z d Z d e f d YZ d S(
i’’’’Ns 2.4( t ImmutableSet( t request_config( t controller_scant MatchExceptiont RoutesException( t Routec C s@ | i d o | d } n | i d o | d } n | S( s8 Remove slashes from the beginning and end of a part/URL.t /i i’’’’( t
startswitht endswith( t name( ( s1 /usr/lib/python2.6/site-packages/routes/mapper.pyt
strip_slashes s
t Mapperc B s° e Z d Z e e e e e d Z d Z d Z d Z
e e e e
Z d Z
d Z d Z e d Z d Z d
Z d Z d Z d
Z d Z RS( s| Mapper handles URL generation and URL recognition in a web
application.
Mapper is built handling dictionary's. It is assumed that the web
application will handle the dictionary returned by URL recognition
to dispatch appropriately.
URL generation is done by passing keyword parameters into the
generate function, a URL is then returned.
c C s g | _ h | _ h | _ h | _ t | _ t | _ d | _ t i
| _ | | _ | | _
| | _ d | _ h | _ t | _ t | _ t | _ g | _ d | _ | | _ d | _ d | _ t | _ t | _ t i | _ | o t } | | _ n d S( sv
Create a new Mapper instance
All keyword arguments are optional.
``controller_scan``
Function reference that will be used to return a list of
valid controllers used during URL matching. If
``directory`` keyword arg is present, it will be passed
into the function during its call. This option defaults to
a function that will scan a directory for controllers.
``directory``
Passed into controller_scan for the directory to scan. It
should be an absolute path if using the default
``controller_scan`` function.
``always_scan``
Whether or not the ``controller_scan`` function should be
run during every URL match. This is typically a good idea
during development so the server won't need to be restarted
anytime a controller is added.
``register``
Boolean used to determine if the Mapper should use
``request_config`` to register itself as the mapper. Since
it's done on a thread-local basis, this is typically best
used during testing though it won't hurt in other cases.
``explicit``
Boolean used to determine if routes should be connected
with implicit defaults of::
{'controller':'content','action':'index','id':None}
When set to True, these defaults will not be added to route
connections and ``url_for`` will not use Route memory.
Additional attributes that may be set after mapper
initialization (ie, map.ATTRIBUTE = 'something'):
``encoding``
Used to indicate alternative encoding/decoding systems to
use with both incoming URL's, and during Route generation
when passed a Unicode string. Defaults to 'utf-8'.
``decode_errors``
How to handle errors in the encoding, generally ignoring
any chars that don't convert should be sufficient. Defaults
to 'ignore'.
``minimization``
Boolean used to indicate whether or not Routes should
minimize URL's and the generated URL's, or require every
part where it appears in the path. Defaults to True.
``hardcode_names``
Whether or not Named Routes result in the default options
for the route being used *or* if they actually force url
generation to use the route. Defaults to False.
s [^\.\/]+?\.[^\.\/]+s utf-8t ignoreN(! t matchlistt maxkeyst minkeyst urlcachet Falset
_created_regst
_created_genst Nonet prefixt threadinglocalt localt req_datat directoryt always_scanR t
_regprefixt _routenamest debugt append_slasht sub_domainst sub_domains_ignoret domain_matcht explicitt encodingt
decode_errorst Truet hardcode_namest minimizationt threadingt Lockt create_regs_lockR t mapper( t selfR R R t registerR" t config( ( s1 /usr/lib/python2.6/site-packages/routes/mapper.pyt __init__# s6 ? c C s) y | i i SWn t j
o d SXd S( N( R t environt AttributeErrorR ( R, ( ( s1 /usr/lib/python2.6/site-packages/routes/mapper.pyt _envget~ s c C s | | i _ d S( N( R R0 ( R, t env( ( s1 /usr/lib/python2.6/site-packages/routes/mapper.pyt _envset s c C s
| i ` d S( N( R R0 ( R, ( ( s1 /usr/lib/python2.6/site-packages/routes/mapper.pyt _envdel
s c O s d } t | d j o | d } | d } n d | j o | i | d