本文整理汇总了Python中Activity类的典型用法代码示例。如果您正苦于以下问题:Python Activity类的具体用法?Python Activity怎么用?Python Activity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Activity类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GET
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)
示例2: authenticate
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
示例3: POST
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"
示例4: GetSupportTasksByTeam
def GetSupportTasksByTeam(session, teamname):
result = '{"supports": [\n'
supports = list(session.query(Activity.Assignment).filter(Activity.Assignment.team==teamname).filter(Activity.Assignment.task_phase>=100))
for i in range(len(supports)-1):
result+= supports[i].json()[:-1]+',"display_name":"'+Activity.getDisplaynameByUsername(session, supports[i].person)+ '"},\n'
if len(supports)>0:
result+= supports[-1].json()[:-1]+',"display_name":"'+Activity.getDisplaynameByUsername(session, supports[-1].person)+ '"}\n'
result+=']}'
return result
示例5: getCostBreakdownJson
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
示例6: login
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
示例7: EditSupportTask
def EditSupportTask(session, id, st):
task = list(session.query(Activity.Assignment).filter(Activity.Assignment.objectId == id))[0]
task.person = st["person"]
task.task_phase = st["type"]
task.planned_start_date = st["start_date"]
task.planned_num_weeks = st["duration"]
task.forecast_end_date = Activity.getEndDate(st['start_date'], float(st["duration"]))
task.activity_id = st["activity_id"]
task.work_load = st["workload"]
session.commit()
示例8: AddSupportTask
def AddSupportTask(session, st):
if st["duration"]=='':
durationCount = 0
expectedEnd = ''
else:
durationCount = st["duration"]
expectedEnd = Activity.getEndDate(st['start_date'], float(st["duration"]))
if st["type"]=="300":
setname = st["person"]+" On Vacation"
elif st["type"] == "301":
setname = "Other"
else:
setname = st["team"] +":"+st["person"] + " Support Task"
task = Activity.Assignment(name = setname, team = st["team"], activity_id = st["activity_id"],person = st["person"], task_phase = st["type"],\
planned_start_date = st["start_date"],planned_num_weeks = durationCount, work_load=st["workload"], forecast_start_date='',\
forecast_end_date = expectedEnd,actual_start_date='', actual_end_date='', status = 0, predecessor="[]", successor="[]",description='')
session.add(task)
session.commit()
示例9: getActivityProgressInfo
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)