Example #1
0
    def post(self):
        # print  "RRREEEEQQUESTT",self.request
        new_form_content = cgi.escape(self.request.get("form_content"))
        new_form_name = cgi.escape(self.request.get("new_form_name"))
        # print "NEW FORM NAME =", new_form_name
        # print "GETTING CALLED"

        # print """ <h1> Error </h1>"""+self.edit()
        ##print "TEST"
        # print "PASSED TEST"
        if get_form(new_form_name):
            new_form = get_form(new_form_name)
        else:
            new_form = Form()
        if users.get_current_user():
            new_form.author = users.get_current_user()
        new_form.content = new_form_content
        new_form.title = new_form_name
        new_form.put()
        all_forms = Form.all()
        # print all_forms, "datatbase"
        # print list(all_forms)
        for i in all_forms:
            pass
            # print i.author, i.content, i.date, i.title
        if YamlValidator().failure(new_form_name):
            self.response.out.write(YamlValidator().failure(new_form_name))
        else:
            self.redirect("/")
Example #2
0
 def get(self):
     for i in Form.all():
         print i.date, "deleted"
         i.delete()
     for i in Settings.all():
         print i.date, "deleted"
         i.delete()
Example #3
0
 def get(self):
     user = users.get_current_user()
     if user:
         # self.response.headers['Content-Type'] = 'text/plain'
         template_path = localize("main_page_template.html")
         titles = [i.title for i in Form.all()]
         titles.sort()
         forms_titles = {"forms_titles": titles}
         text = template.render(template_path, forms_titles)
         self.response.out.write(web_publish(text))
         # self.response.out.write('Hello, ' + user.nickname())
     else:
         self.redirect(users.create_login_url(self.request.uri))