Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
ó
¦‹EYc@sïdZddlZddlZddlmZddlZddlmZddlm	Z	m
Z
mZddlm
Z
ddd	gZd
ddd
gZd„Zdefd„ƒYZdefd„ƒYZd„Zdefd„ƒYZdS(sMapper and Sub-MapperiÿÿÿÿN(tLRUCache(trequest_config(tcontroller_scantRoutesExceptiont
as_unicode(tRoutetindextcreatetnewtshowtupdatetdeleteteditcCs<|jdƒr|d}n|jdƒr8|d }n|S(s8Remove slashes from the beginning and end of a part/URL.t/iiÿÿÿÿ(t
startswithtendswith(tname((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyt
strip_slashess


tSubMapperParentcBs2eZdZd„Zdddeedd„ZRS(sbBase class for Mapper and SubMapper, both of which may be the parent
    of SubMapper objects
    cKs
t||S(sãCreate a partial version of the Mapper with the designated
        options set

        This results in a :class:`routes.mapper.SubMapper` object.

        If keyword arguments provided to this method also exist in the
        keyword arguments provided to the submapper, their values will
        be merged with the saved options going first.

        In addition to :class:`routes.route.Route` arguments, submapper
        can also take a ``path_prefix`` argument which will be
        prepended to the path of all routes that are connected.

        Example::

            >>> map = Mapper(controller_scan=None)
            >>> map.connect('home', '/', controller='home', action='splash')
            >>> map.matchlist[0].name == 'home'
            True
            >>> m = map.submapper(controller='home')
            >>> m.connect('index', '/index', action='index')
            >>> map.matchlist[1].name == 'index'
            True
            >>> map.matchlist[1].defaults['controller'] == 'home'
            True

        Optional ``collection_name`` and ``resource_name`` arguments are
        used in the generation of route names by the ``action`` and
        ``link`` methods.  These in turn are used by the ``index``,
        ``new``, ``create``, ``show``, ``edit``, ``update`` and
        ``delete`` methods which may be invoked indirectly by listing
        them in the ``actions`` argument.  If the ``formatted`` argument
        is set to ``True`` (the default), generated paths are given the
        suffix '{.format}' which matches or generates an optional format
        extension.

        Example::

            >>> from routes.util import url_for
            >>> map = Mapper(controller_scan=None)
            >>> m = map.submapper(path_prefix='/entries', collection_name='entries', resource_name='entry', actions=['index', 'new'])
            >>> url_for('entries') == '/entries'
            True
            >>> url_for('new_entry', format='xml') == '/entries/new.xml'
            True

        (t	SubMapper(tselftkargs((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyt	submapper#s0s/{id}c	KsÍ|dkr|p|}n|dkrE|dkr<d}
q`d}
n|dkrZd}
nd}
|
jd|d|ƒ}t|d|d|d|d	|d
||	}t|d|d
||pÀi|_|S(sÂCreate a submapper that represents a collection.

        This results in a :class:`routes.mapper.SubMapper` object, with a
        ``member`` property of the same type that represents the collection's
        member resources.

        Its interface is the same as the ``submapper`` together with
        ``member_prefix``, ``member_actions`` and ``member_options``
        which are passed to the ``member`` submapper as ``path_prefix``,
        ``actions`` and keyword arguments respectively.

        Example::

            >>> from routes.util import url_for
            >>> map = Mapper(controller_scan=None)
            >>> c = map.collection('entries', 'entry')
            >>> c.member.link('ping', method='POST')
            >>> url_for('entries') == '/entries'
            True
            >>> url_for('edit_entry', id=1) == '/entries/1/edit'
            True
            >>> url_for('ping_entry', id=1) == '/entries/1/ping'
            True

        ts/{collection_name}s{pre}s{pre}/{collection_name}tpretcollection_namet
resource_nametpath_prefixt
controllertactionsN(tNonetformatRtmember(RRRRt
member_prefixRtcollection_actionstmember_actionstmember_optionstkwargstpath_prefix_strt
collection((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyR'Us&				N(t__name__t
__module__t__doc__RRtCOLLECTION_ACTIONStMEMBER_ACTIONSR'(((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyRs	2RcBs¼eZdZddddd„Zdd„Zdddddd„Zd„Zd„Zddddd„Z	dd„Z
dd	„Zd
„Zd„Z
d„Zd
„Zd„Zd„ZRS(s#Partial mapper for use with_optionscKsÅ||_||_||_d|_|p]t|ddƒp]|jddƒp]t|ddƒ|_|dk	r{||_n0t|ddƒ|_|jdkr«t	|_n|j
|pºg|dS(NRRt	formatted(R%tobjRRR tgetattrtgetRR-tTruetadd_actions(RR.RRRR-R%((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyt__init__“s				c
Ksri}|}|}x
tj|jƒD]ù\}}|dkr‡|dk	rhdj|j||fƒ}qdj|j||fƒ}q%|dkrÇ|dk	r¾dj|j||fƒ}qd}q%||kr
t|tƒrüt|||||<q||||<q%|j|||<q%Wx.|D]&}||jkr)||||<q)q)W||f}	|jj|	|ŽS(NRRtname_prefix(	tsixt	iteritemsR%Rtjoint
isinstancetdictR.tconnect(
Rt	routenametpathR%tnewkargst
_routenamet_pathtkeytvaluetnewargs((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyR:¥s,	
tGETcKsw|s|dkr$|jr$d}nd}|j|pD|d|jd|pP||d|pg|pg|t||ƒS(s§Generates a named route for a subresource.

        Example::

            >>> from routes.util import url_for
            >>> map = Mapper(controller_scan=None)
            >>> c = map.collection('entries', 'entry')
            >>> c.link('recent', name='recent_entries')
            >>> c.member.link('ping', method='POST', formatted=True)
            >>> url_for('entries') == '/entries'
            True
            >>> url_for('recent_entries') == '/entries/recent'
            True
            >>> url_for('ping_entry', id=1) == '/entries/1/ping'
            True
            >>> url_for('ping_entry', id=1, format='xml') == '/entries/1/ping.xml'
            True

        s	{.format}Rt_R
tactionN(RR-R:Rt_kwargs_with_conditions(RtrelRREtmethodR-R%tsuffix((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pytlinkËs	cKs|jdd|S(s4Generates the "new" link for a collection submapper.RGR(RJ(RR%((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyRêscKs|jdd|S(s<Generates the "edit" link for a collection member submapper.RGR(RJ(RR%((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyRîscKsc|s|dkr$|jr$d}nd}|j|pD|d|j|d|pS|t||ƒS(sÓGenerates a named route at the base path of a submapper.

        Example::

            >>> from routes import url_for
            >>> map = Mapper(controller_scan=None)
            >>> c = map.submapper(path_prefix='/entries', controller='entry')
            >>> c.action(action='index', name='entries', formatted=True)
            >>> c.action(action='create', method='POST')
            >>> url_for(controller='entry', action='index', method='GET') == '/entries'
            True
            >>> url_for(controller='entry', action='index', method='GET', format='xml') == '/entries.xml'
            True
            >>> url_for(controller='entry', action='create', method='POST') == '/entries'
            True

        s	{.format}RRDREN(RR-R:RRF(RRRERHR-R%RI((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyREòs		c	Ks(|jd|p|jdddd|S(s8Generates the "index" action for a collection submapper.RRERRHRC(RER(RRR%((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyRsc	Ks(|jd|p|jdddd|S(s>Generates the "show" action for a collection member submapper.RRER	RHRC(RER(RRR%((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyR	scKs|jdddd|S(s9Generates the "create" action for a collection submapper.RERRHtPOST(RE(RR%((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyRscKs|jdddd|S(s@Generates the "update" action for a collection member submapper.RER
RHtPUT(RE(RR%((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyR
scKs|jdddd|S(s@Generates the "delete" action for a collection member submapper.RERRHtDELETE(RE(RR%((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyR scKs*g|D]}t||ƒ|^qdS(N(R/(RRR%RE((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyR2$scCs|S(N((R((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyt	__enter__(scCsdS(N((RttypeRAttb((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyt__exit__+sN(R(R)R*RR3R:RJRRRERR	RR
RR2RNRQ(((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyR‘s"&							cCs;|r3d|kr3|jƒ}i|d6|d<|S|SdS(Nt
conditionsRH(tcopy(R%RHt	newkwargs((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyRF0s
tMappercBsÚeZdZeeeeed„Zd„Zd„Z	d„Z
d„Zee	e
eƒZ
dd„Zd„Zd	„Zd
„Zd„Zed„Zd
„Zeed„Zeed„Zd„Zd„Zd„ZRS(spMapper 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.

    cCsg|_i|_i|_tdƒ|_t|_t|_d|_	d|_
tjƒ|_
||_||_||_d|_i|_t|_t|_t|_g|_d|_||_d|_d|_t|_t|_tjƒ|_|rt ƒ}||_!ndS(sµ
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.

            Alternatively, a list of controllers or None can be passed
            in which are assumed to be the definitive list of
            controller names valid when matching 'controller'.

        ``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.

        i@s[^\.\/]+?\.[^\.\/]+sutf-8tignoreN("t	matchlisttmaxkeystminkeysRturlcachetFalset
_created_regst
_created_gensRt_master_regexptprefixt	threadingtlocaltreq_datat	directorytalways_scanRt
_regprefixt_routenamestdebugtappend_slashtsub_domainstsub_domains_ignoretdomain_matchtexplicittencodingt
decode_errorsR1thardcode_namestminimizationtLocktcreate_regs_lockRtmapper(RRRcRdtregisterRltconfig((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyR3Es8C																							csÍd„}d
gg|jD]Q}|jp+d||ƒ|jp@d|jjddƒ|jjddƒf^q}gtt|d	ƒƒD]"‰t‡fd
†|Dƒƒ^qˆ‰dj‡fd†|DƒƒS(s*Generates a tabular string representation.cSsK|jrC|jjddƒ}t|ƒtkr6|pBdj|ƒSdSdS(NRHRs, (RRR0ROtstrR7(trRH((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pytformat_methods§s	%s
Route nametMethodstPatht
ControllerRERRic3s|]}t|ˆƒVqdS(N(tlen(t.0trow(tcol(sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pys	<genexpr>³ss
c3s=|]3‰dj‡‡fd†ttˆƒƒDƒƒVqdS(t c3s&|]}ˆ|jˆ|ƒVqdS(N(tljust(R}R(R~twidths(sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pys	<genexpr>·sN(R7trangeR|(R}(R‚(R~sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pys	<genexpr>·s(s
Route nameRysPathR{saction(	RWRt	routepathtdefaultsR0RƒR|tmaxR7(RRxRwttable((RR‚sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyt__str__¥s	_<cCs'y|jjSWntk
r"dSXdS(N(RbtenvirontAttributeErrorR(R((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyt_envget»s
cCs||j_dS(N(RbR‰(Rtenv((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyt_envsetÁscCs
|j`dS(N(RbR‰(R((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyt_envdelÄsRcCswxp|D]h}|r7|jr7dj||jgƒ}n|rM||j}n	|j}|j|j||jqWdS(síExtends the mapper routes with a list of Route objects

        If a path_prefix is provided, all the routes will have their
        path prepended with the path_prefix.

        Example::

            >>> map = Mapper(controller_scan=None)
            >>> map.connect('home', '/', controller='home', action='splash')
            >>> map.matchlist[0].name == 'home'
            True
            >>> routes = [Route('index', '/index.htm', controller='home',
            ...                 action='index')]
            >>> map.extend(routes)
            >>> len(map.matchlist) == 2
            True
            >>> map.extend(routes, path_prefix='/subapp')
            >>> len(map.matchlist) == 3
            True
            >>> map.matchlist[2].routepath == '/subapp/index.htm'
            True

        .. note::

            This function does not merely extend the mapper with the
            given list of routes, it actually creates new routes with
            identical calling arguments.

        R
N(RpR7R„R:Rt_kargs(RtroutesRtrouteR„((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pytextendÈs
	cOs
t||ŽS(sjMake a new Route object

        A subclass can override this method to use a custom Route class.
        (R(RtargsR((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyt
make_routeïscOsvd}t|ƒdkr%|d}n
d	|}d|krK|j|d<nd|krg|j|d<n|j||Ž}|jdks—|jdkr¾d|kr¾|j|_|j|_n|jsÚ|jj	|ƒn|rù||j
|<||_n|jrdSt}x>|j
D]3}||j
kr|j
|j	|ƒt}PqqW|si|g|j
|j
<nt|_dS(
s¶Create and connect a new Route to the Mapper.

        Usage:

        .. code-block:: python

            m = Mapper()
            m.connect(':controller/:action/:id')
            m.connect('date/:year/:month/:day', controller="blog",
                      action="view")
            m.connect('archives/:page', controller="blog", action="by_page",
            requirements = { 'page':'\d{1,2}' })
            m.connect('category_list', 'archives/category/:section',
                      controller='blog', action='category',
                      section='home', type='list')
            m.connect('home', '', controller='blog', action='view',
                      section='home')

        iit	_explicitt	_minimizesutf-8RVt	_encodingN(N(RR|RlRpR”RmRntstaticRWtappendRfRR[RXR1R](RR“RR;R‘texistsR@((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyR:ös:

	
	c
Cs–i}i}xf|jD][}|jr+qnd|jkrNt||jd<nd|jkrt||jd<qqWt|jƒƒdg}t|jƒƒdg}i}xÐ|jD]Å}|jrÌq·n|}|}d|jkrú|jdg}nd|jkr%tj|jdƒg}nxT|D]L}xC|D];}|j	|iƒ}	|	j	|gifƒdj
|ƒq9Wq,Wq·W||_t|_dS(s.Create the generation hashes for route lookupsRREt*iN(
RWR˜R…R1tlisttkeyst	hardcodedR5t	text_typet
setdefaultR™t_gendictR](
Rtcontrollerlistt
actionlistR‘tgendicttclisttalistRREt
actiondict((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyt_create_gens.s6		

/	cOs6|jjƒz|j||ŽWd|jjƒXdS(sPAtomically creates regular expressions for all connected
        routes
        N(Rrtacquiret_create_regstrelease(RR“R%((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pytcreate_regsXs
c	Cs™|dkrf|jr*|j|jƒ}qft|jƒrH|jƒ}qf|jsZg}qf|j}nx>tj|jƒD]*\}}x|D]}|j|ƒqŒWqyWg}g}xF|jD];}|j	s½|j
|ƒ|j
|j|dtƒƒq½q½W||_|j
r*tj|j
dƒ|_ndjg|D]}d|^q7ƒ}||_ytj|ƒ|_Wntk
r‹d|_nXt|_dS(s4Creates regular expressions for all connected routest
include_namess(.*)t|s(?:%s)N(RRcRtcallableR5R6RXt
makeregexpRWR˜R™R[t
_routematchesR_tretcompileReR7t_master_regR^t
OverflowErrorR1R\(	RR¥R@tvalR‘tregexpstroutematchestxtregexp((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyRªbs6			
	
#		&	

c
CsÜ|jr |jr |jƒn|js8tdƒ‚n|jrN|jƒng}|jr¬tj|j|ƒrœtj	|jd|ƒ}|s©d}q©q¬dd|fSn|p¸|j}|j}|j
}|j}|j}|jdk	rtj|j|ƒ}nt}|sdd|fSx­|jD]¢}	|	jrc|r)|jtd|	dtƒƒq)q)n|	j|||||ƒ}
|r©|jtd|	dt|
ƒƒƒnt|
tƒs¾|
r)|
|	|fSq)Wdd|fS(sêInternal Route matcher

        Matches a URL against a route, and returns a tuple of the match
        dict and the route object if a match is successfull, otherwise
        it returns empty.

        For internal use only.

        s:You must generate the regular expressions before matching.s\1R
R‘R˜RºN(R\RR¬RRdR_R²tmatchRetsubRR‰RiRjRkRgR^R1RWR˜R™R9tboolR8(RturlR‰tmatchlogRiRjRkRgt	valid_urlR‘R»((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyt_match‡sF

		
					
		%cCs˜|dkr"|r"tdƒ‚n|dkr;|d}n|j||ƒ}|jro|d|d|dfSt|dtƒsŒ|dr”|dSdS(sÊMatch a URL against against one of the routes contained.

        Will return None if no valid match is found.

        .. code-block:: python

            resultdict = m.match('/joe/sixpack')

        sURL or environ must be providedt	PATH_INFOiiiN(RRRÁRgR8R9(RR¾R‰tresult((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyR»Âs

	cCs¢|dkr"|r"tdƒ‚n|dkr;|d}n|j||ƒ}|jro|d|d|dfSt|dtƒsŒ|drž|d|dfSdS(sMatch a URL against against one of the routes contained.

        Will return None if no valid match is found, otherwise a
        result dict and a route object is returned.

        .. code-block:: python

            resultdict, route_obj = m.match('/joe/sixpack')

        sURL or environ must be providedRÂiiiN(RRRÁRgR8R9(RR¾R‰RÃ((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyt
routematchÙs
	c
sI|js|jƒn|jr,t|d<n|jsjd|krNd|d<nd|krjd|d<qjn|jd|jƒp‚i}d|krž|d}n.|jrÆd|jkrÆ|jd}nd}|jddƒ}|jddƒ}t	j
|ƒjd	ƒt	j
|ƒjd	ƒ}|jdk	rt	j
rWd
j|jdƒ|fƒ}nd||f}|jj||ƒ}	|	|kr|	Snt||jƒ}t||jƒ}|jj|ƒp×|jjd
iƒ}
|
rì|rìdS|
j|ƒp|
jd
difƒ\}}|r+|r+dSt|jƒƒ‰t}
t	j
ˆƒ}|j|ƒ}|rp|}nž|r|}nt}
g}x>|D]6}t|j|jˆƒdkr’|j|ƒq’q’W|}dd‡fd†ƒY}|jd|ƒ|
r|||<nx4|D],}t}xo|jD]d}|j|ƒ}|sLq+nt||jƒ}||j|kr+t|j|ƒr+t}Pq+q+W|rŸqn|j|}|r|jrÍ|j|}n|joÜ|j }|j!r|r||}|}n|}|jdk	r4|jj"|t#|ƒƒnt#|ƒSqqWdS(sØGenerate a route from a set of keywords

        Returns the url text, or None if no URL could be generated.

        .. code-block:: python

            m.generate(controller='content',action='view',id=10)

        t
