Example #1
0
    def parseString(self, val):
        """
        Parse config input.
        """

        try:
            splt = val.split(None, 2)
            if len(splt) == 1:
                context = val
                flavor = None
                fltr = None
            elif len(splt) == 2:
                context = splt[0]
                # Note: this split can't handle flavors containing spaces...
                flavorStr = splt[1]
                flavor = CfgFlavor.parseString(self, flavorStr)
                fltr = None
            else:
                context = splt[0]
                flavorStr = splt[1]
                flavor = CfgFlavor.parseString(self, flavorStr)
                # ...but it *can* handle regexes containing spaces:
                fltrStr = ' '.join(splt[2:])
                fltr = CfgRegExp.parseString(self, fltrStr)
            return context, flavor, fltr
        except versions.ParseError, e:
            raise ParseError, e
Example #2
0
    def parseString(self, val):
        """
        Parse config input.
        """

        try:
            splt = val.split(None, 2)
            if len(splt) == 1:
                context = val
                flavor = None
                fltr = None
            elif len(splt) == 2:
                context = splt[0]
                # Note: this split can't handle flavors containing spaces...
                flavorStr = splt[1]
                flavor = CfgFlavor.parseString(self, flavorStr)
                fltr = None
            else:
                context = splt[0]
                flavorStr = splt[1]
                flavor = CfgFlavor.parseString(self, flavorStr)
                # ...but it *can* handle regexes containing spaces:
                fltrStr = ' '.join(splt[2:])
                fltr = CfgRegExp.parseString(self, fltrStr)
            return context, flavor, fltr
        except versions.ParseError, e:
            raise ParseError, e
Example #3
0
    def parseString(self, val):
        """
        Parse config input.
        """

        try:
            splt = val.split()
            if len(splt) == 1:
                context = val
                fltr = None
            else:
                context, fltrStr = splt
                fltr = CfgRegExp.parseString(self, fltrStr)
            return context, fltr
        except versions.ParseError, e:
            raise ParseError, e
Example #4
0
    def parseString(self, val):
        """
        Parse config input.
        """

        try:
            splt = val.split()
            if len(splt) == 1:
                context = val
                fltr = None
            else:
                context, fltrStr = splt
                fltr = CfgRegExp.parseString(self, fltrStr)
            return context, fltr
        except versions.ParseError, e:
            raise ParseError, e