Package web :: Package web :: Module application'
[hide private]
[frames] | no frames]

Module application'

source code

Web application (from web.py)

Classes [hide private]
  Reloader
Checks to see if any loaded modules have changed on disk and, if so, reloads them.
  application
Application to delegate requests based on path.
  auto_application
Application similar to `application` but urls are constructed automatiacally using metaclass.
  subdir_application
Application to delegate requests based on path.
  subdomain_application
Application to delegate requests based on the host.
Functions [hide private]
 
autodelegate(prefix='')
Returns a method that takes one argument and calls the method named prefix+arg, calling `notfound()` if there isn't one.
source code
 
loadhook(h)
Converts a load hook into an application processor.
source code
 
unloadhook(h)
Converts an unload hook into an application processor.
source code
Variables [hide private]
  __package__ = 'web.web'
Function Details [hide private]

autodelegate(prefix='')

source code 

Returns a method that takes one argument and calls the method named prefix+arg,
calling `notfound()` if there isn't one. Example:

    urls = ('/prefs/(.*)', 'prefs')

    class prefs:
        GET = autodelegate('GET_')
        def GET_password(self): pass
        def GET_privacy(self): pass

`GET_password` would get called for `/prefs/password` while `GET_privacy` for 
`GET_privacy` gets called for `/prefs/privacy`.

If a user visits `/prefs/password/change` then `GET_password(self, '/change')`
is called.

loadhook(h)

source code 

Converts a load hook into an application processor.

>>> app = auto_application()
>>> def f(): "something done before handling request"
...
>>> app.add_processor(loadhook(f))

unloadhook(h)

source code 

Converts an unload hook into an application processor.

>>> app = auto_application()
>>> def f(): "something done after handling request"
...
>>> app.add_processor(unloadhook(f))