本文整理汇总了Python中UserDb.get_privilege方法的典型用法代码示例。如果您正苦于以下问题:Python UserDb.get_privilege方法的具体用法?Python UserDb.get_privilege怎么用?Python UserDb.get_privilege使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserDb
的用法示例。
在下文中一共展示了UserDb.get_privilege方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: query_vhl_info
# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get_privilege [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())
示例2: query_vehicle
# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get_privilege [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())
示例3: update
# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get_privilege [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())
示例4: query_home
# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get_privilege [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())
示例5: add_ship
# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get_privilege [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())
示例6: query_veh_info
# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get_privilege [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())
示例7: change_passwd
# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get_privilege [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())
示例8: edit_role
# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get_privilege [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())
示例9: update_user
# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get_privilege [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())
示例10: access_control
# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get_privilege [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())
示例11: account_mngn
# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get_privilege [as 别名]
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())
示例12: query
# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get_privilege [as 别名]
def query():
act_user = get_act_user()
if act_user is None:
redirect('/')
act_user = UserDb.get(act_user)
stations = sdb.get_stations_from_driver_recs()
stations = list(set(stations))
return template('./view/query.tpl', query_results=[], query_tbl='driver_recs',
stations=stations, privs=UserDb.get_privilege(act_user.role),
curr_user=get_act_user(),
querydisp=get_query_disp(), settingdisp=get_setting_disp())
示例13: account_query
# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get_privilege [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')
示例14: update
# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get_privilege [as 别名]
def update(rowid):
act_user = get_act_user()
if act_user is None:
redirect('/')
act_user = UserDb.get(act_user)
cols = get_colomns('crs_shp_table')
num_of_cols = len(cols)
dbconn = sdb.connect()
dbconn.text_factory = str
cur = dbconn.cursor()
cur.execute('SELECT * FROM crs_shp_table WHERE rowid=%s'%(rowid,))
row = cur.fetchone()
dbconn.close()
default_data = {}
if row:
for i in xrange(num_of_cols):
default_data[cols[i].lower()] = row[i]
return template('./view/update_ship.tpl', privs=UserDb.get_privilege(act_user.role),
curr_user=get_act_user(), rowid=rowid, default_data=default_data,
querydisp=get_query_disp(), settingdisp=get_setting_disp())
示例15: query_ship
# 需要导入模块: import UserDb [as 别名]
# 或者: from UserDb import get_privilege [as 别名]
def query_ship():
act_user = get_act_user()
if act_user is None:
redirect('/')
act_user = UserDb.get(act_user)
cruise = request.forms.get('cruise')
#dbconn = sdb.connect_orclex('haitong', '111111', sdb.DB_URL)
dbconn = sdb.connect()
dbconn.text_factory = str
cur = dbconn.cursor()
cur.execute("SELECT rowid, * FROM crs_shp_table WHERE HC like \'%%%s%%\'"%(cruise,))
res = [('序号', '航次', '船舶检索标识', 'MMSI号', '交通工具类型代码', '船舶种类代码', '船舶中文名称',
'船舶英文名称', 'IMO号', '国际呼号', '国籍地区代码', '船员变更标识', '重点关注标识',
'当前检查分类', '当前检查状态', '口岸代码', '操作员', '操作部门', '操作时间', '船籍港', '当前停靠地(码头)',
'当前停靠地(泊位)', '解档修改状态', '加封人', '加封时间', '启封人', '启封时间', '武器弹药',
'加封口岸', '启封口岸', '优检标志', '船舶状态')]
res += cur.fetchall()
cur.close()
dbconn.close()
return template('./view/query.tpl',
query_results=res, query_tbl='ship',
privs=UserDb.get_privilege(act_user.role),
curr_user=get_act_user(),
querydisp=get_query_disp(), settingdisp=get_setting_disp())