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


Python UserDb.get方法代码示例

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


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

示例1: account_query

# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get [as 别名]
def account_query():
  act_user = get_act_user()
  if act_user is None:
    redirect('/')
  act_user = UserDb.get(act_user)
  user = request.forms.get('account')
  if request.forms.get('query'):
    return template('./view/setting.tpl', setting="accounts",
                    users=[UserDb.get(user)],
                    privs=UserDb.get_privilege(act_user.role),
                    curr_user=get_act_user(),
                    querydisp=get_query_disp(), settingdisp=get_setting_disp())
  elif request.forms.get('create'):
    redirect('/user_update')
开发者ID:hightoon,项目名称:harbour_database,代码行数:16,代码来源:UIMain.py

示例2: query_vhl_info

# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get [as 别名]
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,代码行数:28,代码来源:UIMain.py

示例3: del_user

# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get [as 别名]
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,代码行数:9,代码来源:UIMain.py

示例4: validate_from_db

# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get [as 别名]
def validate_from_db(usr, passwd):
  user = UserDb.get(usr)
  if user is not None and user.usrname == usr and user.password == passwd:
    ret = True, user
  else:
    ret = False, user
  return ret
开发者ID:hightoon,项目名称:harbour_database,代码行数:9,代码来源:UIMain.py

示例5: del_role

# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get [as 别名]
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,代码行数:9,代码来源:UIMain.py

示例6: query_vehicle

# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get [as 别名]
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,代码行数:61,代码来源:UIMain.py

示例7: add_ship

# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get [as 别名]
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,代码行数:10,代码来源:UIMain.py

示例8: query_home

# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get [as 别名]
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,代码行数:10,代码来源:UIMain.py

示例9: update

# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get [as 别名]
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,代码行数:10,代码来源:UIMain.py

示例10: edit_role

# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get [as 别名]
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,代码行数:11,代码来源:UIMain.py

示例11: query_veh_info

# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get [as 别名]
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,代码行数:11,代码来源:UIMain.py

示例12: change_passwd

# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get [as 别名]
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,代码行数:11,代码来源:UIMain.py

示例13: access_control

# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get [as 别名]
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,代码行数:12,代码来源:UIMain.py

示例14: update_user

# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get [as 别名]
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,代码行数:12,代码来源:UIMain.py

示例15: edit_user

# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get [as 别名]
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,代码行数:13,代码来源:UIMain.py


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