Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes
MoinMoin.support.werkzeug.contrib.kickstart.Application Class Reference

List of all members.

Public Member Functions

def __init__
def __call__
def config_session

Public Attributes

 name
 url_map
 processors
 store

Detailed Description

A generic WSGI application which can be used to start with Werkzeug in
an easy, straightforward way.

Definition at line 119 of file kickstart.py.


Constructor & Destructor Documentation

def MoinMoin.support.werkzeug.contrib.kickstart.Application.__init__ (   self,
  name,
  url_map,
  session = False,
  processors = None 
)

Definition at line 124 of file kickstart.py.

00124 
00125     def __init__(self, name, url_map, session=False, processors=None):
00126         # save the name and the URL-map, as it'll be needed later on
00127         self.name = name
00128         self.url_map = url_map
00129         # save the list of processors if supplied
00130         self.processors = processors or []
00131         # create an instance of the storage
00132         if session:
00133             self.store = session
00134         else:
00135             self.store = None


Member Function Documentation

def MoinMoin.support.werkzeug.contrib.kickstart.Application.__call__ (   self,
  environ,
  start_response 
)

Definition at line 136 of file kickstart.py.

00136 
00137     def __call__(self, environ, start_response):
00138         # create a request - with or without session support
00139         if self.store is not None:
00140             request = Request(environ, self.url_map,
00141                 session_store=self.store, cookie_name='%s_sid' % self.name)
00142         else:
00143             request = Request(environ, self.url_map)
00144 
00145         # apply the request processors
00146         for processor in self.processors:
00147             request = processor.process_request(request)
00148 
00149         try:
00150             # find the callback to which the URL is mapped
00151             callback, args = request.url_adapter.match(request.path)
00152         except (HTTPException, RequestRedirect), e:
00153             response = e
00154         else:
00155             # check all view processors
00156             for processor in self.processors:
00157                 action = processor.process_view(request, callback, (), args)
00158                 if action is not None:
00159                     # it is overriding the default behaviour, this is
00160                     # short-circuiting the processing, so it returns here
00161                     return action(environ, start_response)
00162 
00163             try:
00164                 response = callback(request, **args)
00165             except Exception, exception:
00166                 # the callback raised some exception, need to process that
00167                 for processor in reversed(self.processors):
00168                     # filter it through the exception processor
00169                     action = processor.process_exception(request, exception)
00170                     if action is not None:
00171                         # the exception processor returned some action
00172                         return action(environ, start_response)
00173                 # still not handled by a exception processor, so re-raise
00174                 raise
00175 
00176         # apply the response processors
00177         for processor in reversed(self.processors):
00178             response = processor.process_response(request, response)
00179 
00180         # return the completely processed response
00181         return response(environ, start_response)
00182 

Here is the call graph for this function:

def MoinMoin.support.werkzeug.contrib.kickstart.Application.config_session (   self,
  store,
  expiration = 'session' 
)
Configures the setting for cookies. You can also disable cookies by
setting store to None.

Definition at line 183 of file kickstart.py.

00183 
00184     def config_session(self, store, expiration='session'):
00185         """
00186         Configures the setting for cookies. You can also disable cookies by
00187         setting store to None.
00188         """
00189         self.store = store
00190         # expiration=session is the default anyway
00191         # TODO: add settings to define the expiration date, the domain, the
00192         # path any maybe the secure parameter.
00193 


Member Data Documentation

Definition at line 126 of file kickstart.py.

Definition at line 129 of file kickstart.py.

Definition at line 132 of file kickstart.py.

Definition at line 127 of file kickstart.py.


The documentation for this class was generated from the following file: