Exemplo n.º 1
0
    def post(self):
        # gather registration info #
        username = cgi.escape(self.request.get('username'))
        password = cgi.escape(self.request.get('password'))
        avatar = self.request.get('avatar')
        tagline = cgi.escape(self.request.get('tagline'))

        # Run Validation #
        validate = Validation('register', username=username,
                              password=password, avatar=avatar,
                              tagline=tagline)
        validate.run_validation()
        if self.check_user(username):
            # check if username is duplicate #
            self.redirect('/register.html')
        elif validate.error_return():
            # set error flag if any #
            Register.error = validate.error_return()
            self.redirect('/register.html')
        elif not Register.error:
            # set user as active #
            SetUser(user=username, avatar=avatar, tagline=tagline)
            # add user info to database. #
            new_user = Users(user=username,
                             password=password,
                             link=avatar,
                             tagline=tagline)
            new_user.put()
            time.sleep(set_time)
            self.redirect('/forum.html')
Exemplo n.º 2
0
    def post(self):
        # gather registration info #
        username = cgi.escape(self.request.get('username'))
        password = cgi.escape(self.request.get('password'))
        avatar = self.request.get('avatar')
        tagline = cgi.escape(self.request.get('tagline'))

        # Run Validation #
        validate = Validation('register',
                              username=username,
                              password=password,
                              avatar=avatar,
                              tagline=tagline)
        validate.run_validation()
        if self.check_user(username):
            # check if username is duplicate #
            self.redirect('/register.html')
        elif validate.error_return():
            # set error flag if any #
            Register.error = validate.error_return()
            self.redirect('/register.html')
        elif not Register.error:
            # set user as active #
            SetUser(user=username, avatar=avatar, tagline=tagline)
            # add user info to database. #
            new_user = Users(user=username,
                             password=password,
                             link=avatar,
                             tagline=tagline)
            new_user.put()
            time.sleep(set_time)
            self.redirect('/forum.html')
Exemplo n.º 3
0
    def post(self):
        word = cgi.escape(self.request.get('word'))
        definition = cgi.escape(self.request.get('definition'))
        # validate information #
        validate = Validation('', word=word, definition=definition)
        validate.run_validation()

        if not validate.error_return():
            # looks good now add to DB #
            define = Definitions(word=word, definition=definition)
            define.put()
            time.sleep(set_time)
            Base.login = True
            self.redirect('/definitions.html')
        else:
            # set error flag #
            Definition.error = validate.error_return()
            self.redirect('definitions.html')
Exemplo n.º 4
0
    def post(self):
        word = cgi.escape(self.request.get('word'))
        definition = cgi.escape(self.request.get('definition'))
        # validate information #
        validate = Validation('', word=word, definition=definition)
        validate.run_validation()

        if not validate.error_return():
            # looks good now add to DB #
            define = Definitions(word=word, definition=definition)
            define.put()
            time.sleep(set_time)
            Base.login = True
            self.redirect('/definitions.html')
        else:
            # set error flag #
            Definition.error = validate.error_return()
            self.redirect('definitions.html')