Ejemplo n.º 1
0
	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)
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
0
	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)
Ejemplo n.º 4
0
 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)