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

« back to all changes in this revision

Viewing changes to src/dispatch/__init__.py

  • Committer: mattgiuca
  • Date: 2007-12-14 03:30:16 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:55
dispatch: request - added some new functions for exiting with an error or
    redirect.
    Made use of these wherever possible.
apps/server: Abstracted out some code.
Added common/studpath.py: For translating URLs into student machine paths.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
    req = Request(req, html.write_html_head)
51
51
 
52
52
    # Check req.app to see if it is valid. 404 if not.
53
 
    if req.app != None and req.app not in conf.apps.app_url:
 
53
    if req.app is not None and req.app not in conf.apps.app_url:
54
54
        # TODO: Nicer 404 message?
55
 
        return apache.HTTP_NOT_FOUND
 
55
        req.throw_error(Request.HTTP_NOT_FOUND)
56
56
 
57
57
    # app is the App object for the chosen app
58
 
    if req.app == None:
 
58
    if req.app is None:
59
59
        app = conf.apps.app_url[conf.default_app]
60
60
    else:
61
61
        app = conf.apps.app_url[req.app]
66
66
        pass
67
67
 
68
68
    # If user did not specify an app, HTTP redirect to default app and exit.
69
 
    if req.app == None:
70
 
        mod_python.util.redirect(apachereq, util.make_path(conf.default_app))
 
69
    if req.app is None:
 
70
        req.throw_redirect(util.make_path(conf.default_app))
71
71
 
72
72
    # Set the default title to the app's tab name, if any. Otherwise URL name.
73
 
    if app.name != None:
 
73
    if app.name is not None:
74
74
        req.title = app.name
75
75
    else:
76
76
        req.title = req.app