Esempio n. 1
0
    def save(self, name=None):
        """Save the Package in the specified file.

        We expect that the name is a unicode string.
        """
        if name is None:
            name=self.__uri

        name = uri2path(name)
        # handle .azp files.
        if name.lower().endswith('.azp') or name.endswith('/'):
            # AZP format
            if self.__zip is None:
                # Conversion necessary: we are saving to the new format.
                z=ZipPackage()
                z.new()
                self.__zip = z

            # Save the content.xml (using binary mode since serialize is handling encoding)
            stream = open (self.__zip.getContentsFile(), "wb")
            self.serialize(stream)
            stream.close ()

            # Generate the statistics
            self.__zip.update_statistics(self)

            # Save the whole .azp
            self.__zip.save(name)
        else:
            # Assuming plain XML format
            stream = open (name, "wb")
            self.serialize(stream)
            stream.close ()
Esempio n. 2
0
    def save(self, name=None):
        """Save the Package in the specified file.

        We expect that the name is a unicode string.
        """
        if name is None:
            name=self.__uri

        name = uri2path(name)
        # handle .azp files.
        if name.lower().endswith('.azp') or name.endswith('/'):
            # AZP format
            if self.__zip is None:
                # Conversion necessary: we are saving to the new format.
                z=ZipPackage()
                z.new()
                self.__zip = z

            # Save the content.xml (using binary mode since serialize is handling encoding)
            stream = open (self.__zip.getContentsFile(), "wb")
            self.serialize(stream)
            stream.close ()

            # Generate the statistics
            self.__zip.update_statistics(self)

            # Save the whole .azp
            self.__zip.save(name)
        else:
            # Assuming plain XML format
            stream = open (name, "wb")
            self.serialize(stream)
            stream.close ()
Esempio n. 3
0
    def save(self, name=None):
        """Save the Package in the specified file"""
        if name is None:
            name=self.__uri
        if name.startswith('file:///'):
            name = name[7:]

        if re.match('|/', name):
            # Windows drive: notation. Convert it from
            # a more URI-compatible syntax
            name=urllib.url2pathname(name)

        # handle .azp files.
        if name.lower().endswith('.azp') or name.endswith('/'):
            # AZP format
            if self.__zip is None:
                # Conversion necessary: we are saving to the new format.
                z=ZipPackage()
                z.new()
                self.__zip = z

            # Save the content.xml
            stream = open (self.__zip.getContentsFile(), "w")
            self.serialize(stream)
            stream.close ()

            # Generate the statistics
            self.__zip.update_statistics(self)

            # Save the whole .azp
            self.__zip.save(name)
        else:
            # Assuming plain XML format
            stream = open (name, "w")
            self.serialize(stream)
            stream.close ()
Esempio n. 4
0
    def save(self, name=None):
        """Save the Package in the specified file"""
        if name is None:
            name = self.__uri
        if name.startswith('file:///'):
            name = name[7:]

        if re.match('|/', name):
            # Windows drive: notation. Convert it from
            # a more URI-compatible syntax
            name = urllib.url2pathname(name)

        # handle .azp files.
        if name.lower().endswith('.azp') or name.endswith('/'):
            # AZP format
            if self.__zip is None:
                # Conversion necessary: we are saving to the new format.
                z = ZipPackage()
                z.new()
                self.__zip = z

            # Save the content.xml
            stream = open(self.__zip.getContentsFile(), "w")
            self.serialize(stream)
            stream.close()

            # Generate the statistics
            self.__zip.update_statistics(self)

            # Save the whole .azp
            self.__zip.save(name)
        else:
            # Assuming plain XML format
            stream = open(name, "w")
            self.serialize(stream)
            stream.close()