예제 #1
0
파일: models.py 프로젝트: Kays/cia-vc
    def syncFromServer(self):
        """Update this Bot from the RPC server, if necessary.
           Right now the only task this performs is to store the
           server's ruleset if filterMode is 'unknown'.
           """
        if self.filter_mode != FILTER.UNKNOWN:
            return

        ruleset = self._loadRuleset()
        if not ruleset:
            # If there's no ruleset, mark the bot as inactive.
            self.filter_mode = FILTER.INACTIVE
            self.save()
            return

        # Parse the ruleset using LibCIA's XML library
        from LibCIA import XML
        dom = XML.parseString(ruleset)

        # XXX: We should try to reduce the ruleset to one of
        #      the other FILTER.* modes if possible. For now,
        #      we'll always import existing rulesets as
        #      FILTER.CUSTOM.

        # Flatten the contents of the <ruleset> element, clean up
        # the resulting text, and save that as a custom filter.

        text = ''.join([n.toxml() for n in dom.documentElement.childNodes])
        self.filter_mode = FILTER.CUSTOM
        self.custom_ruleset = clean_up_text(text)
        self.save()
예제 #2
0
파일: Commit.py 프로젝트: Kays/cia-vc
 def param_noColor(self, tag):
     """The <noColor> parameter disables colors.
        This is equivalent to a <format> parameter with CommitFormatter's
        default component tree.
        """
     self.componentTree = XML.parseString(CommitFormatter.defaultComponentTree
                                          ).documentElement
예제 #3
0
파일: Commit.py 프로젝트: scanlime/cia-vc
 def param_noColor(self, tag):
     """The <noColor> parameter disables colors.
        This is equivalent to a <format> parameter with CommitFormatter's
        default component tree.
        """
     self.componentTree = XML.parseString(
         CommitFormatter.defaultComponentTree).documentElement
예제 #4
0
파일: models.py 프로젝트: scanlime/cia-vc
    def syncFromServer(self):
        """Update this Bot from the RPC server, if necessary.
           Right now the only task this performs is to store the
           server's ruleset if filterMode is 'unknown'.
           """
        if self.filter_mode != FILTER.UNKNOWN:
            return

        ruleset = self._loadRuleset()
        if not ruleset:
            # If there's no ruleset, mark the bot as inactive.
            self.filter_mode = FILTER.INACTIVE
            self.save()
            return

        # Parse the ruleset using LibCIA's XML library
        from LibCIA import XML
        dom = XML.parseString(ruleset)

        # XXX: We should try to reduce the ruleset to one of
        #      the other FILTER.* modes if possible. For now,
        #      we'll always import existing rulesets as
        #      FILTER.CUSTOM.

        # Flatten the contents of the <ruleset> element, clean up
        # the resulting text, and save that as a custom filter.

        text = ''.join([n.toxml() for n in dom.documentElement.childNodes])
        self.filter_mode = FILTER.CUSTOM
        self.custom_ruleset = clean_up_text(text)
        self.save()
예제 #5
0
파일: Info.py 프로젝트: Kays/cia-vc
 def getSvnRevision(self):
     """Return the current Subversion repository revision, or None
        if we're not in an svn working copy or it can't be parsed.
        """
     try:
         entries = XML.parseString(open(".svn/entries").read()).documentElement
         highestRev = 0
         for tag in XML.getChildElements(entries):
             if tag.nodeName == 'entry':
                 rev = tag.getAttributeNS(None, 'committed-rev')
                 if rev and rev > highestRev:
                     highestRev = rev
         return highestRev
     except:
         return None