def get(self): v = {} term = self.request.get("term") v['term'] = term text_query = full_text_query(term) posts = [] for i in text_query: rec = db.get(i.doc_id) if rec == None: continue rec.snip = "" for e in i.expressions: regex = "<b>(%s)<\/b>" % (term) try: this_term = re.search(regex, e.value, flags=re.IGNORECASE).group(1) except: this_term = term highlighted = '<span class="highlight">%s</span>' % (this_term) this_snip = e.value.replace("<br", "") this_snip = utility.strip_tags(this_snip) rec.snip += re.sub(term, highlighted, this_snip, count=10, flags=re.IGNORECASE) posts.append(rec) v = {"results":posts} v['title'] = "Search Results" if len(posts) >= 1: v['count'] = 1 else: v['count'] = 0 v['offset'] = 0 v['Tag'] = Tag v = pictures.random_pic_update(v) render.page(self, "/templates/main/landing.html", v)
def get(self, slug): this_article = models.Article.all().filter("slug =", slug).get() if this_article <> None: render.page( self, "/templates/main/article.html", {"article": this_article, "title": this_article.title, "Tag": models.Tag}, ) else: render.not_found(self)
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)
def get(self, post_code): v = simple_validate({'post_code': post_code}) if v['valid']: v['sf'] = SupplyForm() v['supplies'] = Supply.all().order('name') html = render.page(self, "templates/postadmin/supply_form.html", v) self.response.out.write(html)
def get(self, post_code): v = simple_validate({"post_code": post_code}) if v["valid"]: v["sf"] = SupplyForm() v["supplies"] = Supply.all().order("name") html = render.page(self, "templates/postadmin/supply_form.html", v) self.response.out.write(html)
def post(self, post_code): v = simple_validate({"post_code": post_code}) if v["valid"]: f = VolunteerForm(self.request.POST) if f.validate(): new_v = Volunteer( first_name=f.first_name.data, last_name=f.last_name.data, phone=f.phone.data, email=f.email.data, project=f.project.data, sitelocation=f.sitelocation.data, notes=f.notes.data, cos=f.cos.data, trainee_input="", ) new_v.put() new_kit = MedKit( date_issued=datetime.now(), in_use=True, delivery_events=[], volunteer=new_v, post_default=v["post_default"], ) new_kit.put() v["Volunteer"] = new_v v["MedKit"] = new_kit html = render.page(self, "templates/postadmin/confirmation.html", v) self.response.out.write(html) else: self.response.out.write("invalid entry for one of the form items") else: render.not_found(self)
def post(self, post_code): v = simple_validate({'post_code': post_code}) if v['valid']: f = VolunteerForm(self.request.POST) if f.validate(): new_v = Volunteer( first_name=f.first_name.data, last_name=f.last_name.data, phone=f.phone.data, email=f.email.data, project=f.project.data, sitelocation=f.sitelocation.data, notes=f.notes.data, cos=f.cos.data, trainee_input="", ) new_v.put() new_kit = MedKit( date_issued=datetime.now(), in_use=True, delivery_events=[], volunteer=new_v, post_default=v["post_default"], ) new_kit.put() v['Volunteer'] = new_v v['MedKit'] = new_kit html = render.page(self, "templates/postadmin/confirmation.html", v) self.response.out.write(html) else: self.response.out.write( "invalid entry for one of the form items") else: render.not_found(self)
def get(self, post_code): v = simple_validate({"post_code": post_code}) if v["valid"]: all_requests = SupplyRequest.all().filter("post_default =", v["post_default"]).order("-date") v["DeliveryEvent"] = DeliveryEvent v["requests"] = utilities.sr_improver(all_requests) html = render.page(self, "templates/postadmin/requests_table.html", v) self.response.out.write(html) else: self.response.out.write("Post not found")
def get(self, post_code): v = simple_validate({'post_code': post_code}) if v['valid']: all_requests = SupplyRequest.all().filter( "post_default =", v["post_default"]).order("-date") v['DeliveryEvent'] = DeliveryEvent v['requests'] = utilities.sr_improver(all_requests) html = render.page(self, "templates/postadmin/requests_table.html", v) self.response.out.write(html) else: self.response.out.write("Post not found")
def get(self, post_code): v = simple_validate({"post_code": post_code}) if v["valid"]: sr = db.get(self.request.get("k")) v["supply_request"] = utilities.sr_improver([sr])[0] v["status_choices"] = list(SupplyRequest.status.choices) v["def"] = DeliveryEventForm() v["delivery_events"] = DeliveryEvent.all() html = render.page(self, "templates/forms/update_supply_request.html", v) self.response.out.write(html) else: self.response.out.write("Post not found")
def get(self): v = {} v['region_codes'] = { 'Africa': "AFR", 'Europe, Mediterranean, and Asia Region': "EMA", 'Inter-America and Pacific Region': "IAP", "Other": "Other", } v['regions'] = sorted([r for r in v['region_codes']]) v['PostDefault'] = PostDefault html = render.page(self, "templates/superadmin/landing.html", v) self.response.out.write(html)
def get(self): v = {} v['region_codes'] = { 'Africa': "AFR", 'Europe, Mediterranean, and Asia Region': "EMA", 'Inter-America and Pacific Region': "IAP", "Other": "Other", } v['regions'] = sorted([r for r in v['region_codes']]) v['PostDefault'] = PostDefault html = render.page(self, "templates/superadmin/landing.html",v) self.response.out.write(html)
def get(self, post_code, kit_id): v = {} v['post_code'] = post_code v['kit_id'] = kit_id v['mk'] = self.request.get('k') v = simple_validate(v) if v['valid']: v['Supply'] = Supply v['srf'] = SupplyRequestForm() html = render.page(self, "templates/forms/supply_request.html", v) self.response.out.write(html) else: render.not_found(self)
def get(self, post_code, kit_id): v = {} v['post_code'] = post_code v['kit_id'] = kit_id v['mk'] = self.request.get('k') v = simple_validate(v) if v['valid']: request_query = SupplyRequest.all().filter('medkit =', v["MedKit"]).order("-date") v['requests'] = utilities.sr_improver(request_query) html = render.page(self, "templates/volunteer/status_table.html", v) self.response.out.write(html) else: render.not_found(self)
def get(self, post_code): v = simple_validate({'post_code': post_code}) if v['valid']: sr = db.get(self.request.get("k")) v["supply_request"] = utilities.sr_improver([sr])[0] v['status_choices'] = list(SupplyRequest.status.choices) v["def"] = DeliveryEventForm() v["delivery_events"] = DeliveryEvent.all() html = render.page(self, "templates/forms/update_supply_request.html", v) self.response.out.write(html) else: self.response.out.write("Post not found")
def get(self, qtype="blog", tagslug = None): v = {} v = pictures.random_pic_update(v) if qtype == 'blog': v['title'] = 'Home' q = models.Article.all().order('-pub_date') q = q.filter('collection =', 'blog') elif qtype.lower() == 'tag' and tagslug != None: v['title'] = 'tag search' tag = models.Tag.get_by_key_name(tagslug) if tag == None: tagkey = None v['tag'] = tagslug else: tagkey = tag.key() v['tag'] = tag.name q = models.Article.all().filter('tags =', tagkey) v['Tag'] = models.Tag if self.request.get('o') != "": offset = int(self.request.get('o')) else: offset = 0 v['results'] = q.fetch(10, offset=offset) v['count'] = q.count(offset=offset, limit=10) v['offset'] = offset + 10 if offset == 0: render.page(self, '/templates/main/landing.html', v) else: render.page(self, '/templates/main/article_links.html', v)
def get(self, post_code, kit_id): v = {} v['post_code'] = post_code v['kit_id'] = kit_id v['mk'] = self.request.get('k') v = simple_validate(v) if v['valid']: request_query = SupplyRequest.all().filter( 'medkit =', v["MedKit"]).order("-date") v['requests'] = utilities.sr_improver(request_query) html = render.page(self, "templates/volunteer/status_table.html", v) self.response.out.write(html) else: render.not_found(self)
def get(self, post_code): v = simple_validate({"post_code": post_code}) if v["valid"]: v["vf"] = VolunteerForm() html = render.page(self, "templates/forms/assign_medkit.html", v) self.response.out.write(html)
def get(self, form_name=""): v = {} k = self.request.get('k') v['post_default'] = db.get(k) html = render.page(self, "templates/forms/post_default.html",v) self.response.out.write(html)
def get(self, post_code=""): v = {"PostDefault": PostDefault} html = render.page(self, "templates/postadmin/landing.html", v) self.response.out.write(html)
def get(self, form_name=""): v = {} k = self.request.get('k') v['post_default'] = db.get(k) html = render.page(self, "templates/forms/post_default.html", v) self.response.out.write(html)
def get(self): v = {'PostDefault': PostDefault} html = render.page(self, "templates/landing.html",v) self.response.out.write(html)
def get(self, post_code=""): v = {'PostDefault': PostDefault} html = render.page(self, "templates/postadmin/landing.html", v) self.response.out.write(html)
def get(self, post_code): v = simple_validate({'post_code': post_code}) if v['valid']: v['vf'] = VolunteerForm() html = render.page(self, "templates/forms/assign_medkit.html", v) self.response.out.write(html)