def GET(self, id): if globals.has_loggedin(): web.header('Contect-Type', 'text/x-vcard;charset=utf-8') web.header("Content-Disposition", 'attachment') if id=='all': all_data = model.get_all_contact() vcfs = '' for d in all_data: vcfs = vcfs + d.toVcard() if vcfs is not None and vcfs!= '': return vcfs elif re.match('^(\d+)$', id) is not None: id_raw = re.findall('\d+', id) if id_raw is not None and len(id_raw) > 0: id_raw = id_raw[0] data = model.get_contact(id_raw) if data is not None and data != '': return data.toVcard() else: print("id error, id=" + id); raise web.seeother('/contact/', True) else: raise web.seeother('/', True)
def GET(self, id): if globals.has_loggedin(): web.header('Contect-Type', 'text/x-vcard;charset=utf-8') web.header("Content-Disposition", 'attachment') if id == 'all': all_data = model.get_all_contact() vcfs = '' for d in all_data: vcfs = vcfs + d.toVcard() if vcfs is not None and vcfs != '': return vcfs elif re.match('^(\d+)$', id) is not None: id_raw = re.findall('\d+', id) if id_raw is not None and len(id_raw) > 0: id_raw = id_raw[0] data = model.get_contact(id_raw) if data is not None and data != '': return data.toVcard() else: print("id error, id=" + id) raise web.seeother('/contact/', True) else: raise web.seeother('/', True)
def GET(self): f = contact.contact_form() if globals.has_loggedin(): # render contact data data = model.get_all_contact() return render.contact(f, data) else: raise web.seeother("/",True)
def GET(self): f = contact.contact_form() if globals.has_loggedin(): # render contact data data = model.get_all_contact() return render.contact(f, data) else: raise web.seeother("/", True)