Example #1
0
    def post(self):
        user_month = validation.valid_month(self.request.get('month'))
        user_day = validation.valid_day(self.request.get('day'))
        user_year = validation.valid_year(self.request.get('year'))

        if not (user_month and user_day and user_year):
            self.response.write.out(form)
        else:
            self.response.out.write("Thanks! That's a totally valid day")
    def post(self):
        user_month = validation.valid_month(self.request.get('month'))
        user_day = validation.valid_day(self.request.get('day'))
        user_year = validation.valid_year(self.request.get('year'))

        if not (user_month and user_day and user_year):
            self.response.out.write(form)
        else:
            self.response.out.write("Valid")
Example #3
0
def read_day(s):
    x = input(s)
    while True:
        try:
            if not valid_day(x):
                raise ValueError("This day doesn't exist!")
            return int(x)
        except Exception as ex:
            print(ex)
            x = input(s)
Example #4
0
    def post(self):
        user_month = self.request.get('month')
        user_day = self.request.get('day')
        user_year = self.request.get('year')

        month = validation.valid_month(user_month)
        day = validation.valid_day(user_day)
        year = validation.valid_year(user_year)

        if not(month and day and year):
            self.write_form("That doesn't look valid to me, friend.", user_month, user_day, user_year)
        else:
            self.redirect("/thanks")
Example #5
0
    def post(self):
        user_month = self.request.get('month')
        user_day = self.request.get('day')
        user_year = self.request.get('year')
        month = val.valid_month(user_month)
        day = val.valid_day(user_day)
        year = val.valid_year(user_year)

        if not (month and day and year):
            self.write_form("That doesn't look valid to me, buddy", user_month,
                            user_day, user_year)
        else:
            self.response.out.write("Thanks, that's a totally valid day!")
Example #6
0
    def post(self):
        user_month = self.request.get("month")
        user_day = self.request.get("day")
        user_year = self.request.get("year")

        month = validation.valid_month(user_month.strip(' \t\n\r'))
        day = validation.valid_day(user_day.strip(' \t\n\r'))
        year = validation.valid_year(user_year.strip(' \t\n\r'))

        if not (month and day and year):
            self.write_form("That does not look valid for me, friend",
                user_month, user_day, user_year)
        else:
            self.redirect("/thanks")
Example #7
0
File: main.py Project: klrqn/cs253
                                         error_valid,
                                         error_email))
>>>>>>> f36d250974dd74d8098cbd4e07b7eed0d6b3517e:main.py

    def get(self):
        self.writeform()

    def post(self):
<<<<<<< HEAD:ch2/main.py
        user_month = self.request.get('month')
        user_day = self.request.get('day')
        user_year = self.request.get('year')

        # verify the user's input
        month = validation.valid_month(user_month)
        day = validation.valid_day(user_day)
        year = validation.valid_year(user_year)

        # on error, render form again
        if not (month and day and year):
            self.writeform("<p style=color:red;> That doesn't look valid to me friend.</p>", user_month, user_day, user_year)
        else:
            self.redirect("/thanks")

class ThanksHandler(webapp2.RequestHandler):
    def get(self):
        self.response.write("Thanks, that data is totally valid!")

app = webapp2.WSGIApplication([
    ('/', MainHandler),
    ('/thanks', ThanksHandler)