def POST(self): f = web.input() q = ' '.join(f.query.split()) if q: pts = model.pt_name_search(q) if len(pts) == 0: return 'no patient found' elif len(pts) == 1: raise web.seeother('/patient/%d' % pts[0].id) else: return render.family(pts) else: return render.family(model.db.select('patient'))
def POST(self, patientid=''): f = forms.patient() if not f.validates(): return render.edit_patient(f) else: if f.resparty_text.get_value(): #TODO: this query is done twice now (here and during validation) # validation already established that this mapping is unique # so we do not need to check it here rp = model.pt_name_search(f.resparty_text.get_value()) resparty = rp[0].id else: rp = None resparty = None newid = model.update_pt(f, resparty) raise web.seeother('/patient/%d' % newid)
def _rp_is_unique_pt(i): if i: pts = model.pt_name_search(i) return len(pts) == 1 else: return True