当前位置: 首页>>代码示例>>Python>>正文


Python UserDb类代码示例

本文整理汇总了Python中UserDb的典型用法代码示例。如果您正苦于以下问题:Python UserDb类的具体用法?Python UserDb怎么用?Python UserDb使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了UserDb类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: del_user

def del_user(usrname):
  act_user = get_act_user()
  if act_user is None:
    redirect('/')
  act_user = UserDb.get(act_user)
  UserDb.del_user(usrname)
  redirect('/account_mngn')
开发者ID:hightoon,项目名称:harbour_database,代码行数:7,代码来源:UIMain.py

示例2: del_role

def del_role(rolename):
  act_user = get_act_user()
  if act_user is None:
    redirect('/')
  act_user = UserDb.get(act_user)
  UserDb.del_role(rolename)
  return rolename, '已删除'
开发者ID:hightoon,项目名称:harbour_database,代码行数:7,代码来源:UIMain.py

示例3: query_vhl_info

def query_vhl_info():
  act_user = get_act_user()
  if act_user is None:
    redirect('/')
  act_user = UserDb.get(act_user)
  plate = request.forms.get('plate')
  print plate
  #dbconn = sdb.connect_orclex('haitong', '111111', sdb.DB_URL)
  dbconn = sdb.connect()
  dbconn.text_factory = str
  cur = dbconn.cursor()
  cur.execute("SELECT rowid, * FROM vehicleinfo WHERE WYCPH like \'%%%s%%\'"%(plate,))
  res = [('序号', '车牌号', '公司全称', '境外车牌号', '境内车牌号', '所属国籍', '车辆类型代码',
          '车辆高度', '肽位', '批文有效期', '通行口岸代码', '通行有效期', '申请表号', '现批文号码',
          '款式颜色', '车头字', '载重吨位', '内地承办单位', '录入检查员代码', '录入时间', '操作口岸代码',
          '备注', '主驾驶', '副驾驶')]
  res += cur.fetchall()
  #cur.execute("SELECT * FROM vehicleinfo")
  #res = cur.fetchall()
  cur.close()
  dbconn.close()
  return template('./view/query.tpl',
          query_results=res, query_tbl='vehicle',
          privs=UserDb.get_privilege(act_user.role),
          curr_user=get_act_user(),
          querydisp=get_query_disp(), settingdisp=get_setting_disp())
开发者ID:hightoon,项目名称:harbour_database,代码行数:26,代码来源:UIMain.py

示例4: query_vehicle

def query_vehicle():
  act_user = get_act_user()
  if act_user is None:
    redirect('/')
  act_user = UserDb.get(act_user)
  veh_rec_hdr = (u'车牌号', u'公司全称', u'司机', u'证件类型', u'证件号码',
                 u'进出时间', u'港口', u'进出状态', u'司机照片', u'车辆照片')
  tab_query_cols = ('direction')
  like_query_cols = ('plate', 'idnum', 'company')
  query_cond = {}
  for kw in tab_query_cols:
    input = request.forms.get(kw)
    if input: query_cond[kw] = input
  where_str = cons_query_where_clause(query_cond)
  like_cond = {}
  for kw in like_query_cols:
    input = request.forms.get(kw)
    if input: like_cond[kw] = input
  like_str = cons_like_clause(like_cond)
  # add query interval
  interval = cons_query_interval(request.forms.get('start'), request.forms.get('end'))
  if interval:
    print interval
    start, end = interval
    query_cond['start'] = start
    query_cond['end'] = end
    interval_str = ' datetime(date) BETWEEN datetime(:start) and datetime(:end)'
  else:
    interval_str = ''
  dbconn = sdb.connect()
  dbconn.text_factory = str
  cur = dbconn.cursor()
  final_cond = ' and '.join([subcond for subcond in (where_str, like_str, interval_str) if subcond])
  final_query_str = "SELECT * FROM vehicle_rec_table"
  if final_cond:
    final_query_str += " WHERE " + final_cond
  cur.execute(final_query_str, query_cond)
  res = cur.fetchall()
  cur.close()
  dbconn.close()
  for vhlrec in res:
    if not os.path.isfile(vhlrec[-1]):
      if vhlrec[-1].endswith('.jpg'):
        retr_img_from_ftp(vhlrec[-1])
    if not os.path.isfile(vhlrec[-2]):
      if vhlrec[-2].endswith('.jpg'):
        retr_img_from_ftp(vhlrec[-2])
  if request.forms.get('export'):
    csvname = datetime.strftime(datetime.now(), '%Y%m%dT%H%M%S') + '.csv'
    with open(csvname, 'wb') as csvfile:
      writer = csv.writer(csvfile, dialect='excel')
      writer.writerow(veh_rec_hdr)
      writer.writerows(res)
    return '<p>数据已导出,点击下载文件<a href="/static/%s">%s</a></p>'%(csvname, csvname)
  return template('./view/query.tpl',
          query_results=[veh_rec_hdr]+res, query_tbl='vehicle_recs',
          privs=UserDb.get_privilege(act_user.role),
          curr_user=get_act_user(),
          querydisp=get_query_disp(), settingdisp=get_setting_disp())
开发者ID:Shallwewu,项目名称:harbour_database,代码行数:59,代码来源:UIMain.py

示例5: query_home

def query_home():
  act_user = get_act_user()
  if act_user is None:
    redirect('/')
  privs = UserDb.get_privilege(UserDb.get(act_user).role)
  return template('./view/query.tpl', query_results=[], query_tbl='',
                  privs=privs, curr_user=get_act_user(),
                  querydisp=get_query_disp(), settingdisp=get_setting_disp())
