Ñò @¨ Ic @s¦dZddkZddkZddkZddkZddklZddklZl Z ddk Z ddk Z dgZ ei eƒZdefd„ƒYZdS(sThe core WSGIControlleriÿÿÿÿN(t HTTPException(Rt HTTPNotFoundtWSGIControllercBsAeZdZeZd„Zd„Zd„Zd„Zd„Z RS(sGWSGI Controller that follows WSGI spec for calling and return values The Pylons WSGI Controller handles incoming web requests that are dispatched from the PylonsBaseWSGIApp. These requests result in a new instance of the WSGIController being created, which is then called with the dict options from the Routes match. The standard WSGI response is then returned with start_response called as per the WSGI spec. Special WSGIController methods you may define: ``__before__`` This method is called before your action is, and should be used for setting up variables/objects, restricting access to other actions, or other tasks which should be executed before the action is called. ``__after__`` This method is called after the action is, unless an unexpected exception was raised. Subclasses of :class:`~webob.exc.HTTPException` (such as those raised by ``redirect_to`` and ``abort``) are expected; e.g. ``__after__`` will be called on redirects. Each action to be called is inspected with :meth:`_inspect_call` so that it is only passed the arguments in the Routes match dict that it asks for. The arguments passed into the action can be customized by overriding the :meth:`_get_method_args` function which is expected to return a dict. In the event that an action is not found to handle the request, the Controller will raise an "Action Not Found" error if in debug mode, otherwise a ``404 Not Found`` error will be returned. cCsd}||S(s3Hide the traceback for everything above this methodtbefore_and_this((tselftfunctargst__traceback_hide__((s;/usr/lib/python2.6/site-packages/pylons/controllers/core.pyt _perform_call9scCsÉy|ii}Wn#tj oh|i_}nXy||i}Wn-tj o!ti|ƒ}||ish              cCsJ|ii}|idiƒ}|i|d<|i|d<|i|d<|S(s-Retrieve the method arguments to use with inspect call By default, this uses Routes to retrieve the arguments, override this method to customize the arguments your controller actions are called with. This method should return a dict. spylons.routes_dictR-tstart_responseR+(RR,R-tcopyR9(RtreqR0((s;/usr/lib/python2.6/site-packages/pylons/controllers/core.pyR…s    c Cs/|i}|ii}y|idd}Wntj otdƒ‚nX|iddƒ}|otid|ƒnyt ||d ƒ}Wnt j o d }nX|djo-t |ƒo ||id<|i |ƒ}nG|otid |ƒntid otd |ƒ‚n tƒ}|S( sDHandles dispatching the request to the function using Routesspylons.routes_dicttactionsBNo action matched from Routes, unable todetermine action dispatch.t-t_s+Looking for %r method to handle the requestR9spylons.action_methods*Couldn't find %r method to handle responseRsAction %r is not implementedN(RRR,R-Rt ExceptiontreplaceRRtgetattrRtUnicodeEncodeErrortcallableR8R+RtNotImplementedErrorR(RR1R;R<t action_methodRR*((s;/usr/lib/python2.6/site-packages/pylons/controllers/core.pyt_dispatch_call–s0       c s‘ˆi‰|dˆ_yF|ddd djo)ˆotidƒntƒ|ˆƒSWntj onXg‰d‡‡‡‡fd†}|ˆ_tˆd ƒo7ˆi ˆi ƒ}t|d ƒo||ˆiƒSnˆi ƒ}ˆpàˆˆ_ˆii }t |tƒo,ˆotid ƒn|i||_n†t |tƒo,ˆotid ƒn|i||_nJt|d ƒoïˆotidƒn|ti jo)|iƒ}titiitdƒnxZ|iiƒD]I\}}|iƒdjo|ii||ƒqô|ii||ƒqôWy!|d}|iti |ƒWntj onX|}nK|djoˆotidƒqÌn"ˆotidƒn||_|}ntˆdƒo7ˆi ˆi ƒ} t| d ƒo| |ˆiƒSnt|d ƒoHd|jo||ddR=sJAction starts with _, private action not allowed. Returning a 404 responsecsŽˆii}ˆidƒˆotid|ƒnxG|iD]<}|ddjp|didƒo|i|ƒq>q>Wˆ|||ƒS(NsDMerging pylons.response headers into start_response call, status: %sis Set-CookiesX-(RR*tappendRRRt headerlistt startswith(tstatusR#R R*theader(R9Rtstart_response_calledR1(s;/usr/lib/python2.6/site-packages/pylons/controllers/core.pytrepl_start_responseÊs     %t __before__R%s<Controller returned a string , writing it to pylons.responsesDController returned a unicode string , writing it to pylons.responseRsFController returned a Response object, merging it with pylons.responses set-cookiespaste.registrysController returned NonesPAssuming controller returned an iterable, setting it as pylons.response.app_itert __after__spaste.testing_variablesR*s+Calling Response object to return WSGI datas9Response assumed to be WSGI content, returning un-touched(R>R=N(!RRRRRRRR9thasattrR8RNRFR*Rtstrtbodytunicodet unicode_bodyR+t _current_objR'R(tlegacytresponse_warningR)R#titemstlowertaddt setdefaultR@tapp_iterRO( RR-R9RMR*t py_responseR5tvaluetregistrytafter((R9RLR1Rs;/usr/lib/python2.6/site-packages/pylons/controllers/core.pyt__call__·s†              ( Rt __module__t__doc__tFalseRRR8RRFRa(((s;/usr/lib/python2.6/site-packages/pylons/controllers/core.pyRs$  G  !(RcRtloggingRR'tpaste.httpexceptionsRR&t webob.excRR+t pylons.legacyt__all__t getLoggerRRtobjectR(((s;/usr/lib/python2.6/site-packages/pylons/controllers/core.pyts