~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-24 22:09:16 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:553
Added new app: Settings (UI for userservice).
    (Added app dir, media dir with empty JS file, icon).
apps/__init__.py: Added error message.
dispatch/__init__.py: Added error message.
dispatch/html.py: Added link to Settings at the top
    (a special app).
    Fixed HTML icons (correct size link).
    Catch keyerror on icon which would otherwise be thrown all
    the way up on certain errors.

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
    username = %s;
62
62
  </script>
63
63
""" % (repr(conf.root_dir), username))
64
 
    iconurl = get_icon_url(req.app)
 
64
    iconurl = get_icon_url(req.app, small=True)
65
65
    if iconurl:
66
66
        req.write("""  <link rel="shortcut icon" href="%s" />
67
67
""" % cgi.escape(iconurl))
91
91
        nickname = req.user.nick
92
92
        req.write('  <p class="userhello">%s (<span '
93
93
            'class="username">%s</span>) |\n'
 
94
            '    <a href="%s">Settings</a> |\n'
94
95
            '    <a href="%s">Help</a> |\n'
95
 
            '    <a href="%s">Logout</a>\n'
 
96
            '    <a href="%s">Sign out</a>\n'
96
97
            '  </p>\n' %
97
98
            (cgi.escape(nickname), cgi.escape(req.user.login),
 
99
             cgi.escape(util.make_path('settings')),
98
100
             cgi.escape(get_help_url(req)),
99
101
             cgi.escape(util.make_path('logout'))))
100
102
    else:
143
145
    """Given an app's url name, gets the URL of the icon image for this app,
144
146
    relative to the site root. Returns None if the app has no icon."""
145
147
    if appurl is None: return None
146
 
    app = conf.apps.app_url[appurl]
 
148
    try:
 
149
        app = conf.apps.app_url[appurl]
 
150
    except KeyError:
 
151
        # Due to navigating to a bad app
 
152
        return None
147
153
    if small:
148
154
        icon_dir = conf.apps.app_icon_dir_small
149
155
    else: