コード例 #1
0
ファイル: acl.py プロジェクト: paxswill/brave-core
 def target_objects(self):
     if self.kind == 'c':
         return EVECharacter.objects(identifier__in=self.ids)
     elif self.kind == 'o':
         return EVECorporation.objects(identifier__in=self.ids)
     elif self.kind == 'a':
         return EVEAlliance.objects(identifier__in=self.ids)
コード例 #2
0
ファイル: acl.py プロジェクト: paxswill/brave-core
 def target_objects(self):
     if self.kind == 'c':
         return EVECharacter.objects(identifier__in=self.ids)
     elif self.kind == 'o':
         return EVECorporation.objects(identifier__in=self.ids)
     elif self.kind == 'a':
         return EVEAlliance.objects(identifier__in=self.ids)
コード例 #3
0
    def post(self,
             character=None,
             charMethod=None,
             alliance=None,
             corporation=None,
             group=None):

        # Have to be an admin to access admin pages.
        if not is_administrator:
            raise HTTPNotFound()

        # Seed the initial results.
        chars = EVECharacter.objects()

        # Go through and check all of the possible posted values

        # Limit chars to the character name entered.
        if character:
            if charMethod == 'contains':
                chars = chars.filter(name__icontains=character)
            elif charMethod == 'starts':
                chars = chars.filter(name__istartswith=character)
            elif charMethod == 'is':
                chars = chars.filter(name__iexact=character)
            else:
                return 'json:', dict(
                    success=False,
                    message=_("You broke the web page. Good Job."))

        # Limit to characters in the specified alliance.
        if alliance:
            alliance = EVEAlliance.objects(name=alliance).first()
            chars = chars.filter(alliance=alliance)

        # Limit to characters in the specified corporation.
        if corporation:
            corporation = EVECorporation.objects(name=corporation).first()
            chars = chars.filter(corporation=corporation)

        # Limit to characters in the specified group.
        if group:
            groupList = []
            for c in chars:
                if group in c.tags:
                    groupList.append(c.id)

            chars = chars.filter(id__in=groupList)

        return 'brave.core.admin.template.searchChar', dict(area='admin',
                                                            result=chars,
                                                            success=True)
コード例 #4
0
ファイル: controller.py プロジェクト: Acen/core
 def post(self, character=None, charMethod=None, alliance=None, corporation=None, group=None):
     
     # Have to be an admin to access admin pages.            
     if not is_administrator:
         raise HTTPNotFound()
     
     # Seed the initial results.
     chars = EVECharacter.objects()
         
     # Go through and check all of the possible posted values
     
     # Limit chars to the character name entered.
     if character:
         if charMethod == 'contains':
             chars = chars.filter(name__icontains=character)
         elif charMethod == 'starts':
             chars = chars.filter(name__istartswith=character)
         elif charMethod == 'is':
             chars = chars.filter(name__iexact=character)
         else:
             return 'json:', dict(success=False, message=_("You broke the web page. Good Job."))
     
     # Limit to characters in the specified alliance.
     if alliance:
         alliance = EVEAlliance.objects(name=alliance).first()
         chars = chars.filter(alliance=alliance)
     
     # Limit to characters in the specified corporation.
     if corporation:
         corporation = EVECorporation.objects(name=corporation).first()
         chars = chars.filter(corporation=corporation)
     
     # Limit to characters in the specified group.
     if group:
         groupList = []
         for c in chars:
             if group in c.tags:
                 groupList.append(c.id)
                 
         chars = chars.filter(id__in=groupList)
         
     return 'brave.core.admin.template.searchChar', dict(area='admin', result=chars, success=True)