appy.bin: updated publish.py, that is now able to generate a DistUtils tar.gz for Appy; publish.py can now be called with option '-s' (silent): in this mode no question is asked to the user, default values are used; updated new.py that generates a better Plone4-ready simple Zope instance; appy: moved FileWrapper from appy.gen.utils to appy.shared.utils to avoid circular package dependencies; appy.gen: use of .pyt extensions for template Python classes in appy.gen.templates in order to avoid byte-compilation errors when distutils installs the package; appy.pod: when using function 'document' in 'from' statements, first arg can now be a appy.shared.utils.FileWrapper instance.

This commit is contained in:
Gaetan Delannay 2011-12-15 22:56:53 +01:00
parent e78cf62694
commit 6ece750d9a
15 changed files with 237 additions and 210 deletions

View file

@ -20,6 +20,7 @@
import os, os.path, time, shutil, struct, random
from appy.pod import PodError
from appy.pod.odf_parser import OdfEnvironment
from appy.shared.utils import FileWrapper
# ------------------------------------------------------------------------------
FILE_NOT_FOUND = "'%s' does not exist or is not a file."
@ -59,9 +60,12 @@ class DocImporter:
self.importPath = self.moveFile(at, self.importPath)
else:
# We need to dump the file content (in self.content) in a temp file
# first. self.content may be binary or a file handler.
# first. self.content may be binary, a file handler or a
# FileWrapper.
if isinstance(self.content, file):
fileContent = self.content.read()
elif isinstance(self.content, FileWrapper):
fileContent = content.content
else:
fileContent = self.content
f = file(self.importPath, 'wb')