开发者ID:hightoon,项目名称:harbour_database,代码行数:8,代码来源:UIMain.py

示例6: add_ship

def add_ship():
  act_user = get_act_user()
  if act_user is None:
    redirect('/')
  act_user = UserDb.get(act_user)
  return template('./view/ship.tpl', privs=UserDb.get_privilege(act_user.role),
                  curr_user=get_act_user(),
                  querydisp=get_query_disp(), settingdisp=get_setting_disp())
开发者ID:hightoon,项目名称:harbour_database,代码行数:8,代码来源:UIMain.py

示例7: update

def update(rowid):
  act_user = get_act_user()
  if act_user is None:
    redirect('/')
  act_user = UserDb.get(act_user)
  return template('./view/update_company.tpl', privs=UserDb.get_privilege(act_user.role),
                  curr_user=get_act_user(), rowid=rowid,
                  querydisp=get_query_disp(), settingdisp=get_setting_disp())
开发者ID:Shallwewu,项目名称:harbour_database,代码行数:8,代码来源:UIMain.py

示例8: change_passwd

def change_passwd():
  act_user = get_act_user()
  if act_user is None:
    redirect('/')
  act_user = UserDb.get(act_user)
  return template('./view/setting.tpl', setting="change_password",
                  privs=UserDb.get_privilege(act_user.role),
                  curr_user=get_act_user(),
                  querydisp=get_query_disp(), settingdisp=get_setting_disp())
开发者ID:hightoon,项目名称:harbour_database,代码行数:9,代码来源:UIMain.py

示例9: query_veh_info

def query_veh_info():
  act_user = get_act_user()
  if act_user is None:
    redirect('/')
  act_user = UserDb.get(act_user)
  return template('./view/query.tpl', query_results=[], query_tbl='driver',
                  privs=UserDb.get_privilege(act_user.role),
                  curr_user=get_act_user(),
                  querydisp=get_query_disp(), settingdisp=get_setting_disp())
开发者ID:hightoon,项目名称:harbour_database,代码行数:9,代码来源:UIMain.py

示例10: edit_role

def edit_role(rolename):
  act_user = get_act_user()
  if act_user is None:
    redirect('/')
  act_user = UserDb.get(act_user)
  return template('./view/setting.tpl', setting='edit_role',
                  roles=UserDb.get_roles(), privs=UserDb.get_privilege(act_user.role),
                  role2edit=rolename, curr_user=get_act_user(),
                  querydisp=get_query_disp(), settingdisp=get_setting_disp())
开发者ID:hightoon,项目名称:harbour_database,代码行数:9,代码来源:UIMain.py

示例11: update_user

def update_user():
  act_user = get_act_user()
  if act_user is None:
    redirect('/')
  act_user = UserDb.get(act_user)
  return template('./view/setting.tpl', setting="adduser",
                  roles=UserDb.get_roles(),
                  privs=UserDb.get_privilege(act_user.role),
                  curr_user=get_act_user(),
                  querydisp=get_query_disp(), settingdisp=get_setting_disp())
开发者ID:hightoon,项目名称:harbour_database,代码行数:10,代码来源:UIMain.py

示例12: access_control

def access_control():
  act_user = get_act_user()
  if act_user is None:
    redirect('/')
  act_user = UserDb.get(act_user)
  return template('./view/setting.tpl', setting='access_granting',
                  roles=UserDb.get_roles(),
                  privs=UserDb.get_privilege(act_user.role),
                  curr_user=get_act_user(),
                  querydisp=get_query_disp(), settingdisp=get_setting_disp())
开发者ID:hightoon,项目名称:harbour_database,代码行数:10,代码来源:UIMain.py

示例13: edit_user

def edit_user(usrname):
  act_user = get_act_user()
  if act_user is None:
    redirect('/')
  act_user = UserDb.get(act_user)
  nickname = request.forms.get('nickname')
  desc = request.forms.get('desc')
  role = request.forms.get('role')
  print usrname, nickname, desc, role
  UserDb.change_user_info(usrname, desc, role, nickname)
  redirect('/account_mngn')
开发者ID:hightoon,项目名称:harbour_database,代码行数:11,代码来源:UIMain.py

示例14: account_mngn

def account_mngn():
  act_user = get_act_user()
  if act_user is None:
    redirect('/')
  act_user = UserDb.get(act_user)
  users = UserDb.fetch_users()
  return template('./view/setting.tpl', setting='accounts',
                  users=users,
                  privs=UserDb.get_privilege(act_user.role),
                  curr_user=get_act_user(),
                  querydisp=get_query_disp(), settingdisp=get_setting_disp())
开发者ID:hightoon,项目名称:harbour_database,代码行数:11,代码来源:UIMain.py

示例15: update_passwd

def update_passwd():
  act_user = get_act_user()
  if act_user is None:
    redirect('/')
  act_user = UserDb.get(act_user)
  passwd = request.forms.get('newpass')
  cnfm_passwd = request.forms.get('confirmedpass')
  if passwd != cnfm_passwd:
    return '新密码两次输入不一致,请返回重试!'
  UserDb.change_passwd(act_user.usrname, passwd)
  redirect('/account_mngn')
开发者ID:hightoon,项目名称:harbour_database,代码行数:11,代码来源:UIMain.py


注:本文中的UserDb类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。