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


Python Directory.get_group方法代码示例

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


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

示例1: send_main_frames

# 需要导入模块: import Directory [as 别名]
# 或者: from Directory import get_group [as 别名]
 def send_main_frames(self, request):
   # get the game objects
   game = datagate.get_item(request.getvalue('global_rootid'))
   teams = game.search1(name='groups')
   team = Directory.get_group(game.id, request.session.user.id)
   if not team:
     raise 'You have not been added to a team in this game.'
   try: 
     chats = game.search1(name='chats') # just use first team's chat for now -- eventually we want to see what team the user is on and link to the chat parent for that team
   except IndexError:
     raise 'You cannot play a StrikeCom game without any teams.  Please add at least one team and try again.'
   chat = chats.search1(name=team.name)
   board = game.search1(name='board')
   turns = game.search1(name='turns')
   
   # send the html
   request.writeln(HTML_HEAD_NO_CLOSE)
   request.writeln('''
     </head>
     <frameset border="0" rows="45,*">
       <frame marginheight="0" marginwidth="0" scrolling="no" name="navigation" src="''' + request.cgi_href(subview='navigation') + '''">
       <frame marginheight="0" marginwidth="0" scrolling="no" name="game" src="''' + request.cgi_href(subview='game') + '''">
     </frameset>
     </html>
   ''')
开发者ID:ssaltzman,项目名称:POET,代码行数:27,代码来源:StrikeCom.py

示例2: send_game

# 需要导入模块: import Directory [as 别名]
# 或者: from Directory import get_group [as 别名]
  def send_game(self, request):
    '''Shows the game window'''
    # get the game objects
    game = datagate.get_item(request.getvalue('global_rootid'))
    teams = game.search1(name='groups')
    team = Directory.get_group(game.id, request.session.user.id)
    if not team:
      raise 'You have not been added to a team in this game.'
    try: 
      chats = game.search1(name='chats') # just use first team's chat for now -- eventually we want to see what team the user is on and link to the chat parent for that team
    except IndexError:
      raise 'You cannot play a StrikeCom game without any teams.  Please add at least one team and try again.'
    chat = chats.search1(name=team.name)
    board = game.search1(name='board')
    turns = game.search1(name='turns')

    request.writeln(HTML_HEAD)
    request.writeln('''
      <frameset border="0" cols="*,200">  
        <frameset border="0" rows="*,50">
          <frame marginheight="0" marginwidth="0" name="playingboard" src="''' + request.cgi_href(global_rootid=turns.id, view='StrikeComPlayingBoard', frame=None) + '''">
          <frame scrolling="no" marginheight="0" marginwidth="0" name="legend" src="''' + request.cgi_href(view='StrikeComLegend', frame=None) + '''">
        </frameset>
        <frame scrolling="no" marginheight="0" marginwidth="0" name="chat" src="''' + request.cgi_href(global_rootid=chat.id, view='StrikeComCommenter', frame=None) + '''">
      </frameset>
    ''')    
开发者ID:ssaltzman,项目名称:POET,代码行数:28,代码来源:StrikeCom.py

示例3: send_content

# 需要导入模块: import Directory [as 别名]
# 或者: from Directory import get_group [as 别名]
  def send_content(self, request):
    '''Main loop for this view'''
    # get the meetings this user is in
    if request.session.user.superuser == '1':
      #the superuser gets sent straight to the Administrator page
      #pm_meetings = Directory.get_meetings()
      #meetings = []
      self.forward_to_superuser(request)

    
    else:
      pm_meetings = []
      meetings = []
      for meeting in Directory.get_meetings():               
        if Directory.get_group(meeting.id, request.session.user.id) != None:
          if self.user_is_pm(meeting, request.session.user.id):
            pm_meetings.append(meeting)
          else:
            meetings.append(meeting)
    
      # send to the appropriate page
      if len(meetings)+len(pm_meetings) == 0: #and request.session.user.superuser != '1': #superuser is now redirected before this line
        self.no_meetings(request)
      
      elif len(meetings)+len(pm_meetings) == 1: #and request.session.user.superuser != '1': #superuser is now redirected before this line
        if len(meetings) == 1:
          self.forward_to_meeting(request, meetings[0])
        else:
          #self.forward_to_meeting(request, pm_meetings[0])
	  self.forward_to_pm(request, pm_meetings[0])
      
      else:
        self.show_meetings(request, meetings, pm_meetings)
开发者ID:ssaltzman,项目名称:POET,代码行数:35,代码来源:MeetingChooser.py

示例4: get_user_rights

# 需要导入模块: import Directory [as 别名]
# 或者: from Directory import get_group [as 别名]
  def get_user_rights(self, request, activity=None):
    '''Returns the current user's rights for the given activity, or None if not found'''
    # is this the superuser?
    rights = {}
    if request.session.user.superuser == '1':
      for right in self.rights_list:
        rights[right] = 1
      return rights

    # compile them up for regular users 
    if activity == None:     
      activity = datagate.get_item(request.getvalue('global_rootid', ''))    
    if hasattr(activity, 'linkitemid'): # the group rights might be stored in a linked item
      activity = datagate.get_item(activity.linkitemid)
    meeting = datagate.get_item(request.getvalue('global_meetingid', ''))
    group = Directory.get_group(meeting.id, request.session.user.id)
    for right in self.rights_list:
      key = 'groupright_' + group.name + '_' + right
      if hasattr(activity, key) and getattr(activity, key) == '1':
        rights[right] = 1
      else:
        rights[right] = 0
    return rights 
开发者ID:ssaltzman,项目名称:POET,代码行数:25,代码来源:BaseView.py


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