Created
April 18, 2016 14:55
-
-
Save estan/677ba550cfbe609d9f6babd1e50442f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def save(self, destination=None): | |
"""Save the project to a destination. | |
Args: | |
destination (Archive or str): An archive open for writing or an archive | |
file name. | |
""" | |
if isinstance(destination, Archive): | |
destination.saveFile('project.json', dumps({ | |
'name': self.name | |
}, indent=True)) | |
else: | |
with ZipArchive(destination, 'w') as archive: | |
archive.saveFile('project.json', dumps({ | |
'name': self.name | |
}, indent=True)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment