本文整理汇总了Python中webp.utils.users.user_info_context函数的典型用法代码示例。如果您正苦于以下问题:Python user_info_context函数的具体用法?Python user_info_context怎么用?Python user_info_context使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_info_context函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: updateinit
def updateinit(request):
tac_id = int(request.GET['tac_id'])
res = TacCtrl.search(tac_id = tac_id)[0]
print 'updateinit res', res, len(res)
id, name, description, dt, key_1, value_1, \
key_2, value_2 , key_3, value_3, \
key_4, value_4, key_5, value_5, module_name = res
# create a new tac
tac = Tac(
id = id,
name = name,
description = description,
dt = dt)
for key,value in [
(key_1, value_1,),
(key_2, value_2,),
(key_3, value_3,),
(key_4, value_4,),
(key_5, value_5,),
]:
key, value = key.strip(), value.strip()
if key and value:
tac.map.update({key : value})
dic = user_utils.user_info_context(request)
dic.update(
{'tac': tac}
)
return render_to_response("html/dcg/tac/tac_update.html", dic)
开发者ID:Superjom,项目名称:webp,代码行数:30,代码来源:tac.py
示例2: list
def list(request):
db = DB()
tac_name = request.GET['tac_name']
func_flag = request.GET['func_flag']
sql = strtpl("select a.id,c.name taca_name,d.name tacb_name,e.name user_name,a.dt,a.status,a.description from func_tac_rel a,func b,tac c,tac d,user e where a.func_id=b.id and a.taca_id=c.id and a.tacb_id=d.id and a.user_id=e.id and b.flag='$func_flag' and (c.name like '%$tac_name%' or d.name like '%$tac_name%') order by a.dt desc").substitute(
tac_name = tac_name,
func_flag = func_flag)
_debug_print('sql ' + sql)
db.execute(sql)
_list = []
res = db.fetchall()
_debug_print( 'res'+ str(res))
data = {}
for data['id'], data['taca_name'], data['tacb_name'], \
data['user_name'], data['dt'], data['status'], data['description'] in res:
_debug_print('data:' + str(data))
ft = FuncTac( **data )
_list.append(ft)
data = {}
dic = user_utils.user_info_context(request)
user = dic['user']
module = user.get_module('nonmarked')
func = module.get_func('fieldcase')
dic.update({
'func': func,
'list': _list,
})
return render_to_response("html/nonmarked/fieldcase/list.html", dic)
开发者ID:Superjom,项目名称:webp,代码行数:33,代码来源:fieldcase.py
示例3: create
def create(request):
db = DB()
dic = user_utils.user_info_context(request)
user = dic['user']
module_flag = request.GET['module_flag']
func_flag = request.GET['func_flag']
taca_id = int(request.GET['taca_id'])
tacb_id = int(request.GET['tacb_id'])
func_id = db.get_value("select id from func where flag='%s'" % func_flag)
count = db.get_value("select count(*) from func_tac_rel where func_id=%d and taca_id=%d and tacb_id=%d" % (func_id, taca_id, tacb_id))
if count > 0: return HttpResponse("该策略任务已经存在")
taca = Tac.from_db(id=taca_id)
tacb = Tac.from_db(id=tacb_id)
sql = "insert into func_tac_rel(func_id,taca_id,tacb_id,user_id,status) values(%d,%d,%d,%d,0)" % (func_id, taca_id, tacb_id, user.id)
_debug_print(sql)
db.exe_commit(sql)
tac_name = "%s_%s" % (taca.name, tacb.name)
sql = "select id from func_tac_rel where func_id=%d and taca_id=%d and tacb_id=%d" % (func_id, taca_id, tacb_id)
_debug_print(sql)
func_tac_id = db.get_value(sql)
a_keys, a_values = taca.keys_values
b_keys, b_values = tacb.keys_values
shell = Shell(
module_flag = module_flag,
func_flag = func_flag,
tac_name = tac_name,
args = {
'k': a_keys, 'v': a_values,
'x': b_keys, 'y': b_values,
't': 1,
}
)
log_path = shell.gen_log_path()
sql = "insert into func_tac_log(func_tac_id,path,kind) values(%d,'%s',1)" % (func_tac_id, log_path)
_debug_print(sql)
db.exe_commit(sql)
res = shell.execute()
if res:
return HttpResponse('1')
else:
sql = "update func_tac_rel set status=-1,description='Interface error' where id=%d" % func_tac_id
_debug_print(sql)
db.exe_commit(sql)
开发者ID:Superjom,项目名称:webp,代码行数:53,代码来源:fieldcase.py
示例4: index
def index(request):
dic = user_utils.user_info_context(request)
if not dic: return redirect('/login')
user = dic['user']
module = user.get_module('nonmarked')
func = module.get_func('fieldcase')
dic.update({
'module_flag': module.flag,
'func_flag': func.flag,
'purview_has_create': 'create' in func.purview,
'func': func,
})
return render_to_response("html/nonmarked/fieldcase/index.html", dic)
开发者ID:Superjom,项目名称:webp,代码行数:15,代码来源:fieldcase.py
示例5: list
def list(request):
tac_name = request.GET['tac_name']
func_flag = request.GET['func_flag']
_list = AnchorStatCtrl.search(tac_name, func_flag)
dic = user_utils.user_info_context(request)
user = dic['user']
module = user.get_module('nonmarked')
func = module.get_func('fieldstat')
dic.update({
'list': _list,
'func': func,
})
return render_to_response("html/nonmarked/fieldstat/list.html", dic)
开发者ID:Superjom,项目名称:webp,代码行数:15,代码来源:fieldstat.py
示例6: createinit
def createinit(request):
module_flag = request.GET['module_flag']
db = DB()
module_id = db.get_value("select id from module where flag='%s'" % module_flag)
db.execute("select id,name from tac where module_id=%d" % module_id)
res = db.fetchall()
_list = []
for id, name in res:
tac = Tac(id=id, name=name)
_list.append(tac)
dic = user_utils.user_info_context(request)
dic['tacs'] = _list
return render_to_response("html/nonmarked/fieldstat/create.html", dic)
开发者ID:Superjom,项目名称:webp,代码行数:16,代码来源:fieldstat.py
示例7: index
def index(request):
dic = user_utils.user_info_context(request)
if not dic: return redirect('/login')
user = dic['user']
module = user.get_module('dcg')
func = module.get_func('dcgtac')
data = {
'module_flag': module.flag,
'func_flag': func.flag,
'func': func,
}
dic.update(data)
return render_to_response("html/dcg/tac/tac_index.html", dic)
开发者ID:Superjom,项目名称:webp,代码行数:16,代码来源:tac.py
示例8: create_schedule
def create_schedule(request):
db = DB()
func_tac_id = int(request.GET["func_tac_id"])
db.execute("select a.path,c.name taca_name,d.name tacb_name from func_tac_log a join func_tac_rel b on a.func_tac_id=b.id left join tac c on b.taca_id=c.id left join tac d on b.tacb_id=d.id where b.id=%d" % func_tac_id)
res = db.fetchone()
if res: log_path, taca_name, tacb_name = res
dic = user_utils.user_info_context(request)
try:
dic.update( dict(
schedule = filetool.read(log_path) + "<br/>",
tacName = "%s_%s"%(taca_name, tacb_name) if tacb_name != None else taca_name,
))
return render_to_response("/html/nonmarked/fieldcase/createschedule.html", dic)
except:
return HttpResponse("日志文件不存在")
开发者ID:Superjom,项目名称:webp,代码行数:16,代码来源:fieldcase.py
示例9: index
def index(request):
dic = user_utils.user_info_context(request)
if not dic: return redirect('/login')
user = dic['user']
module = user.get_module('dcg')
func = module.get_func('rankla')
dic.update({
'module_flag': module.flag,
'func_flag': func.flag,
'func_name': func.name,
'purview_has_create': 'create' in func.purview,
'func': func,
})
return render_to_response("html/dcg/rankla/index.html", dic)
开发者ID:Superjom,项目名称:webp,代码行数:16,代码来源:rankla.py
示例10: list
def list(request):
tac_name = request.GET.get('tagname', '')
module_id = ModuleCtrl.get_id(flag='dcg')
res = TacCtrl.search(
tac_id=-1,
module_id=module_id,
tac_name=tac_name)
dic = user_utils.user_info_context(request)
user = dic['user']
module = user.get_module('dcg')
func = module.get_func('dcgtac')
dic.update({
'list': res,
'purview_has_update': 'update' in func.purview,
'purview_has_delete': 'delete' in func.purview,
'func': func,
})
return render_to_response("html/dcg/tac/tac_list.html", dic)
开发者ID:Superjom,项目名称:webp,代码行数:18,代码来源:tac.py
示例11: createinit
def createinit(request):
db = DB()
dic = user_utils.user_info_context(request)
module_flag = 'dcg'
module_id = ModuleCtrl.get_id(module_flag)
db.execute("select key_1, key_2, key_3, key_4, key_5 from tac where module_id=%d order by dt desc limit 0,1" % module_id)
res = db.fetchall()
if not res:
keylist = ["" for i in range(5)]
else:
res = List(res[0])
#print 'createinit res:', res
keys = res + ["" for i in range(5)]
keylist = [keys[i] for i in range(5)]
dic.update({
'keylist': keylist,
})
return render_to_response("html/dcg/tac/tac_create.html", dic)
开发者ID:Superjom,项目名称:webp,代码行数:19,代码来源:tac.py
示例12: show
def show(request):
db = DB()
dic = user_utils.user_info_context(request)
module_flag = request.GET['module_flag']
func_flag = request.GET['func_flag']
func_tac_id = request.GET['func_tac_id']
sql = strtpl("select c.name from func_tac_rel a,func b,tac c where a.func_id=b.id and a.taca_id=c.id and a.id=$func_tac_id").substitute(func_tac_id = func_tac_id)
db.execute(sql)
tac_name = (db.fetchone()[0]).strip()
try:
path = os.path.join(
Util.INVLINK_HOME,
module_flag, func_flag,
'display', tac_name, 'info')
_debug_print("des_path: ", path)
return render_to_response("html/dcg/rankla/show.html", dic)
except:
return HttpResponse("file does not exist!")
开发者ID:Superjom,项目名称:webp,代码行数:20,代码来源:rankla.py
示例13: header
def header(request):
user = user_utils.user_info_context(request)
return render_to_response("html/header.html", user)
开发者ID:Superjom,项目名称:webp,代码行数:3,代码来源:views.py
示例14: show
def show(request):
module_flag = request.GET['module_flag']
func_flag = request.GET['func_flag']
func_tac_id = request.GET['func_tac_id']
dic = user_utils.user_info_context(request)
db = DB()
sql = strtpl("select c.name taca_name,d.name tacb_name from func_tac_rel a join func b on a.func_id=b.id join tac c on a.taca_id=c.id left join tac d on a.tacb_id=d.id where a.id=$func_tac_id").substitute(func_tac_id = func_tac_id)
db.execute(sql)
taca_name, tacb_name = db.fetchone()
tac_name = taca_name
if tacb_name:
tac_name += "_" + tacb_name
try:
des_path = os.path.join(
Util.INVLINK_HOME,
module_flag, func_flag,
'display', tac_name, 'description')
_debug_print("des_path: " + des_path)
description = filetool.read(des_path)
dic.update(description = description)
except:
pass
try:
more_path = os.path.join(
Util.INVLINK_HOME, module_flag,
func_flag, 'display', tac_name, 'more')
_debug_print("more_path: " + more_path)
more = filetool.read(more_path)
dic['more'] = more
except:
pass
data = []
dic['data'] = data
try:
k = 1
while True:
info = []
info = filetool.readlines(
os.path.join(
Util.INVLINK_HOME,
module_flag, func_flag,
'display', tac_name,
'info_%d' % k))
try:
de = filetool.read( os.path.join(
Util.INVLINK_HOME, module_flag,
func_flag, 'display', tac_name,
'description_%d' % k
))
except:
pass
try:
mo = filetool.read(os.path.join(
Util.INVLINK_HOME,
module_flag, func_flag,
'display', tac_name,
'more_%d' % k
))
except:
pass
data.append(
ShowEntity(de, mo, info)
)
k += 1
except:
pass
return render_to_response("html/nonmarked/googlepr/show.html", dic)
开发者ID:Superjom,项目名称:webp,代码行数:78,代码来源:googlepr.py
示例15: create
def create(request):
db = DB()
dic = user_utils.user_info_context(request)
user = dic['user']
module_flag = request.GET['module_flag']
func_flag = request.GET['func_flag']
taca_id = int(request.GET['taca_id'])
try:
tacb_id = int(request.GET['tacb_id'])
except:
tacb_id = 0
func_id = db.get_value("select id from func where flag='%s'" % func_flag)
count = db.get_value("select count(*) from func_tac_rel where func_id=%d and taca_id=%d and tacb_id=%d" % (func_id, taca_id, tacb_id))
if count > 0:
return HttpResponse("该策略任务已经存在")
taca = Tac.from_db(taca_id)
tacb = Tac.from_db(tacb_id) if tacb_id != 0 else None
if tacb_id != 0:
count = db.get_value("select count(*) from func_tac_rel where func_id=$func_id and taca_id in ($taca_id,$tacb_id) and status=1 and tacb_id is null")
if count < 2: return HttpResponse("单个策略的统计数据尚未生成")
sql = "insert into func_tac_rel(func_id,taca_id,tacb_id,user_id,status) values(%d,%d,%d,%d,0)" % (func_id, taca_id, tacb_id, user.id)
else:
sql = "insert into func_tac_rel(func_id,taca_id,user_id,status) values(%d,%d,%d,0)" % (func_id, taca_id, user.id)
_debug_print("sql: " + sql)
db.exe_commit(sql)
tac_name = "%s_%s" % (taca.name, tacb.name) if tacb_id != 0 else taca.name
sql = ("select id from func_tac_rel where func_id=%d and taca_id=%d and tacb_id=" + \
str(tacb_id) if tacb_id != 0 else "null") % taca_id
_debug_print(sql)
func_tac_id = db.get_value(sql)
shell = Shell(
module_flag = module_flag,
func_flag = func_flag,
tac_name = tac_name,
args = {
't':1,
}
)
log_path = shell.gen_log_path()
sql = "insert into func_tac_log(func_tac_id,path,kind) values(%d,'%s',1)" % (func_tac_id, log_path)
_debug_print(sql)
db.exe_commit(sql)
# <<<<<<<<<<<<<<<<<<<<<<<
a_keys, a_values = taca.keys_values
args = {
'k': a_keys, 'v': a_values,
}
if tacb_id != 0:
# generate keys and values
b_keys, b_values = tacb.keys_values
args.update( {
'x': b_keys,
'y': b_values,
})
shell.update_args(args)
res = shell.execute()
if not res:
sql = "update func_tac_rel set status=-1,description='Interface error' where id=%d" % func_tac_id
_debug_print(sql)
db.exe_commit(sql)
return HttpResponse("0")
return HttpResponse('1')
开发者ID:Superjom,项目名称:webp,代码行数:77,代码来源:googlepr.py
示例16: left
def left(request):
user = user_utils.user_info_context(request)
return render_to_response("html/left.html", user)
开发者ID:Superjom,项目名称:webp,代码行数:3,代码来源:views.py
示例17: show
def show(request):
db = DB()
dic = user_utils.user_info_context(request)
module_flag = request.GET['module_flag']
func_flag = request.GET['func_flag']
func_tac_id = request.GET['func_tac_id']
sql = strtpl("select c.name from func_tac_rel a,func b,tac c where a.func_id=b.id and a.taca_id=c.id and a.id=$func_tac_id").substitute(func_tac_id = func_tac_id)
db.execute(sql)
tac_name = (db.fetchone()[0]).strip()
try:
des_path = os.path.join(
Util.INVLINK_HOME,
module_flag, func_flag,
'display', tac_name, 'description')
_debug_print("des_path: ", des_path)
description = filetool.read(des_path)
dic['description'] = description
except:
pass
try:
more_path = os.path.join(
Util.INVLINK_HOME, module_flag,
func_flag, 'display', tac_name, 'more')
_debug_print("more_path: " + more_path)
more = filetool.read(more_path)
dic['more'] = more
except:
pass
data = []
dic['data'] = data
try:
k = 1
while True:
info = []
info = filetool.readlines(
os.path.join(
Util.INVLINK_HOME,
module_flag, func_flag,
'display', tac_name,
'info_%d' % k))
try:
de = filetool.read( os.path.join(
Util.INVLINK_HOME, module_flag,
func_flag, 'display', tac_name,
'description_%d' % k
))
except:
pass
try:
mo = filetool.read(os.path.join(
Util.INVLINK_HOME,
module_flag, func_flag,
'display', tac_name,
'more_%d' % k
))
except:
pass
data.append(
ShowEntity(de, mo, info)
)
k += 1
except:
pass
return render_to_response("html/nonmarked/fieldstat/show.html", dic)
开发者ID:Superjom,项目名称:webp,代码行数:75,代码来源:fieldstat.py
示例18: index
def index(request):
user = user_utils.user_info_context(request)
if not user:
# default to guest
user_utils.guest_login(request)
return render_to_response("html/index.html", user)
开发者ID:Superjom,项目名称:webp,代码行数:6,代码来源:views.py
注:本文中的webp.utils.users.user_info_context函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论