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


Python Activity.editPersonProfile方法代码示例

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


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

示例1: POST

# 需要导入模块: import Activity [as 别名]
# 或者: from Activity import editPersonProfile [as 别名]
 def POST(self):
     session = Activity.createSession('try')
     web_input = web.input(new_picture={})
     person_profile = {'objectId': web_input['objectId']}
     teams = Activity.getLeadTeam(session, user_session.get('user')['name'])
     rtn_url =  web_input['rtn_url']
     del web_input['rtn_url']
     if web_input.new_picture.filename!='':  #update the profile image
         origin_full_filename="images/profile/origin_"  +web_input.new_picture.filename
         file_ext = web_input.new_picture.filename.split('.')[-1]
         fout = open( origin_full_filename,'wb+') 
         fout.write(web_input.new_picture.file.read())
         fout.close()
         im = Image.open(origin_full_filename)
         thumbnail_file_name= md5(open(origin_full_filename, 'rb').read()).hexdigest() + '.' + file_ext
         im.thumbnail((140,140), Image.ANTIALIAS)
         im.save("images/profile/" + thumbnail_file_name)
         web_input.picture = thumbnail_file_name
         remove(origin_full_filename)
     if user_session.get('user')['access_level'] <=2:   #manager             
         person_profile.update(web_input)
         del person_profile['new_picture']
     elif teams is not None:   #TEAMLEAD
         for team in teams:
             if Activity.check_person_on_team(session, web_input['objectId'], team.objectId) :
                 person_profile['display_name'] = web_input['display_name']
                 person_profile['team'] = web_input['team']
                 person_profile['location'] = web_input['location']
                 person_profile['user_type'] = web_input['user_type']
                 person_profile['email'] = web_input['email']
                 person_profile['name'] = web_input['email'].split('@')[0]
                 break
     if user_session.get('user')['display_name'] == web_input['display_name']:  #person himself
         person_profile['email'] = web_input['email']
         person_profile['name'] = web_input['email'].split('@')[0]
         if 'picture' in web_input.keys():
             person_profile['picture'] = web_input['picture']
         person_profile['mobile_num'] = web_input['mobile_num']
     Activity.editPersonProfile(session, person_profile)
     user_session.user.update(person_profile)
     raise web.seeother(rtn_url)         
开发者ID:AgentKWang,项目名称:ProjectPlaningTool,代码行数:43,代码来源:ActivityWebTry.py


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