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

« back to all changes in this revision

Viewing changes to www/apps/userservice/__init__.py

  • Committer: mattgiuca
  • Date: 2008-02-22 00:47:07 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:538
userservice: Throws METHOD_NOT_ALLOWED on bad method errors instead of BAD
    REQUEST.

Show diffs side-by-side

added added

removed removed

Lines of Context:
135
135
    db = common.db.DB()
136
136
    try:
137
137
        if req.method != "POST":
138
 
            req.throw_error(req.HTTP_BAD_REQUEST)
 
138
            req.throw_error(req.HTTP_METHOD_NOT_ALLOWED)
139
139
        try:
140
140
            declaration = fields.getfirst('declaration')
141
141
        except AttributeError:
194
194
    allows the user to accept an agreement.
195
195
    """
196
196
    if req.method != "POST":
197
 
        req.throw_error(req.HTTP_BAD_REQUEST)
 
197
        req.throw_error(req.HTTP_METHOD_NOT_ALLOWED)
198
198
    # Check if this user has CAP_UPDATEUSER
199
199
    if not req.user.hasCap(caps.CAP_UPDATEUSER):
200
200
        req.throw_error(req.HTTP_FORBIDDEN)
240
240
    or with full powers by a user with CAP_UPDATEUSER on any account.
241
241
    """
242
242
    if req.method != "POST":
243
 
        req.throw_error(req.HTTP_BAD_REQUEST)
 
243
        req.throw_error(req.HTTP_METHOD_NOT_ALLOWED)
244
244
 
245
245
    # Only give full powers if this user has CAP_UPDATEUSER
246
246
    fullpowers = req.user.hasCap(caps.CAP_UPDATEUSER)