示例#1
0
    def FromXml2(self, Item, Key):
        if Item is None:
            return None

        NewItem = XmlNode(Item, '%s/Header' % Key)
        self.Header.FromXml(NewItem, 'Header')

        for SubItem in XmlList(Item, '%s/Filename' % Key):
            Filename = XmlElement(SubItem, '%s/Filename' % Key)
            Executable = \
            XmlAttribute(XmlNode(SubItem, '%s/Filename' % Key), 'Executable')
            OsType = XmlAttribute(XmlNode(SubItem, '%s/Filename' % Key), 'OS')
            if Executable.upper() == "TRUE":
                Executable = True
            else:
                Executable = False
            self.Files.append([Filename, Executable, OsType])

        MiscFile = MiscFileObject()
        MiscFile.SetName(self.Header.Name)
        MiscFile.SetCopyright(self.Header.Copyright)
        MiscFile.SetLicense(self.Header.License)
        MiscFile.SetAbstract(self.Header.Abstract)
        MiscFile.SetDescription(self.Header.Description)
        MiscFileList = []
        for File in self.Files:
            FileObj = FileObject()
            FileObj.SetURI(File[0])
            FileObj.SetExecutable(File[1])
            FileObj.SetOS(File[2])
            MiscFileList.append(FileObj)
        MiscFile.SetFileList(MiscFileList)

        return MiscFile
示例#2
0
 def FromXml(self, Item, Key):
     if not Item:
         return None
     self.Header.FromXml(Item, Key)
     NewItem = XmlNode(Item, '%s/Header' % Key)
     self.Header.FromXml(NewItem, 'Header')
     for SubItem in XmlList(Item, '%s/Filename' % Key):
         Filename = XmlElement(SubItem, '%s/Filename' % Key)
         Executable = XmlAttribute(XmlNode(SubItem, '%s/Filename' % Key),
                                   'Executable')
         if Executable.upper() == "TRUE":
             Executable = True
         elif Executable.upper() == "FALSE":
             Executable = False
         else:
             Executable = ''
         self.Files.append([Filename, Executable])
     MiscFile = MiscFileObject()
     MiscFile.SetCopyright(self.Header.CopyrightList)
     MiscFile.SetLicense(self.Header.LicenseList)
     MiscFile.SetAbstract(self.Header.AbstractList)
     MiscFile.SetDescription(self.Header.DescriptionList)
     MiscFileList = []
     for File in self.Files:
         FileObj = FileObject()
         FileObj.SetURI(File[0])
         FileObj.SetExecutable(File[1])
         MiscFileList.append(FileObj)
     MiscFile.SetFileList(MiscFileList)
     return MiscFile