mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2025-12-15 21:32:28 +01:00
Fix zip output file name.
This commit is contained in:
parent
bf52020876
commit
d38360be6b
2 changed files with 12 additions and 12 deletions
2
app.yaml
2
app.yaml
|
|
@ -1,5 +1,5 @@
|
||||||
# fanfictionloader
|
# fanfictionloader
|
||||||
application: ffd-retief
|
application: fanfictionloader
|
||||||
version: 4-0-0
|
version: 4-0-0
|
||||||
runtime: python
|
runtime: python
|
||||||
api_version: 1
|
api_version: 1
|
||||||
|
|
|
||||||
|
|
@ -101,12 +101,18 @@ class BaseStoryWriter(Configurable):
|
||||||
self.story.setMetadata('formatext',self.getFormatExt())
|
self.story.setMetadata('formatext',self.getFormatExt())
|
||||||
|
|
||||||
def getOutputFileName(self):
|
def getOutputFileName(self):
|
||||||
return self.getFileName(self.getConfig('output_filename'))
|
if self.getConfig('zip_output'):
|
||||||
|
return self.getZipFileName()
|
||||||
|
else:
|
||||||
|
return self.getBaseFileName()
|
||||||
|
|
||||||
|
def getBaseFileName(self):
|
||||||
|
return self.formatFileName(self.getConfig('output_filename'))
|
||||||
|
|
||||||
def getZipFileName(self):
|
def getZipFileName(self):
|
||||||
return self.getFileName(self.getConfig('zip_filename'),extension=".zip")
|
return self.formatFileName(self.getConfig('zip_filename'),extension=".zip")
|
||||||
|
|
||||||
def getFileName(self,template,extension="${formatext}"):
|
def formatFileName(self,template,extension="${formatext}"):
|
||||||
values = self.story.metadata
|
values = self.story.metadata
|
||||||
# fall back default:
|
# fall back default:
|
||||||
if not template:
|
if not template:
|
||||||
|
|
@ -179,13 +185,7 @@ class BaseStoryWriter(Configurable):
|
||||||
for tag in self.getConfigList("extratags"):
|
for tag in self.getConfigList("extratags"):
|
||||||
self.story.addToList("extratags",tag)
|
self.story.addToList("extratags",tag)
|
||||||
|
|
||||||
zipfilename=self.getZipFileName()
|
outfilename=self.getOutputFileName()
|
||||||
filename=self.getOutputFileName()
|
|
||||||
|
|
||||||
if self.getConfig('zip_output'):
|
|
||||||
outfilename=zipfilename
|
|
||||||
else:
|
|
||||||
outfilename=filename
|
|
||||||
|
|
||||||
if not outstream:
|
if not outstream:
|
||||||
close=True
|
close=True
|
||||||
|
|
@ -227,7 +227,7 @@ class BaseStoryWriter(Configurable):
|
||||||
out = StringIO.StringIO()
|
out = StringIO.StringIO()
|
||||||
self.writeStoryImpl(out)
|
self.writeStoryImpl(out)
|
||||||
zipout = ZipFile(outstream, 'w', compression=ZIP_DEFLATED)
|
zipout = ZipFile(outstream, 'w', compression=ZIP_DEFLATED)
|
||||||
zipout.writestr(filename,out.getvalue())
|
zipout.writestr(self.getBaseFileName(),out.getvalue())
|
||||||
# declares all the files created by Windows. otherwise, when
|
# declares all the files created by Windows. otherwise, when
|
||||||
# it runs in appengine, windows unzips the files as 000 perms.
|
# it runs in appengine, windows unzips the files as 000 perms.
|
||||||
for zf in zipout.filelist:
|
for zf in zipout.filelist:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue