Esempio n. 1
0
class UsersView(FlaskView):
    """
    Provides the RESTful interface for our user data.
    """
    def __init__(self):
        # Establish a connection on startup (fail fast if something is wrong)
        self.user_store = UserStore()

    def put(self, user_type, username, email):
        self.user_store.create_user(User(username, user_type, email, str(datetime.datetime.now())))
        return 'success'

    def get(self, username):
        user = self.user_store.get_user(username)
        return None if user == None else user.as_dict()
Esempio n. 2
0
 def __init__(self):
     # Establish a connection on startup (fail fast if something is wrong)
     self.user_store = UserStore()