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

« back to all changes in this revision

Viewing changes to www/dispatch/html.py

  • Committer: mattgiuca
  • Date: 2008-02-19 00:54:28 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:500
db: get_user and get_users now return User objects instead of dictionaries.
    This is the major part of replacing dicts with User objects, as it
    propagates upwards.

Propagated User objects up through the following modules:
    listusers.py, dispatch.login, authenticate, userservice, forumutil
All of these now treat users as an object rather than a dict.

To save on the size of the changes so far, login still individually copies
fields over to the session (so the session does not yet store a user object;
that is the second part of this refactor).

WOO!! Revision 500 :)

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
            "app from conf.apps.app_url when placed into production."
111
111
            "</small></p>\n")
112
112
 
113
 
    if req.username:
 
113
    # If req has a "no_agreement" attribute, then it is because the user has
 
114
    # not signed the agreement; therefore we are displaying the TOS page.
 
115
    # Do not show apps (see dispatch.login).
 
116
    if req.username and not hasattr(req, 'no_agreement'):
114
117
        # Only print app tabs if logged in
115
118
        print_apps_list(req, req.app)
116
119
    req.write('</div>\n<div id="ivlebody">\n')
125
128
def get_help_url(req):
126
129
    """Gets the help URL most relevant to this page, to place as the
127
130
    "help" link at the top of the page."""
128
 
    if req.app == 'help':
 
131
    reqapp = req.app if hasattr(req, 'app') else None
 
132
    if reqapp == 'help':
129
133
        # We're already in help. Link to the exact current page
130
134
        # instead of the generic help page.
131
135
        return req.uri
132
 
    if conf.apps.app_url[req.app].hashelp:
133
 
        help_path = os.path.join('help', req.app)
 
136
    if reqapp is not None and conf.apps.app_url[reqapp].hashelp:
 
137
        help_path = os.path.join('help', reqapp)
134
138
    else:
135
139
        help_path = 'help'
136
140
    return util.make_path(help_path)