Example #1
0
    def parseAttributes(self, filename, name, folder=""):
        """ Parse attribute dict from plugin"""
        data = open(filename, "rb")
        content = data.read()
        data.close()

        attrs = BaseAttributes()
        for m in self.BUILTIN.findall(content) + self.SINGLE.findall(content) + self.parseMultiLine(content):
            #replace gettext function and eval result
            try:
                attrs[m[0]] = literal_eval(m[-1].replace("_(", "("))
            except Exception, e:
                self.logDebug(folder, name, "Error when parsing: %s" % m[-1])
                self.log.debug(str(e))

            if not hasattr(Base, "__%s__" % m[0]):
                #TODO remove type from all plugins, its not needed
                if m[0] != "type" and m[0] != "author_name":
                    self.logDebug(folder, name, "Unknown attribute '%s'" % m[0])
Example #2
0
    def parseAttributes(self, filename, name, folder=""):
        """ Parse attribute dict from plugin"""
        data = open(filename, "rb")
        content = data.read()
        data.close()

        attrs = {}
        for m in self.BUILTIN.findall(content) + self.SINGLE.findall(content) + self.MULTI.findall(content):
            #replace gettext function and eval result
            try:
                attrs[m[0]] = literal_eval(m[-1].replace("_(", "("))
            except:
                self.logDebug(folder, name, "Error when parsing: %s" % m[-1])
                self.core.print_exc()

            if not hasattr(Base, "__%s__" % m[0]):
                if m[0] != "type": #TODO remove type from all plugins, its not needed
                    self.logDebug(folder, name, "Unknown attribute '%s'" % m[0])

        return attrs
Example #3
0
    def parseAttributes(self, filename, name, folder=""):
        """ Parse attribute dict from plugin"""
        data = open(filename, "rb")
        content = data.read()
        data.close()

        attrs = BaseAttributes()
        for m in self.BUILTIN.findall(content) + self.SINGLE.findall(
                content) + self.parseMultiLine(content):
            #replace gettext function and eval result
            try:
                attrs[m[0]] = literal_eval(m[-1].replace("_(", "("))
            except Exception, e:
                self.logDebug(folder, name, "Error when parsing: %s" % m[-1])
                self.log.debug(str(e))

            if not hasattr(Base, "__%s__" % m[0]):
                #TODO remove type from all plugins, its not needed
                if m[0] != "type" and m[0] != "author_name":
                    self.logDebug(folder, name,
                                  "Unknown attribute '%s'" % m[0])
Example #4
0
    def parseAttributes(self, filename, name, folder=""):
        """ Parse attribute dict from plugin"""
        data = open(filename, "rb")
        content = data.read()
        data.close()

        attrs = {}
        for m in self.BUILTIN.findall(content) + self.SINGLE.findall(
                content) + self.MULTI.findall(content):
            #replace gettext function and eval result
            try:
                attrs[m[0]] = literal_eval(m[-1].replace("_(", "("))
            except:
                self.logDebug(folder, name, "Error when parsing: %s" % m[-1])
                self.core.print_exc()

            if not hasattr(Base, "__%s__" % m[0]):
                if m[0] != "type":  #TODO remove type from all plugins, its not needed
                    self.logDebug(folder, name,
                                  "Unknown attribute '%s'" % m[0])

        return attrs