_append_slashRtcontentRERt_environtSCRIPT_NAMERtutf8t:sutf-8s%s:%sR›it	KeySortercs2eZd„Zd„Z‡fd†Zd„ZRS(cWs
||_dS(N(R.(RR.R“((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyR3@scSs|j|j|jƒdkS(Ni(t_keysortR.(Rtother((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyt__lt__Cscsú|j}|j}tˆ|Aƒ}tˆ|Aƒ}|dkrN|dkrNdS|dkr^dS|dkrndS|j||ƒdkr–|j||ƒStˆ|@ƒtˆ|@ƒkrÒ|jt|ƒt|ƒƒS|jtˆ|@ƒtˆ|@ƒƒSdS(sOSorts two sets of sets, to order them ideally for
                    matching.iiÿÿÿÿiN(RXR|t_compare(Rtatbtlendiffatlendiffb(R(sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyRÌFs		 cSs(||krdS||kr dSdSdS(Niÿÿÿÿii((Rtobj1tobj2((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyRÏis
(R(R)R3RÎRÌRÏ((R(sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyRË>s		#R@N(($R]R¨RhR1RltpopR‰R0RR5RŸtencodeRZtPY3R7RRmR¡t	frozensetRR[R|RYtdotkeysR™tsortRžR…R¯tgenerateR_R˜texternaltabsolutetputRv(RR“RR‰tscript_nameRREt	cache_keytcache_key_script_nameR¶R£tkeylistt	sortcachetcachesettcachekeyt	cachelisttnewlistR‘RËtfailR@tkvalR<texternal_static((RsB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyRÜðs¢	
	
	

	'		
 3

	
	
c
s÷|jdiƒ}|jdiƒ}|jdiƒ}|jdd1ƒ}|jdd1ƒ}|jdd1ƒ}	|	d1k	r¿|d1krŸd|	d|	d	f}n|d1kréd
|	d	}qén*|d1krÔd}n|d1kréd}nd|d
<|jidd6ƒd„}
|
|iƒ}|
|iƒ}|
|iƒ}
|jdgƒjddƒ|jdgƒjddƒ|jdgƒjddƒt|ƒ}t|ƒ}d|}|rÖ|dkrÖ|d|}n
d|}|}|d}|d}i|jd|ƒd6|d6|d6|	d6|jdƒd6‰d|krU|dˆd<n‡‡fd†}xítj|ƒD]Ü\‰}ˆdkrž|jdƒp¡d1}|ˆƒ}xi|D]a}||d <d!|||f}|j	d"|d#||f||j	|d$||f|q·W|rw||d <|j	d%|||j	||qwqwW|j	d"|||d&d d'd(idgd)6ˆ|j	|||d d'd(idgd)6ˆxÍtj|
ƒD]¼\‰}|ˆƒ}x¡|D]™}d*|}||d <|dkr!|}|d&}n.d$||f}|d+|}d#||f}|j	d"|||||j	||||qèWqÉWd,}xtj|ƒD]ó\‰}|ˆƒ}i|d-6|d<ˆd2kræ|jdƒ}nd1}xl|D]d}||d <|j	d/|||fd#||f||j	d!|||fd$||f|qóW|rŸ||d <|j	d%|||j	||qŸqŸW|dƒ}d0|d <i|d-6|d<|j	d"|||d&||j	||||d1S(3sGenerate routes for a controller resource

        The member_name name should be the appropriate singular version
        of the resource given your locale and used with members of the
        collection. The collection_name name will be used to refer to
        the resource collection methods and should be a plural version
        of the member_name argument. By default, the member_name name
        will also be assumed to map to a controller you create.

        The concept of a web resource maps somewhat directly to 'CRUD'
        operations. The overlying things to keep in mind is that
        mapping a resource is about handling creating, viewing, and
        editing that resource.

        All keyword arguments are optional.

        ``controller``
            If specified in the keyword args, the controller will be
            the actual controller used, but the rest of the naming
            conventions used for the route names and URL paths are
            unchanged.

        ``collection``
            Additional action mappings used to manipulate/view the
            entire set of resources provided by the controller.

            Example::

                map.resource('message', 'messages', collection={'rss':'GET'})
                # GET /message/rss (maps to the rss action)
                # also adds named route "rss_message"

        ``member``
            Additional action mappings used to access an individual
            'member' of this controllers resources.

            Example::

                map.resource('message', 'messages', member={'mark':'POST'})
                # POST /message/1/mark (maps to the mark action)
                # also adds named route "mark_message"

        ``new``
            Action mappings that involve dealing with a new member in
            the controller resources.

            Example::

                map.resource('message', 'messages', new={'preview':'POST'})
                # POST /message/new/preview (maps to the preview action)
                # also adds a url named "preview_new_message"

        ``path_prefix``
            Prepends the URL path for the Route with the path_prefix
            given. This is most useful for cases where you want to mix
            resources or relations between resources.

        ``name_prefix``
            Perpends the route names that are generated with the
            name_prefix given. Combined with the path_prefix option,
            it's easy to generate route names and paths that represent
            resources that are in relations.

            Example::

                map.resource('message', 'messages', controller='categories',
                    path_prefix='/category/:category_id',
                    name_prefix="category_")
                # GET /category/7/message/1
                # has named route "category_message"

        ``requirements``

           A dictionary that restricts the matching of a
           variable. Can be used when matching variables with path_prefix.

           Example::

                map.resource('message', 'messages',
                     path_prefix='{project_id}/',
                     requirements={"project_id": R"\d+"})
                # POST /01234/message
                #    success, project_id is set to "01234"
                # POST /foo/message
                #    404 not found, won't be matched by this route


        ``parent_resource``
            A ``dict`` containing information about the parent
            resource, for creating a nested resource. It should contain
            the ``member_name`` and ``collection_name`` of the parent
            resource. This ``dict`` will
            be available via the associated ``Route`` object which can
            be accessed during a request via
            ``request.environ['routes.route']``

            If ``parent_resource`` is supplied and ``path_prefix``
            isn't, ``path_prefix`` will be generated from
            ``parent_resource`` as
            "<parent collection name>/:<parent member name>_id".

            If ``parent_resource`` is supplied and ``name_prefix``
            isn't, ``name_prefix`` will be generated from
            ``parent_resource`` as  "<parent member name>_".

            Example::

                >>> from routes.util import url_for
                >>> m = Mapper()
                >>> m.resource('location', 'locations',
                ...            parent_resource=dict(member_name='region',
                ...                                 collection_name='regions'))
                >>> # path_prefix is "regions/:region_id"
                >>> # name prefix is "region_"
                >>> url_for('region_locations', region_id=13)
                '/regions/13/locations'
                >>> url_for('region_new_location', region_id=13)
                '/regions/13/locations/new'
                >>> url_for('region_location', region_id=13, id=60)
                '/regions/13/locations/60'
                >>> url_for('region_edit_location', region_id=13, id=60)
                '/regions/13/locations/60/edit'

            Overriding generated ``path_prefix``::

                >>> m = Mapper()
                >>> m.resource('location', 'locations',
                ...            parent_resource=dict(member_name='region',
                ...                                 collection_name='regions'),
                ...            path_prefix='areas/:area_id')
                >>> # name prefix is "region_"
                >>> url_for('region_locations', area_id=51)
                '/areas/51/locations'

            Overriding generated ``name_prefix``::

                >>> m = Mapper()
                >>> m.resource('location', 'locations',
                ...            parent_resource=dict(member_name='region',
                ...                                 collection_name='regions'),
                ...            name_prefix='')
                >>> # path_prefix is "regions/:region_id"
                >>> url_for('locations', region_id=51)
                '/regions/51/locations'

        R'R RRR4tparent_resources	%s/:%s_idRtmember_names%s_RRCRcSsCx<tj|ƒD]+\}}|j|jƒgƒj|ƒqW|S(siSwap the keys and values in the dict, and uppercase the values
            from the dict during the swap.(R5R6R tupperR™(tdcttnewdctR@R¶((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pytswapFs#RKiRRLR
RMRR
s/news/:(id)Rt_member_namet_collection_namet_parent_resourcet_filtertrequirementscs9ˆjƒ}ˆdkr5i|jƒgd6|d<n|S(sUReturns a new dict to be used for all route creation as the
            route optionstanyRHRR(RSRî(tmethtopts(RHtoptions(sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pytrequirements_forksREs%s%s_%st
formatted_s%s/%s.:(format)s%s/%ss%s.:(format)s
.:(format)RRRRHtnew_RDs
[^\/]+(?<!\\)tidR÷sformatted_%s%s_%sR	N(sPOSTsGETsany(
RÖRR
R tinsertRR0R5R6R:(RRíRR%R'R RRR4RìRñtcollection_methodstmember_methodstnew_methodsRR<tcollection_pathtnew_pathtmember_pathRûtlsttprimaryt
route_optionsREt
route_nameRtformatted_pathtrequirements_regexp((RHRúsB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pytresource•sʓ
		
	



	!











cOsñdddg}dg}|jddƒ}ii}}	x/||D]#}
|
|krB||
||
<qBqBWt|d<x+|D]#}
|
|krz||
|	|
<qzqzW|j||	|jd}|jd	t|ƒ||t|_||_d
S(sAdd a redirect route to the mapper

        Redirect routes bypass the wrapped WSGI application and instead
        result in a redirect being issued by the RoutesMiddleware. As
        such, this method is only meaningful when using
        RoutesMiddleware.

        By default, a 302 Found status code is used, this can be
        changed by providing a ``_redirect_code`` keyword argument
        which will then be used instead. Note that the entire status
        code string needs to be present.

        When using keyword arguments, all arguments that apply to
        matching will be used for the match, while generation specific
        options will be used during generation. Thus all options
        normally available to connected Routes may be used with
        redirect routes as well.

        Example::

            map = Mapper()
            map.redirect('/legacyapp/archives/{url:.*}', '/archives/{url}')
            map.redirect('/home/index', '/',
                         _redirect_code='301 Moved Permanently')

        R—R•R–Rõt_redirect_codes	302 Foundt_staticiÿÿÿÿs_redirect_%sN(RÖR1R:RWRþtredirecttredirect_status(Rt
match_pathtdestination_pathR“R%t	both_argstgen_argststatus_codetgen_dictt
match_dictR@tmatch_route((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyR»s"	



	(R(R)R*RRR[R1R3RˆR‹RRŽtpropertyR‰R’R”R:R¨R¬RªRÁR»RÄRÜRR(((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyRU9s*_				'		8	*	
%	;	¥	ÿ'(R*R²R`t
repoze.lruRR5RRtroutes.utilRRRtroutes.routeRR+R,RtobjectRRRFRU(((sB/home/tvault/.virtenv/lib/python2.7/site-packages/routes/mapper.pyt<module>s		sŸ