Example #1
0
    def user_login(self):
        result = {}
        user = users.get_current_user()
        is_profile = False
        if user is None:
            session = get_current_session()
            twitter_user = session.get("twitter_user")
            if twitter_user is not None:
                user = TwitterProfile.get_by_key_name(twitter_user)
                is_profile = True

        message = utils.days_left_message()
        result['daysleft0'] = message[0]
        result['daysleft1'] = message[1]
        result['daysleft2'] = message[2]
        result['propose_ended'] = datetime.datetime(2012, 8, 25) < NOW
        result['register_ended'] = datetime.datetime(2012, 9, 14) < NOW
        result['tshirt_req_ended'] = datetime.datetime(2012, 8, 27) < NOW
        if user:  # signed in already
            result['user'] = user
            if is_profile:
                result['logout'] = '/oauth/signout'
            else:
                result['logout'] = users.create_logout_url(self.request.uri)
            result['username'] = user.nickname()
            result['is_attendee'] = db.user_is_attendee(
                result.get('user', None))
        else:  # let user choose authenticator
            result['user'] = None
            result['login'] = '******'

        return result
Example #2
0
    def user_login(self):
        result = {}
        user = users.get_current_user()
        is_profile = False
        if user is None:
            session = get_current_session()
            twitter_user = session.get("twitter_user")
            if twitter_user is not None:
                user = TwitterProfile.get_by_key_name(twitter_user)
                is_profile = True

        message = utils.days_left_message()
        result['daysleft0'] = message[0]
        result['daysleft1'] = message[1]
        result['daysleft2'] = message[2]
        result['propose_ended'] = datetime.datetime(2012, 8, 25) < NOW
        result['register_ended'] = datetime.datetime(2012, 9, 14) < NOW
        result['tshirt_req_ended'] = datetime.datetime(2012, 8, 27) < NOW
        if user:  # signed in already
            result['user'] = user
            if is_profile:
                result['logout'] = '/oauth/signout'
            else:
                result['logout'] = users.create_logout_url(self.request.uri)
            result['username'] = user.nickname()
            result['is_attendee'] = db.user_is_attendee(
                result.get('user', None))
        else:  # let user choose authenticator
            result['user'] = None
            result['login'] = '******'

        return result
Example #3
0
 def get(self):
     result = self.user_login()
     if result['tshirt_req_ended']:
         path = os.path.join(os.path.dirname(__file__),
                             "templates/error_base.html")
         result['title'] = 'Error'
         result['message'] = 'Ya no se reciben solicitudes de remeras.'
         self.response.out.write(template.render(path, result))
     else:
         registered = db.user_is_attendee(result.get('user', None))
         if not registered:
             self.redirect('/register')
             return
         if result.get('user', None):
             form = forms.TshirtForm()
             result['form'] = form
             path = os.path.join(os.path.dirname(__file__),
                 "templates/user/tshirt.html")
             self.response.out.write(template.render(path, result))
         else:
             self.redirect(result['login'])
Example #4
0
 def get(self):
     result = self.user_login()
     if result['propose_ended']:
         path = os.path.join(os.path.dirname(__file__),
                             "templates/error_base.html")
         result['title'] = 'Error'
         result['message'] = 'Ya no se reciben propuestas de charlas.'
         self.response.out.write(template.render(path, result))
     else:
         registered = db.user_is_attendee(result.get('user', None))
         if not registered:
             self.redirect('/register')
             return
         if result.get('user', None):
             form = forms.TalkForm()
             result['form'] = form
             path = os.path.join(os.path.dirname(__file__),
                 "templates/others/propose.html")
             self.response.out.write(template.render(path, result))
         else:
             self.redirect(result['login'])
Example #5
0
 def get(self):
     result = self.user_login()
     if result['tshirt_req_ended']:
         path = os.path.join(os.path.dirname(__file__),
                             "templates/error_base.html")
         result['title'] = 'Error'
         result['message'] = 'Ya no se reciben solicitudes de remeras.'
         self.response.out.write(template.render(path, result))
     else:
         registered = db.user_is_attendee(result.get('user', None))
         if not registered:
             self.redirect('/register')
             return
         if result.get('user', None):
             form = forms.TshirtForm()
             result['form'] = form
             path = os.path.join(os.path.dirname(__file__),
                                 "templates/user/tshirt.html")
             self.response.out.write(template.render(path, result))
         else:
             self.redirect(result['login'])
Example #6
0
 def get(self):
     result = self.user_login()
     if result['propose_ended']:
         path = os.path.join(os.path.dirname(__file__),
                             "templates/error_base.html")
         result['title'] = 'Error'
         result['message'] = 'Ya no se reciben propuestas de charlas.'
         self.response.out.write(template.render(path, result))
     else:
         registered = db.user_is_attendee(result.get('user', None))
         if not registered:
             self.redirect('/register')
             return
         if result.get('user', None):
             form = forms.TalkForm()
             result['form'] = form
             path = os.path.join(os.path.dirname(__file__),
                                 "templates/others/propose.html")
             self.response.out.write(template.render(path, result))
         else:
             self.redirect(result['login'])