Ñò PhEc@sòddkZddkZddkZddkZddkZddkZddkZddkZddk i Z ddk l Z ddk iZddkiZddkZddkZddddddd d d d d dddgZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZd„Zdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZd efd„ƒYZd efd„ƒYZd efd„ƒYZ d efd„ƒYZ!defd „ƒYZ"d efd!„ƒYZ#defd"„ƒYZ$defd#„ƒYZ%d$e%fd%„ƒYZ&hZ'ei(e)Z*xte*i+i,ƒD]cZ-e.e-ƒei/jpe.e-ƒei0jo1e1e-eƒo!e2e-d&ƒoe-e'e-i3 %sit/is isdirectory: t file_patht last_modifiedtpathtpath_idtids%s|%s(R4RtnextR+tappendR2RtunixpathtjointostaccesstF_OKtstattST_MODEtST_MTIMEtS_ISDIRRRtFileComponentSource( RR)R*RRR@Rtroottsrcfiletsttmodetmodtime((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyR+]sF       N(RRRtnameRRR%R+(((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyRAs   cBs5eZdZdZd„Zdd„Zdd„ZRS(sÎresolves a callable object or class instance inside a module, based on a traversal of path tokens corresponding to the module's file location, and then of the object paths defined within the module.t pathmodulecOs”|iddƒp|iddƒ|_|iddƒ|_|iddƒ|_|iddƒ|_t|ƒot|ƒ|_n d|_dS(NR/tmodule_root_adjusttrequire_publishtpath_stringtokenstpath_moduletokens( R1RR2t_require_publisht stringtokenst moduletokensR3tlistt module_root(Rt module_rootsR((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyR•s( c Kså|i|_|idjo ||_n|idjodS|idjo|iddƒ|_n|idjo|idtƒ|_n|idjo|idgƒ|_n|idjo|iddgƒ|_nxùt dt |iƒƒD]ß}|i|}t |t i ƒp¹yDti|ƒ}ti|tiƒoti|ƒ|i| %siR=itreloadt_s^_+tR[R\tpublishRhtobjpathR?targ(#R^RRCR+RDR2R3R[R$RetObjectPathIteratorRatsplittretsubR tget_unitR\t StopIterationR7R8Rctstrt FunctionTypet MethodTypetcallableRZtgetattrR,RtModuleComponentSourceRhRrR?R( RR)R*Rt dhandler_pathRR@ROtiteratortunitttokentmatchedtcs((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyR+½sh   %  $*   0'   3- N(RRRRTRRR%R+(((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyRs  cCs2x+|D]#}ti|d|d|ƒ}qW|S(Nii(RvRw(R/R@ta((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyt adjust_pathûs!cBseZdZd„ZRS(s a ResolveFile rule that adds a pre-path-concatenation adjustment step, so the uri can be translated before determining the file path. unlike path_translate, this translated uri is only used to determine a filesystem path, and is not propigated anywhere else.cs#ti|d‡fd†|ŒdS(NR/cs tˆ|ƒS((R‡(tp(R/(s3/usr/lib/python2.6/site-packages/myghty/resolver.pyts(RR(RR/R5((R/s3/usr/lib/python2.6/site-packages/myghty/resolver.pyRs(RRRR(((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyRstAdjustedResolvePathModulecBseZdZd„ZRS(sa ResolvePathModule rule that adds a pre-path-concatenation adjustment step, so the uri can be translated before determining the file path. unlike path_translate, this translated uri is only used to determine a filesystem path, and is not propigated anywhere else.cs#ti|d‡fd†|ŒdS(NR/cs tˆ|ƒS((R‡(Rˆ(R/(s3/usr/lib/python2.6/site-packages/myghty/resolver.pyR‰ s(RR(RR/R_((R/s3/usr/lib/python2.6/site-packages/myghty/resolver.pyR s(RRRR(((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyRŠscBs5eZdZdZd„Zdd„Zdd„ZRS(s2resolves a Module Component based on information in a given list of dictionaries, containing regular expressions for keys which are matched against the URI. The value for each key references either a class, a callable object or function, or a string in the form ":".t resolvemodulecGs0t|ƒo ||_n d|_h|_dS(N(R3tmodule_componentsRt csource_cache(RRŒ((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyRs   cKs¨|i|_|idjo ||_n|idjodSti|iƒ|_xN|iiƒD]=\}}t|tiƒph|d6}||i|s  cBsDeZdZddd„Zd„Zd„Zd„Zdd„ZRS(s¥conditionally executes a rule, only executes if the uri matches a certain regexp, or a passed-in context string matches one of the contexts set up for this rule.cCsB||_|dj o|idƒ|_n g|_||_dS(Nt,(R—RRutcontextstregexp(RR—RšR’((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyRUs    cKs|ii|||dS(N(R—R'(RR!R&R((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyR%^scCs*x#|iD]}||jotSq WtS(N(R™R R,(RR’tc((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyt_match_contextas   cKs@|dj o|i|ƒp#|idj oti|i|ƒS(N(RRœRšRvR(RR)tresolver_contextR((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyttest_conditiongscKs¦|i|||oj|dj o=|idj o|id|iƒq`|id|ƒn|ii|||d||S|iƒi|||d||SdS(Ns conditional: R(RžRRšRDR—R+RC(RR)R*RRR((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyR+ns  N( RRRRRR%RœRžR+(((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyRQs    cBs eZdZddgd„ZRS(sKcombines a Conditional and a Group to make a conditionally-executing Group.cCs#ti|td|ƒ||ƒdS(NR–(RRR(RRšR’R–((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyR}sN(RRRRR(((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyRzscBs)eZdZdZed„Zd„ZRS(sYreturns not found. place at the bottom of Group and Match chains to have them terminate.tnotfoundcCs ||_dS(sÁsilent = True indicates that a resulting TopLevelNotFound exception should be 'silent', i.e. not logged. this is used when a 404 error is being propigated to another application layer.N(tsilent(RR ((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyR‡scKsA|dj o|idƒntid||d|iƒ‚dS(NRŸscant locate component %sR (RRDRtComponentNotFoundR (RR)R*RR((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyR+Œs (RRRRTR,RR+(((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyR ƒs cBs;eZdZdZd„Zd„Zdd„Zd„ZRS(s] performs path translation rules on the given uri and sends control off to the next rule.t pathtranslatecGs't|ƒo ||_n d|_dS(N(R3tpath_translateR(Rt translations((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyR–s  cCstS(N(R (R((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyR-sc sg|idjo ||_n|idj o6t|iƒ o%|i‰‡fd†}||_ndS(Ncs2x+ˆD]#}ti|d|d|ƒ}qW|S(Nii(RvRw(turlR—(tpt(s3/usr/lib/python2.6/site-packages/myghty/resolver.pyttrans¤s!(R£RR}(RR!R&R£RR§((R¦s3/usr/lib/python2.6/site-packages/myghty/resolver.pyR%Ÿs  ! cKs†|idjo|iƒi||||S|}|i|ƒ}|dj o|id||fƒn|iƒi||||S(Nstranslate: %s -> %s(R£RRCR+RD(RR)R*RRtolduri((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyR+©s N( RRRRTRR-RR%R+(((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyR s    cBs5eZdZdZddd„Zd„Zd„ZRS(sucaches the result of either a given nested rule, or the remaining rules in its chain, based on the incoming URI.turicachecCs||_||_dS(sö rule is a single ResolverRule (or Group) whos results will be cached on a per-uri basis. if rule is None, then the result of remaining rules in the current chain will be cached based on the incoming URI. This rule cannot be a PathTranslation rule or other uri-modifying rule, since the translated uri is not stored. source_cache_size is the size of the LRUCache to create. if source_cache_size is None, it will use the Resolver's source cache, sharing it with any other URICaches that also use the Resolver's source cache. When using the Resolver's source cache, if the Resolver has use_static_source disabled, then caching is disabled in this URICache. N(tsource_cache_sizeR—(RRªR—((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyR»s cKs“|idj oJ|iiƒo tidt|iƒƒ‚n|ii|||n|idjo|i|_nt i |iƒ|_dS(Ns7can't cache single rule %s - it is a URI-modifying rule( R—RR-RR#RzR'Rªt source_cacheR;tLRUCache(RR!R&R((s3/usr/lib/python2.6/site-packages/myghty/resolver.pyR%Ís c Ks|idjoJ|idj o|ii||||S|iƒi||||Snt|ƒd|}y¯|i|}|dj o||d7}n|idƒoO|idj o1t|dtƒo|iƒi||||S|d‚n!t i |dƒ}||_ |SWnÜt j oÐg}|i dt tiƒƒƒd}t} zxy“|idj o%|ii|tgƒ||}n|iƒi||||}|i} h|d6|d6}|dj o||7}n|SWnÞtj o†} h| d6|d6}|idj o8|dj o||7}n|iƒi||||S|dj o||7}n| ‚nNtij o>} h| d6|d6}|dj o||7}n| ‚nXWd| tjo||i| s@T  Nl 0)  %t?=K L