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


Python Directory.get_user方法代码示例

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


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

示例1: edit_user

# 需要导入模块: import Directory [as 别名]
# 或者: from Directory import get_user [as 别名]
 def edit_user(self, request):
   '''Shows the edit user screen'''
   user = Directory.get_user(request.getvalue('userid', 'New'))
   if user == None:
     user = datagate.Item()  # just create a dummy item
     userid = 'New'
   else:
     userid = user.id
开发者ID:ssaltzman,项目名称:POET,代码行数:10,代码来源:Administrator.py

示例2: save_user

# 需要导入模块: import Directory [as 别名]
# 或者: from Directory import get_user [as 别名]
 def save_user(self, request):
   '''Saves (or creates) a user'''
   userid = request.getvalue('userid', 'New')
   if (userid == 'New'):
     user = Directory.create_user(request.session.user.id)
   else:
     user = Directory.get_user(userid)
   for key in Directory.USER_FIELDS:
     setattr(user, key, request.getvalue(key, ''))
   user.save()
开发者ID:ssaltzman,项目名称:POET,代码行数:12,代码来源:Administrator.py

示例3: len

# 需要导入模块: import Directory [as 别名]
# 或者: from Directory import get_user [as 别名]
# go through the meetings
for meeting in meetings:
  print 'Working on', meeting.name
  
  groups = meeting.search1(name='groups').get_child_items()
  if len(groups) > 0:
    # meeting table
    rec = meetings_table.append()
    rec['global_meetingid'] = meeting.id
    rec['meetingname'] = meeting.name
    rec['meetingtype'] = meeting.name[meeting.name.find('.')+1: meeting.name.rfind('.')]
    
    # users table
    for user_item in groups[0]:
      user = Directory.get_user(user_item.user_id)
      rec = users_table.append()
      rec['global_meetingid'] = meeting.id
      rec['username'] = user.username
      rec['userid'] = user.id
    
    # comments and ratings
    for activity in meeting.search1(name='activities'):
      def recurse(item, activityname):
        for child in item:
          if child.getvalue('text', ''):
            rec = comments_table.append()
            rec['commentid'] = child.id
            rec['userid'] = child.creatorid
            rec['parentid'] = item.id
            rec['activity'] = activityname
开发者ID:ssaltzman,项目名称:POET,代码行数:32,代码来源:extract_comments.py

示例4: del_user

# 需要导入模块: import Directory [as 别名]
# 或者: from Directory import get_user [as 别名]
 def del_user(self, request):
   '''Sets a user as deleted'''
   user = Directory.get_user(request.getvalue('userid', ''))
   user.active = '0'
   user.save()
开发者ID:ssaltzman,项目名称:POET,代码行数:7,代码来源:Administrator.py

示例5: users_page

# 需要导入模块: import Directory [as 别名]
# 或者: from Directory import get_user [as 别名]
  def users_page(self, request):
    '''Shows the users (embedded in the main page table)'''
    # the title
    user = Directory.get_user('New')
    request.writeln('<div class="module"><h1>Users</h1>')
    
    # current users
    request.writeln('''
	<div align="center" name="userselect" id="userselect">
	  <div id="userlist">
    ''')
    users = Directory.get_users()
    users.sort(lambda a,b: cmp(a.username, b.username))
    for user in users:
      if user.superuser != '1':
	request.writeln('''<div class="userBox">''')
	request.writeln('''<span style="display:none;" id="userinfo_''' + user.id + '''">''' + user.id + '''</span>
			<span style="float:left;">'''+html(user.name)+'''</span>
			<span style="float:right;">
			  <a id="editUserForm" class="ui-icon ui-icon-pencil" href='javascript:editUser("''' + user.id + '''");'></a>
			  <a class="ui-icon ui-icon-closethick" href='javascript:deleteUser("''' + user.id + '''");'></a>
			</span>
		      </div>
	''')
    title = "Edit User"
    request.writeln('''
      <center>
      <div id="userFormDialog" title="''' + title + '''">
      ''' + request.cgi_form(_adminaction='saveuser', userid=user.id, name=None, email=None, username=None, password=None, title=None, office=None, work=None, home=None, mobile=None, fax=None, comments=None) + '''
      <table border=0 cellspacing=5><tr>
        <td>Real Name:</td>
        <td><input type="text" name="name" size="30" value="''' + user.getvalue('name', '') + '''"></td>
      </tr><tr>
        <td>Email:</td>
        <td><input type="text" name="email" size="30" value="''' + user.getvalue('email', '') + '''"></td>
      </tr><tr>
        <td>Username:</td>
        <td><input type="text" name="username" size="30" value="''' + user.getvalue('username', '') + '''"></td>
      </tr><tr>
        <td>Password:</td>
        <td><input type="text" name="password" size="30" value="''' + user.getvalue('password', '') + '''"></td>
      </tr><tr>
        <td>Title:</td>
        <td><input type="text" name="title" size="30" value="''' + user.getvalue('title' ,'') + '''"></td>
      </tr><tr>
        <td>Office:</td>
        <td><input type="text" name="office" size="30" value="''' + user.getvalue('office', '') + '''"></td>
      </tr><tr>
        <td>Work Number:</td>
        <td><input type="text" name="work" size="30" value="''' + user.getvalue('work', '') + '''"></td>
      </tr><tr>
        <td>Home Number:</td>
        <td><input type="text" name="home" size="30" value="''' + user.getvalue('home', '') + '''"></td>
      </tr><tr>
        <td>Mobile Number:</td>
        <td><input type="text" name="mobile" size="30" value="''' + user.getvalue('mobile', '') + '''"></td>
      </tr><tr>
        <td>Fax Number:</td>
        <td><input type="text" name="fax" size="30" value="''' + user.getvalue('fax', '') + '''"></td>
      </tr><tr>
        <td valign="top">Comments:</td>
        <td><textarea name="comments" rows=10 cols=50>''' + user.getvalue('comments', '') + '''</textarea></td>
      </tr>
      <tr>
	<td><input type="submit" value="Save"></td><td align="right"><input id="cancelUser" type="button" value="Cancel" /></td>
      </tr>
      </table>
      </form>
      </div>
      </center>
    ''')
    request.writeln('''</div><br/>
		    <center>
		      <input type="button" id="createUser" value="Add New User" onclick="javascript:editUser();"></input>
		    <center>
		  </div>
		</div>
    ''')
