Пример #1
0
    def post(self):
        self.check_xsrf_cookie()
        f = api_request_form()
        data = self.get_arguments()

        try:
            if f.validates(Storage(data)):
                consumer = Consumer()
                consumer['_id'] = data['email']
                consumer['about'] = data['about']
                consumer['fullname'] = data['fullname']
                consumer['website'] = data['website']
                consumer['key'], consumer['secret'] = \
                    Consumer.generate_random_code()

                if consumer.validate():
                    consumer.save()
                    self.redirect('/')
            raise Exception("Form still have errors.")
        except Exception, e:
            f.note = f.note if f.note else e
            self.render('api-request.html', f=f)
Пример #2
0
 def post(self):
     self.check_xsrf_cookie()
     f = api_request_form()
     data = self.get_arguments()
     
     try:
         if f.validates(Storage(data)):
             consumer = Consumer()
             consumer['_id'] = data['email']
             consumer['about'] = data['about']
             consumer['fullname'] = data['fullname']
             consumer['website'] = data['website']
             consumer['key'], consumer['secret'] = \
                 Consumer.generate_random_code()
             
             if consumer.validate():
                 consumer.save()
                 self.redirect('/')
         raise Exception("Form still have errors.")
     except Exception, e:
         f.note = f.note if f.note else e 
         self.render('api-request.html', f=f)
Пример #3
0
 def get(self, action=None):
     f = api_request_form()
     self.render('api-request.html', f=f)
Пример #4
0
 def get(self, action=None):
     f = api_request_form()
     self.render('api-request.html', f=f)