Ñò »ÏâIc @sÉdZddkZd„Zdefd„ƒYZdefd„ƒYZdefd „ƒYZd efd „ƒYZdd kl Z l Z l Z l Z l Z dd klZlZddklZlZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZedƒZZee iƒe_ede iddƒe_ede i ƒe_ ed e i!ƒe_"ed e i#ƒe_$ed!e i%dd"ƒe_%ee i&ƒe_'ed#e i(dd$ƒe_)ed%e i*ƒe_*ed#e i+dd&ƒe_+ed#e i,dd'ƒe_,ee i-ƒe_-ee i.ƒe_.eƒe_eei/ƒe_eei0ƒe_ed%ei1d(ƒe_ed#ei2ƒe_2ed#e i ƒe_ ed#e i3ƒe_3ede i4ƒe_4ede i5ƒe_5ede i6ƒe_6ede i7ƒe_7ed%e i8dd)ƒe_8ed#e i9ƒe_9ede i:ƒe_:ede i&ƒe_&[[ [ [ [ [ dS(*s´CherryPy tools. A "tool" is any helper, adapted to CP. Tools are usually designed to be used in a variety of ways (although some may only offer one if they choose): Library calls: All tools are callables that can be used wherever needed. The arguments are straightforward and should be detailed within the docstring. Function decorators: All tools, when called, may be used as decorators which configure individual CherryPy page handlers (methods on the CherryPy tree). That is, "@tools.anytool()" should "turn on" the tool via the decorated function's _cp_config attribute. CherryPy config: If a tool exposes a "_setup" callable, it will be called once per Request (if the feature is "turned on" via config). Tools may be implemented as any object with a namespace. The builtins are generally either modules or instances of the tools.Tool class. iÿÿÿÿNcCsCddk}t||iƒo |i}n|i}|i|i S(s?Return the names of all static arguments to the given function.iÿÿÿÿN(ttypest isinstancet MethodTypetim_funct func_codet co_varnamest co_argcount(tfuncRtco((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyt_getargss    tToolcBsJeZdZdZddd„Zd„Zdd„Zd„Zd„Z RS( s™A registered function for use with CherryPy request-processing hooks. help(tool.callable) should give you more information about this Tool. ttoolsi2cCsA||_||_||_||_|ii|_|iƒdS(N(t_pointtcallablet_namet _priorityt__doc__t_setargs(tselftpointR tnametpriority((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyt__init__.s     cCs¶y.x't|iƒD]}t||dƒqWWnttfj oKt|idƒo1x.t|iiƒD]}t||dƒqkWq²n&tj ont j onXdS(s,Copy func parameter names to obj attributes.t__call__N( R R tsetattrtNonet TypeErrortAttributeErrorthasattrRtNotImplementedErrort IndexError(Rtarg((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyR6scCst|o|iƒ}nh}tii|i}|i|jo|i||iƒnd|jo |d=n|S(s5Return a dict of configuration entries for this Tool.ton(tcopytcherrypytrequestttoolmapst namespaceRtupdate(Rtdtconfttm((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyt _merged_argsIs  cs4|otdˆiƒ‚n‡‡fd†}|S(súCompile-time decorator (turn on the tool in config). For example: @tools.proxy() def whats_my_base(self): return cherrypy.request.base whats_my_base.exposed = True sQThe %r Tool does not accept positional arguments; you must use keyword arguments.csxt|dƒp h|_nˆidˆid}t|i|ds     tHandlerWrapperToolcBs)eZdZdddd„Zd„ZRS(s(Tool which wraps request.handler in a provided wrapper function. The 'newhandler' arg must be a handler wrapper function that takes a 'next_handler' argument, plus *args and **kwargs. Like all page handler functions, it must return an iterable for use as cherrypy.response.body. For example, to allow your 'inner' page handlers to return dicts which then get interpolated into a template: def interpolator(next_handler, *args, **kwargs): filename = cherrypy.request.config.get('template') cherrypy.response.template = env.get_template(filename) response_dict = next_handler(*args, **kwargs) return cherrypy.response.template.render(**response_dict) cherrypy.tools.jinja = HandlerWrapperTool(interpolator) R?i2cCs(||_||_||_||_dS(N(t newhandlerR RR(RRKRRR((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyRÁs   cs.tii‰‡‡fd†}|ti_dS(Ncsˆiˆ||ŽS(N(RK(R5R3(Rt innerfunc(s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pytwrapÉs(R"R#RH(RRM((RRLs7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyR Çs N(R<R=RRRR (((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyRJ¯st ErrorToolcBs,eZdZdd„Zd„Zd„ZRS(sATool which is used to replace the default request.error_response.cCsti|d||ƒdS(N(R RR(RR R((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyRÑscCs|i|iƒdS(N(R R*(R((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyRIÔscCs|iti_dS(s¸Hook this tool into cherrypy.request. The standard CherryPy request object will automatically call this method when the tool is "turned on" in config. N(RIR"R#terror_response(R((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyR;×sN(R<R=RRRRIR;(((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyRNÎs  (tcptoolstencodingtauthtstaticttidy(tsessionstxmlrpc(tcachingtwsgiappt SessionToolcBs2eZdZd„Zd„Zd„Zd„ZRS(sqSession Tool for CherryPy. sessions.locking: When 'implicit' (the default), the session will be locked for you, just before running the page handler. When 'early', the session will be locked before reading the request body. This is off by default for safety reasons; for example, a large upload would block the session, denying an AJAX progress meter (see http://www.cherrypy.org/ticket/630). When 'explicit' (or any other value), you need to call cherrypy.session.acquire_lock() yourself before using session data. cCsti|dtiƒdS(Ntbefore_request_body(R Rt _sessionstinit(R((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyRöscCstiiiƒdS(N(R"tservingtsessiont acquire_lock(R((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyt _lock_sessionúscCsütii}|iƒ}|idd ƒ}|d jot|id|iƒ}n|i |i |id|||iddƒ}|djo|i d|i ƒn+|djo|i d|i ddƒn|i dt i ƒ|i d t iƒd S( s¸Hook this tool into cherrypy.request. The standard CherryPy request object will automatically call this method when the tool is "turned on" in config. RtlockingtimplicitR?tearlyRZi<tbefore_finalizeton_end_requestN(R"R#R8R*R6RR7R RR9R R`R[tsavetclose(RR8R(R:Ra((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyR;ýs      c Cswtii}|iƒtg}|iƒiƒD]*\}}|djo|||fq0q0~ƒ}ti|dS( s<Drop the current session and make a new one (with a new id).tpatht path_headerRttimeouttdomaintsecureN(spathRisnameRjRkRl( R"R]R^t regeneratetdictR*R.R[tset_response_cookie(Rtsesst_[1]R1R2R(((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyRms   &'(R<R=RRR`R;Rm(((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyRYçs     tXMLRPCControllercBs-eZdZhed6Zd„Zee_RS(sA Controller (page handler collection) for XML-RPC. To use it, have your controllers subclass this base class (it will turn on the tool for you). You can also supply the following optional config entries: tools.xmlrpc.encoding: 'utf-8' tools.xmlrpc.allow_none: 0 XML-RPC is a rather discontinuous layer over HTTP; dispatching to the appropriate handler must first be performed according to the URL, and then a second dispatch step must take place according to the RPC method specified in the request body. It also allows a superfluous "/RPC2" prefix in the URL, supplies its own handler args in the body, and requires a 200 OK "Fault" response instead of 404 when the desired method is not found. Therefore, XML-RPC cannot be implemented for CherryPy via a Tool alone. This Controller acts as the dispatch target for the first half (based on the URL); it then reads the RPC method from the request body and does its own second dispatch step based on that method. It also reads body params, and returns a Fault on error. The XMLRPCDispatcher strips any /RPC2 prefix; if you aren't using /RPC2 in your URL's, you can safely skip turning on the XMLRPCDispatcher. Otherwise, you need to use declare it in config: request.dispatch: cherrypy.dispatch.XMLRPCDispatcher() stools.xmlrpc.onc OsÙtiƒ\}}|}x/t|ƒidƒD]}t||dƒ}q.W|o*t|dtƒo||||Ž}ntd|‚ti i di dhƒ}ti ||i ddƒ|i dd ƒƒti iS( NR,RGsmethod "%s" is not supportedR RVRQsutf-8t allow_nonei(t_xmlrpct process_bodytstrtsplitR7RtFalset ExceptionR"R#R$tgettrespondRARB( Rtvpathtparamst rpcparamst rpcmethodt subhandlertattrRBR(((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pytdefaultNs  (R<R=RR-R+R‚RG(((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyRr)s  t WSGIAppToolcBseZdZd„ZRS(sóA tool for running any WSGI middleware/application within CP. Here are the parameters: wsgi_app - any wsgi application callable env_update - a dictionary with arbitrary keys and values to be merged with the WSGI environ dictionary. Example: class Whatever: _cp_config = {'tools.wsgiapp.on': True, 'tools.wsgiapp.app': some_app, 'tools.wsgiapp.env': app_environ, } cCstti_ti|ƒdS(N(RxR"R#tprocess_request_bodyR>R;(R((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyR;ys (R<R=RR;(((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyRƒgstSessionAuthToolcBseZd„ZRS(cCsBx;ttiƒD]*}|idƒpt||dƒqqWdS(Nt__(tdirRPt SessionAutht startswithRR(RR((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyRs(R<R=R(((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyR…st CachingToolcBs,eZdZdd„Zde_d„ZRS(sCaching Tool for CherryPy.tPOSTtPUTtDELETEcKs¶ti}ttdƒpO|idtiƒƒt_x1|iƒD]\}}tti||ƒqAWnti d|ƒo d|_ n+|i o |i idtiddƒndS(Nt_cachet cache_classtinvalid_methodsRdRiZ(R"R#RR6t_cachingt MemoryCacheRŽR.RRzRRHt cacheableR8R9t tee_output(RRR3R#R1R2((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyRIŠs    icCsD|iƒ}|iddƒ}tiiid|id||dS(s#Hook caching into cherrypy.request.RR?N(R*R6RR"R#R8R9RI(RR(R:((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyR;žs (R‹RŒR(R<R=RRIRR;(((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyRЇs  tToolboxcBs2eZdZd„Zd„Zd„Zd„ZRS(s´A collection of Tools. This object also functions as a config namespace handler for itself. Custom toolboxes should be added to each Application's toolboxes dict. cCs ||_dS(N(R%(RR%((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyR¯scCsTt|tƒo-|idjo ||_n|i|_nti|||ƒdS(N(RR RRR%tobjectt __setattr__(RRtvalue((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pyR—²s  cs*htii|i<‰‡fd†}|S(s9Populate request.toolmaps from tools specified in config.cs8|iddƒ\}}ˆi|hƒ}|||RJRNt cherrypy.libRPRQRRRSRTRUR[RVRtRWR‘RXt_wsgiappRYRrRƒR…RŠR•tdefault_toolboxt_dt session_authtproxytresponse_headerst log_tracebacktlog_tracebackstlog_request_headerst log_headerst log_hookstredirectt err_redirecttvalidate_etagstetagstdecodetencodetgzipt staticdirt staticfileton_errortrunRztexpirestnsgmlstignore_headerstreferert basic_autht digest_authttrailing_slashtflattentaccept(((s7/usr/lib/python2.6/vendor-packages/cherrypy/_cptools.pytsZ  Y0(B>!%