~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/apps/__init__.py

  • Committer: mattgiuca
  • Date: 2008-01-11 00:49:06 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:172
util: Added buildurl function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
# Loads IVLE applications.
23
23
# All sub-packages in this package are apps.
24
24
 
 
25
from mod_python import apache
 
26
 
25
27
def call_app(appname, req):
26
28
    """Calls an application with the given name. Passes req to the app's
27
29
    handler."""
28
30
    try:
29
31
        # level=-1 to make it look in the right directory
30
32
        app_module = __import__(appname, globals(), locals(), [], -1)
31
 
    except ImportError, msg:
 
33
        app_module.handle(req)
 
34
    except ImportError:
32
35
        # Any problems meant it's a server error, because conf/apps.py said
33
36
        # this app would be here.
34
 
        req.throw_error(req.HTTP_INTERNAL_SERVER_ERROR,
35
 
            "Could not load the %s application: %s" % (repr(appname), str(msg)))
36
 
    app_module.handle(req)
 
37
        raise apache.SERVER_RETURN, apache.HTTP_INTERNAL_SERVER_ERROR