Ñò ãŸIc@sîdZddkZddkZddkZddklZddklZl Z ddk Z ddk Z ddk Z ddk lZlZddklZddklZlZlZlZdgZeieƒZdefd „ƒYZdS( såWSGI App Creator This module is responsible for creating the basic Pylons WSGI application (PylonsApp). It's generally assumed that it will be called by Paste, though any WSGI server could create and call the WSGI app as well. iÿÿÿÿN(trequest_config(t HTTPFoundt HTTPNotFound(tRequesttResponse(t_get_translator(tAttribSafeContextObjt ContextObjt PylonsContexttclass_name_from_module_namet PylonsAppcBsVeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z RS( sãPylons WSGI Application This basic WSGI app is provided should a web developer want to get access to the most basic Pylons web application environment available. By itself, this Pylons web application does little more than dispatch to a controller and setup the context object, the request object, and the globals object. Additional functionality like sessions, and caching can be setup by altering the ``environ['pylons.environ_config']`` setting to indicate what key the ``session`` and ``cache`` functionality should come from. Resolving the URL and dispatching can be customized by sub-classing or "monkey-patching" this class. Subclassing is the preferred approach. c Ks–tiiƒ|_}|d}|d|_|idƒp|d|_|d|_||_|d|_|d|_ h|_ t |_ |ii ddƒd „}||_|id ƒo˜|d d }tii|d d |d |d|_xf|d dD]I}tid|d ƒ|ii|d d |d d|d|dqWn d|_|iiddƒ|_|iiddƒ|_dS(søInitialize a base Pylons WSGI application The base Pylons WSGI application requires several keywords, the package name, and the globals object. If no helpers object is provided then h will be None. spylons.packagespylons.hspylons.app_globalsspylons.gspylons.environ_configspylons.request_optionsspylons.response_optionstlangcSs#tid|ƒtd|ƒ‚dS(NsRaising redirect to %stlocation(tlogtdebugR(turl((s2/usr/lib/python2.6/site-packages/pylons/wsgiapp.pyt redirect_toDssbuffet.template_enginesitenginet template_rootttemplate_optionsis+Initializing additional template engine: %staliastsessionsbeaker.sessiontcaches beaker.cacheN(tpylonstconfigt _current_objthelperstgettglobalstenviron_configt package_nametrequest_optionstresponse_optionstcontroller_classestFalset log_debugt setdefaulttNoneRt templatingtBuffettbuffetR Rtpreparet _session_keyt _cache_key(tselftkwargsRRRtdef_engte((s2/usr/lib/python2.6/site-packages/pylons/wsgiapp.pyt__init__/s:                cCsntitiƒj}|_|i||ƒd|jo`|i|ƒ|ddjo>tii i |ƒ|ddgƒdtii i |ƒgSn|i ||ƒ}|i |||ƒ}d|jo"t|dƒo||dd ñs    cCsï||ijo |i|S|id|iddƒ}d}t|ƒtti|dƒo$tti|ti|iƒ}n[|i dƒd}t |ƒd}|i ot i d||ƒntti||ƒ}||i|<|S( sýLocates a controller by attempting to import it then grab the SomeController instance from the imported module. Override this to change how the controller object is found once the URL has been resolved. s .controllers.t/t.tbefore_and_thist__controller__iÿÿÿÿt Controllers+Found controller, module: '%s', class: '%s'(R!Rtreplacet __import__R@tsystmodulestgetattrRetsplitR R#R R(R,REtfull_module_namet__traceback_hide__t mycontrollert module_namet class_name((s2/usr/lib/python2.6/site-packages/pylons/wsgiapp.pyR` s       cCs¦|i}|p)|otidƒntƒ||ƒSt|dƒo.|otidƒn|ƒ}||_n||d<|otidƒn|||ƒS(s´Dispatches to a controller, will instantiate the controller if necessary. Override this to change how the controller dispatch is handled. s1No controller found, returning 404 HTTP Not Foundt __bases__s/Controller appears to be a class, instantiatingspylons.controllers,Calling controller class with WSGI interface(R#R RRR@t_pylons_log_debug(R,RERCRDR#((s2/usr/lib/python2.6/site-packages/pylons/wsgiapp.pyR?*s    cCsá|iotidƒn|d}|d}|i|d<|i|d<|i|d<|d<|i|d<|d <|id p|i|d <|i|d R`R?R8(((s2/usr/lib/python2.6/site-packages/pylons/wsgiapp.pyR s / 8 ;  ! (RwR4Ritpaste.registryR9troutesRt webob.excRRRt pylons.legacytpylons.templatingtpylons.controllers.utilRRtpylons.i18n.translationRt pylons.utilRRRR t__all__t getLoggerRBR tobjectR (((s2/usr/lib/python2.6/site-packages/pylons/wsgiapp.pyts      "