本文整理汇总了Python中Activity.createSession方法的典型用法代码示例。如果您正苦于以下问题:Python Activity.createSession方法的具体用法?Python Activity.createSession怎么用?Python Activity.createSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Activity
的用法示例。
在下文中一共展示了Activity.createSession方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: authenticate
# 需要导入模块: import Activity [as 别名]
# 或者: from Activity import createSession [as 别名]
def authenticate(self, user_name, pswd):
"""
Validates the user's credentials. If are valid, returns
a user object (minus the password hash).
"""
#login = login.strip()
#password = password.strip()
rslt = ldap_auth(user_name,pswd)
if rslt:
self.db_session = Activity.createSession('try')
user = Activity.getUser(self.db_session,user_name)
if not user:
#user in LDAP but not in our DB
return
else:
del user['password']
return user
else :
#check in our own DB
self.db_session = Activity.createSession('try')
user = Activity.getUser(self.db_session,user_name)
if not user:
return
if not self.checkPassword(pswd, user['password']):
return
del user['password']
return user
示例2: POST
# 需要导入模块: import Activity [as 别名]
# 或者: from Activity import createSession [as 别名]
def POST(self):
session = Activity.createSession('try')
if user_session.get('user')['access_level']==0:
data = json.loads(web.data())
Activity.userIdAdmin(session, data["userid"], data["username"], data["mail"])
return
return "Permission Denied"
示例3: GET
# 需要导入模块: import Activity [as 别名]
# 或者: from Activity import createSession [as 别名]
def GET(self,params_str):
params=params_str.split('/')
session = Activity.createSession('try')
name = params[0]
lead = params[1]
attr =params[2]
Activity.addTeamJson(session, name, lead, attr)
示例4: getCostBreakdownJson
# 需要导入模块: import Activity [as 别名]
# 或者: from Activity import createSession [as 别名]
def getCostBreakdownJson(parent_id):
session = Activity.createSession('try')
costs = Activity.getChildCosts(session, parent_id)
result = '{"costs": [\n'
for i in range(len(costs)-1):
result += '{"name": "' + str(costs[i][0]) + '", "cost": ' + str(costs[i][1]) +', "objectId": '+str(costs[i][2])+ '},\n'
if len(costs)>0:
result += '{"name": "' + str(costs[-1][0]) + '", "cost": ' + str(costs[-1][1]) +', "objectId": '+str(costs[-1][2])+ '}'
result +=']}'
return result
示例5: login
# 需要导入模块: import Activity [as 别名]
# 或者: from Activity import createSession [as 别名]
def login(self, user):
"""
Set the user as logged in.
"""
record_time = str(datetime.utcnow())
self.db_session = Activity.createSession('try')
user = Activity.updateUser(self.db_session,user['objectId'], record_time)
try:
del user['password']
except KeyError:
pass
self.session.user = user
return
示例6: getActivityProgressInfo
# 需要导入模块: import Activity [as 别名]
# 或者: from Activity import createSession [as 别名]
def getActivityProgressInfo(activity):
info = {"warning":False, "delaytime":0, "msg":"", "children":0, "delayed":0}
session = Activity.createSession("try")
if activity.activity_type == "Release" or activity.activity_type == "Feature":
query_table = Activity.Activity
filter_col = Activity.Activity.parent_id
recursive_func = getActivityProgressInfo
else:
query_table = Activity.Assignment
filter_col = Activity.Assignment.activity_id
recursive_func = getTaskProgressInfo
children = session.query(query_table).filter(filter_col == activity.objectId)
for child in children:
info["children"] += 1
if json.loads(recursive_func(child))["warning"]: info["delayed"] += 1
if info["delayed"] > 0: info["warning"] = True
session.close()
return json.dumps(info)