示例#1
0
def simple_validate(v):
    q = PostDefault.all().filter("slug =", v.get('post_code', "").lower())
    if q.count() > 0 and v.get('post_code', "") != "":
        v['post_default'] = q.get()
        v['valid'] = True
    else:
        v['valid'] = False
    return v
示例#2
0
def simple_validate(v):
    q = PostDefault.all().filter("slug =", v.get("post_code", "").lower())
    if q.count() > 0 and v.get("post_code", "") != "":
        v["post_default"] = q.get()
        v["valid"] = True
    else:
        v["valid"] = False
    return v
示例#3
0
 def get(self, post_code=""):
     v = {'PostDefault': PostDefault}
     v['wrong_code'] = bool(self.request.get("wc"))
     if post_code == "":
         html = render.page(self, "templates/volunteer/landing.html", v)
         self.response.out.write(html)
     else:
         v['post_code'] = post_code.lower().replace("/", "")
         q = PostDefault.all().filter('slug =', v["post_code"])
         if q.count() > 0:
             html = render.page(self, "templates/volunteer/landing.html", v)
             self.response.out.write(html)
         else:
             render.not_found(self)
示例#4
0
 def get(self, post_code=""):
     v = {'PostDefault': PostDefault}
     v['wrong_code'] = bool(self.request.get("wc"))
     if post_code == "":
         html = render.page(self, "templates/volunteer/landing.html", v)
         self.response.out.write(html)
     else:
         v['post_code'] = post_code.lower().replace("/", "")
         q = PostDefault.all().filter('slug =', v["post_code"])
         if q.count() > 0:
             html = render.page(self, "templates/volunteer/landing.html", v)
             self.response.out.write(html)
         else:
             render.not_found(self)