def post(self): #username = self.get_secure_cookie("user") curpath = self.request.path user_id = self.get_argument('user_id') password = self.get_argument('password') realname = self.get_argument('realname') email = self.get_argument('email') mobile = self.get_argument('mobile') status = self.get_argument('status') if password: op_cursor.execute( update_user_sql.format(user_id=user_id, password=password, realname=realname, email=email, mobile=mobile, status=status)) else: op_cursor.execute( update_user_sql1.format(user_id=user_id, realname=realname, email=email, mobile=mobile, status=status)) self.redirect("/user/index")
def get(self, id): username = self.get_secure_cookie("user") curpath = self.request.path func = curpath[1:].split("/")[0] op_cursor.execute(globals()["_".join(curpath[1:].split("/")[:-1]) + '_sql'].format(id=id)) self.redirect("/{0}/index".format(func))
def getDatalist(self): datalist = [] op_cursor.execute(globals()[self.rpath + "_data_sql"]) parent_menus = op_cursor.fetchall() head = [c[0] for c in op_cursor.description] for menus in parent_menus: datalist.append(dict(zip(head,menus))) return datalist
def getDatalist(self): datalist = [] op_cursor.execute(globals()[self.rpath + "_data_sql"]) parent_menus = op_cursor.fetchall() head = [c[0] for c in op_cursor.description] for menus in parent_menus: datalist.append(dict(zip(head, menus))) return datalist
def menu_record_tree(self): datalist = [] op_cursor.execute("SELECT menu_id,menu_title FROM `admin_menu` WHERE `parent_id`=0") parent_menus = op_cursor.fetchall() head = [c[0] for c in op_cursor.description] for menus in parent_menus: datalist.append(dict(zip(head,menus))) return datalist
def menu_record_tree(self): datalist = [] op_cursor.execute( "SELECT menu_id,menu_title FROM `admin_menu` WHERE `parent_id`=0") parent_menus = op_cursor.fetchall() head = [c[0] for c in op_cursor.description] for menus in parent_menus: datalist.append(dict(zip(head, menus))) return datalist
def post(self): self.request.arguments op_cursor.execute(globals()[self.rpath + "_sql"].format( menu_title=menu_title, menu_url=menu_url, parent_id=parent_id, menu_level=menu_level, menu_icon=menu_icon)) self.redirect(self.page)
def post(self): #username = self.get_secure_cookie("user") curpath = self.request.path newUserName = self.get_argument('username') password = self.get_argument('password') realname = self.get_argument('realname') email = self.get_argument('email') mobile = self.get_argument('mobile') status = self.get_argument('status') op_cursor.execute(add_user_sql.format(username=newUserName,password=password,realname=realname,email=email,mobile=mobile,status=status)) self.redirect("/user/index")
def post(self): #username = self.get_secure_cookie("user") curpath = self.request.path user_id = self.get_argument('user_id') password = self.get_argument('password') realname = self.get_argument('realname') email = self.get_argument('email') mobile = self.get_argument('mobile') status = self.get_argument('status') if password: op_cursor.execute(update_user_sql.format(user_id=user_id,password=password,realname=realname,email=email,mobile=mobile,status=status)) else: op_cursor.execute(update_user_sql1.format(user_id=user_id,realname=realname,email=email,mobile=mobile,status=status)) self.redirect("/user/index")
def __init__(self,*request,**kwargs): super(TableHandler,self).__init__(request[0], request[1]) rpath = request[1].path[1:].replace("/",'_') rdslist = op_cursor.execute(globals()[ rpath + '_sql' ]) self.hide = globals().get( rpath + '_hide' ,[]) self.headers = [c[0] for c in op_cursor.description] self.rdsinfo = op_cursor.fetchall()
def __init__(self, *request, **kwargs): super(TableHandler, self).__init__(request[0], request[1]) rpath = request[1].path[1:].replace("/", '_') rdslist = op_cursor.execute(globals()[rpath + '_sql']) self.hide = globals().get(rpath + '_hide', []) self.headers = [c[0] for c in op_cursor.description] self.rdsinfo = op_cursor.fetchall()
def post(self): #username = self.get_secure_cookie("user") curpath = self.request.path newUserName = self.get_argument('username') password = self.get_argument('password') realname = self.get_argument('realname') email = self.get_argument('email') mobile = self.get_argument('mobile') status = self.get_argument('status') op_cursor.execute( add_user_sql.format(username=newUserName, password=password, realname=realname, email=email, mobile=mobile, status=status)) self.redirect("/user/index")
def get_user_list(self): user = op_cursor.execute(globals()[self.request.path[1:].replace("/",'_')+'_sql']) users = op_cursor.fetchall() head = [c[0] for c in op_cursor.description] datalist = [] for user in users: datalist.append(dict(zip(head,user))) return datalist
def get_user_list(self): user = op_cursor.execute( globals()[self.request.path[1:].replace("/", '_') + '_sql']) users = op_cursor.fetchall() head = [c[0] for c in op_cursor.description] datalist = [] for user in users: datalist.append(dict(zip(head, user))) return datalist
def post(self): username = self.get_secure_cookie("user") curpath = self.request.path menu_title = self.get_argument('menu_title').encode("utf8") menu_url = self.get_argument('menu_url') parent_id = int(self.get_argument('parent_id')) status = int(self.get_argument('status')) if parent_id == 0: menu_level = 1 menu_icon = "icon-dashboard" else: menu_level = 2 menu_icon = "icon-list" op_cursor.execute( add_menu_sql.format(menu_title=menu_title, menu_url=menu_url, parent_id=parent_id, menu_level=menu_level, menu_icon=menu_icon)) if parent_id != 0: op_cursor.execute(add_privilege_sql.format(menu_title=menu_title)) op_cursor.execute( add_provilege_to_role_sql.format(menu_title=menu_title)) models.tools.user_menus[username] = models.tools._get_menu( username) self.redirect("/menu/index")
def post(self): username = self.get_secure_cookie("user") curpath = self.request.path menu_title = self.get_argument('menu_title').encode("utf8") menu_url = self.get_argument('menu_url') parent_id = int(self.get_argument('parent_id')) status = int(self.get_argument('status')) if parent_id==0: menu_level = 1 menu_icon = "icon-dashboard" else: menu_level = 2 menu_icon = "icon-list" op_cursor.execute(add_menu_sql.format(menu_title=menu_title,menu_url=menu_url,parent_id=parent_id,menu_level=menu_level,menu_icon=menu_icon)) if parent_id!=0: op_cursor.execute(add_privilege_sql.format(menu_title=menu_title)) op_cursor.execute(add_provilege_to_role_sql.format(menu_title=menu_title)) models.tools.user_menus[username] = models.tools._get_menu(username) self.redirect("/menu/index")
def ping_db(): print 'ping db' op_cursor.execute('select 1')
def getrecord(sef,user_id): op_cursor.execute(user_info_sql.format(user_id=user_id)) head = [c[0] for c in op_cursor.description] userinfo = op_cursor.fetchone() record = dict(zip(head,userinfo)) return record
def get(self,id): username = self.get_secure_cookie("user") curpath = self.request.path func = curpath[1:].split("/")[0] op_cursor.execute(globals()[ "_".join(curpath[1:].split("/")[:-1]) + '_sql' ].format(id=id)) self.redirect("/{0}/index".format(func))
def post(self): self.request.arguments op_cursor.execute(globals()[self.rpath + "_sql"].format(menu_title=menu_title,menu_url=menu_url,parent_id=parent_id,menu_level=menu_level,menu_icon=menu_icon)) self.redirect(self.page)
def getrecord(sef, user_id): op_cursor.execute(user_info_sql.format(user_id=user_id)) head = [c[0] for c in op_cursor.description] userinfo = op_cursor.fetchone() record = dict(zip(head, userinfo)) return record