Skip to content

Instantly share code, notes, and snippets.

@estan
Created April 18, 2016 14:55
Show Gist options
  • Save estan/677ba550cfbe609d9f6babd1e50442f2 to your computer and use it in GitHub Desktop.
Save estan/677ba550cfbe609d9f6babd1e50442f2 to your computer and use it in GitHub Desktop.
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