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)
def POST(self): ''' Add a new contact ''' if not globals.has_loggedin(): raise web.seeother("/contact/", True) f = contact.contact_form() if not f.validates(): raise web.seeother('/contact/', True) data = contact_data(f['Contact_Id'].value, f['Name'].value, f['Telephone1'].value, f['Telephone2'].value, f['Location'].value, f['Industry'].value) # if this contact has been in db, del/new as update it #if model.get_contact(data.id) is not None: # model.del_contact(data.id) model.new_contact(data) web.seeother("/contact/", True)
def GET(self): # check auth status if globals.has_loggedin(): raise web.seeother("/contact/",True) f = login.login_form() return render.login(f)
def POST(self, id): if globals.has_loggedin(): model.del_contact(id) raise web.seeother('/contact/', True)