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

« back to all changes in this revision

Viewing changes to ivle/webapp/userservice/__init__.py

  • Committer: William Grant
  • Date: 2009-07-05 00:00:57 UTC
  • mto: (1294.4.2 ui-the-third)
  • mto: This revision was merged to the branch mainline in revision 1353.
  • Revision ID: grantw@unimelb.edu.au-20090705000057-s9p9rmlvcyomp5he
Port userservice.

Show diffs side-by-side

added added

removed removed

Lines of Context:
151
151
from ivle.webapp.base.views import BaseView
152
152
from ivle.webapp.base.plugins import ViewPlugin
153
153
from ivle.webapp.errors import NotFound, BadRequest, Unauthorized
 
154
from ivle.webapp import ApplicationRoot
154
155
 
155
156
# The user must send this declaration message to ensure they acknowledge the
156
157
# TOS
165
166
)
166
167
 
167
168
class UserServiceView(BaseView):
168
 
    def __init__(self, req, path):
169
 
        if len(path) > 0 and path[-1] == os.sep:
170
 
            self.path = path[:-1]
171
 
        else:
172
 
            self.path = path
 
169
    subpath_allowed = True
173
170
 
174
171
    def authorize(self, req):
175
172
        # XXX: activate_me isn't called by a valid user, so is special for now.
186
183
            raise NotFound()
187
184
        func(req, fields)
188
185
 
 
186
    @property
 
187
    def path(self):
 
188
        return os.path.join(*self.subpath) if self.subpath else ''
 
189
 
 
190
 
189
191
class Plugin(ViewPlugin):
190
 
    urls = [
191
 
        ('userservice/*path', UserServiceView)
192
 
    ]
 
192
    views = [(ApplicationRoot, 'userservice', UserServiceView)]
193
193
 
194
194
@require_method('POST')
195
195
def handle_activate_me(req, fields):