开发者ID:ssaltzman,项目名称:POET,代码行数:80,代码来源:Administrator.py

示例6: send_admin_page

# 需要导入模块: import Directory [as 别名]
# 或者: from Directory import get_user [as 别名]

#.........这里部分代码省略.........
          request.writeln(str(asset.name))
          request.writeln('</td>')
         
          request.writeln('<td align="center" id="actions_td'+str(ctr)+'">') #note if you don't add the ctr var at the end it isn't unigue and weird things happen.
          request.writeln('<a href="#" onclick="window.open(\'' + request.cgi_href(global_rootid=game.id, view='StrikeComAsset', assetid=asset.id) + '\',\'blah\',\'width=400,height=800\')">Edit</a>')
          request.writeln('|')
          request.writeln('<a href="' + request.cgi_href(global_meetingid=game.id, itemid=game.id, gm_action='StrikeCom.delasset', assetid = asset.id, assetname=asset.name) + '">Delete</a>');
          request.writeln('</td><td>')
          
          # team assigned to this asset
          request.writeln(request.cgi_form(gm_action='StrikeCom.assetteam', global_meetingid=game.id, _assetid=asset.id))
          request.writeln('<select name="_teamid" onchange="this.form.submit()">')
          if asset.getvalue('teamid', '') == '':  # make sure this asset is assigned a team
            asset.teamid = teams[0].id
            asset.save()
          for group in teams:
            selected = group.id == asset.teamid and ' selected' or ''
            request.writeln('<option ' + selected + ' value="' + group.id + '">' + group.name + '</option>')
          request.writeln('</select>')        
          request.writeln('</form>')
          
          # team member rights in this asset
          request.writeln('</td><td>')        
          request.writeln(request.cgi_form(gm_action='StrikeCom.assignasset', global_meetingid=game.id, id='assignform', _itemid=asset.id, _assetid=asset.assetid))
          request.writeln('''<table border=1 cellspacing=0 cellpadding=5 id='new_table' id='new_table'>''')
          group = datagate.get_item(asset.teamid)
          
          if group == None:
            group = teams.get_child_items()[0]
          group_ctr = 1
          request.writeln('''<tr><td align='left'>&nbsp;</td><td align='center'><b> <a href='#asset_row' onclick=switchCheckBoxes('see_check'''+str(ctr)+''+str(group_ctr)+'''')>See</a> : <a href='#asset_row' onclick=switchCheckBoxes('move_check'''+str(ctr)+''+str(group_ctr)+'''')>Move</a></b></td></tr>''')
          user_ctr=0
          for member in group:
              user = Directory.get_user(member.user_id) #user is the actual user object.  member is the child of a group
              request.writeln('''<tr><td align='right'>'''+user.name+'''</td>''')
              try:
                  asset.visible_by.index(user.id)
                  request.writeln('''<td align='left'>&nbsp;&nbsp;<input id="see_check'''+str(ctr)+""+str(group_ctr)+""+str(user_ctr)+'''" name="_'''+str(user.id)+''':see"  value='on' checked type='checkbox'> : ''')                    
              except ValueError: #not in the asset yet --> no check                   
                  request.writeln('''<td align='left'>&nbsp;&nbsp;<input id="see_check'''+str(ctr)+""+str(group_ctr)+""+str(user_ctr)+'''" name="_'''+str(user.id)+''':see"  value='on' type='checkbox'> : ''')
              
              try:
                  asset.move_by.index(user.id)
                  request.writeln('''<input id='move_check'''+str(ctr)+""+str(group_ctr)+""+str(user_ctr)+'''' name="_'''+str(user.id)+''':move" value='on' checked type='checkbox'></td></tr>''')
              except ValueError: #not in the asset yet --> no check                   
                  request.writeln('''<input id='move_check'''+str(ctr)+""+str(group_ctr)+""+str(user_ctr)+'''' name="_'''+str(user.id)+''':move" value='on' type='checkbox'></td></tr>''')
              
              user_ctr=user_ctr+1
                          
          request.writeln('''
              <tr><td>&nbsp;</td><td><input type='submit' value='Assign'></td></tr></table></form>
          </tr>''')
          ctr=ctr+1
      
      request.writeln('</table>')
      request.writeln('</center>')
      
  

    ##### Strikecom Teams #####
    request.writeln('<a name="teams"></a><h1>Game Teams:</h1>')
    # groups in this meeting
    groups = datagate.get_child_items(teams.id)
    allusers = Directory.get_users()
    allusers.sort(lambda a,b: cmp(a.username, b.username))
    request.writeln('''
开发者ID:ssaltzman,项目名称:POET,代码行数:70,代码来源:StrikeCom.py


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