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
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
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)