Beispiel #1
0
    def post(self, url):
        self.tf.send({'profile.racelog.adds': 1}, lambda x: x)

        error = self.get_error()
        year = datetime.date.today().year

        user = yield self.get_current_user_async()
        profile = yield models.get_user_by_url(self.redis, url)

        if user.email != profile.email:
            self.redirect_msg('/', {'error': 'You do not have permission to do add a run for this user.'})
            return

        date = self.get_argument('date', '')
        date = dateutil.parser.parse(date, fuzzy=True)
        name = self.get_argument('name', '')
        distance = self.get_argument('distance', '')
        distance = float(distance)
        distance_units = self.get_argument('distance_units', '')
        time = self.get_argument('time', '')
        pacetime = self.get_argument('pacetime', 'time')
        notes = self.get_argument('notes', '')

        try:
            time = models.time_to_seconds(time) if time != '' else 0
        except ValueError, e:
            msg = "The value you entered for time was not valid. Please enter your time in format HH:MM:SS or MM:SS or MM."
            self.redirect_msg('/u/%s' % user.url, {'error': msg})
            return
Beispiel #2
0
 def post(self):
     date = self.get_argument('date', '')
     date = dateutil.parser.parse(date, fuzzy=True)
     distance = self.get_argument('distance', '')
     time = self.get_argument('time', '0')
     try:
         time = models.time_to_seconds(time)
     except ValueError, e:
         msg = "The value you entered for time was not valid. Please enter your time in format HH:MM:SS or MM:SS or MM."
         self.redirect_msg('/u/%s' % user.url, {'error': msg})
         return
Beispiel #3
0
    def post(self):
        date = self.get_argument('date', '')
        date = dateutil.parser.parse(date, fuzzy=True)
        distance = self.get_argument('distance', '')
        distance = float(distance)
        time = self.get_argument('time', '')
        pacetime = self.get_argument('pacetime', 'time')
        notes = self.get_argument('notes', '')
        user = yield self.get_current_user_async()

        try:
            time = models.time_to_seconds(time) if time != '' else 0
            if pacetime == 'pace':
                time = int(time*distance)
        except ValueError, e:
            msg = "The value you entered for time was not valid. Please enter your time in format HH:MM:SS or MM:SS or MM."
            self.redirect_msg('/u/%s' % user.url, {'error': msg})
            return