appy.pod: bugfix when importing images under Windows (https://answers.launchpad.net/appy/+question/171611); appy.gen: bugfix while validating file fields which are mandatory; stopped using uid_catalog and added index 'UID' in portal_catalog; bugfix while searching objects in the limits of a Ref field; display user info in the main template (name, id, roles); when creating an object from a reference, after creation, appy brings the user back to the view page where the Ref field was.

This commit is contained in:
Gaetan Delannay 2011-09-20 19:21:48 +02:00
parent 7ff56a6520
commit 96a592f125
22 changed files with 141 additions and 179 deletions

View file

@ -64,7 +64,7 @@ class DocImporter:
fileContent = self.content.read()
else:
fileContent = self.content
f = file(self.importPath, 'w')
f = file(self.importPath, 'wb')
f.write(fileContent)
f.close()
@ -181,7 +181,9 @@ class ImageImporter(DocImporter):
externally.'''
anchorTypes = ('page', 'paragraph', 'char', 'as-char')
WRONG_ANCHOR = 'Wrong anchor. Valid values for anchors are: %s.'
def getImportFolder(self): return '%s/unzip/Pictures' % self.tempFolder
pictFolder = '%sPictures%s' % (os.sep, os.sep)
def getImportFolder(self):
return os.path.join(self.tempFolder, 'unzip', 'Pictures')
def moveFile(self, at, importPath):
'''Copies file at p_at into the ODT file at p_importPath.'''
@ -189,7 +191,7 @@ class ImageImporter(DocImporter):
for imagePath, imageAt in self.fileNames.iteritems():
if imageAt == at:
# Yes!
i = importPath.rfind('/Pictures/') + 1
i = importPath.rfind(self.pictFolder) + 1
return importPath[:i] + imagePath
# If I am here, the image has not already been imported: copy it.
shutil.copy(at, importPath)
@ -208,8 +210,8 @@ class ImageImporter(DocImporter):
s = self.svgNs
imageName = 'Image%f' % time.time()
# Compute path to image
i = self.importPath.rfind('/Pictures/')
imagePath = self.importPath[i+1:]
i = self.importPath.rfind(self.pictFolder)
imagePath = self.importPath[i+1:].replace('\\', '/')
self.fileNames[imagePath] = self.at
# Compute image size
width, height = getSize(self.importPath, self.format)