Permalink
Browse files

PEP8 formatting of user example

  • Loading branch information...
1 parent b8ccebb commit d6320f5e277f62369e5b005e2d57e6cb03aba7e2 @pneff committed Nov 21, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 examples/user.py
View
@@ -9,7 +9,8 @@
import sys
import logging
import paste.urlmap
-from wsgiservice import *
+from wsgiservice import Resource, mount, validate, expires, raise_201, get_app
+
def get_hashed(password):
SALT = 'some_pwd_salt'
@@ -19,11 +20,12 @@ def get_hashed(password):
users = {}
+
@mount('/{id}')
@validate('id', re=r'[-0-9a-zA-Z]{36}', doc='User ID, must be a valid UUID.')
class User(Resource):
NOT_FOUND = (KeyError,)
-
+
@expires(timedelta(days=1))
def GET(self, id):
"Return the document indicated by the ID."
@@ -56,6 +58,7 @@ def to_text_xml(self, retval):
else:
return Resource.to_text_xml(self, retval)
+
@mount('/')
class Users(Resource):
@validate('email', doc="User's email. This is the unique identifier of a user.")
@@ -68,6 +71,7 @@ def POST(self, email, password):
self.response.body_raw = res.PUT(id, email, password)
raise_201(self, id)
+
@mount('/auth/{email}')
@validate('email', doc="User's email. This is the unique identifier of a user.")
@validate('password', doc="User's password.")

0 comments on commit d6320f5

Please sign in to comment.