Bugfixes.

This commit is contained in:
Gaetan Delannay 2011-02-28 19:30:17 +01:00
parent 39321b2d38
commit c7633ecc8b
5 changed files with 22 additions and 16 deletions

View file

@ -157,8 +157,7 @@ class ZodbBackuper:
remove the temp files that could not be removed by Zope.'''
w = self.log
w('Removing temp files in "%s"...' % self.tempFolder)
pdfCount = 0
docCount = 0
pdfCount = docCount = rtfCount = odtCount = 0
for fileName in os.listdir(self.tempFolder):
ext = os.path.splitext(fileName)[1]
if ext in self.toRemoveExts:
@ -169,8 +168,8 @@ class ZodbBackuper:
os.remove(fullFileName)
except OSError, oe:
w('Could not remove "%s" (%s).' % (fullFileName, str(oe)))
w('%d PDF document(s) removed.' % pdfCount)
w('%d Word document(s) removed.' % docCount)
w('%d .pdf, %d .doc, %d .rtf and %d .odt file(s) removed.' % \
(pdfCount, docCount, rtfCount, odtCount))
def run(self):
w = self.log

View file

@ -579,7 +579,11 @@ class TranslationClassDescriptor(ClassDescriptor):
width = 0
height = 0
for fileName, poFile in i18nFiles.iteritems():
if not fileName.startswith('%s-' % appName): continue
if not fileName.startswith('%s-' % appName) or \
not i18nFiles[fileName].messagesDict.has_key(messageId):
# In this case this is not one of our Appy-managed translation
# files.
continue
msgContent = i18nFiles[fileName].messagesDict[messageId].msg
# Compute width
width = max(width, len(msgContent))

View file

View file

@ -1,10 +0,0 @@
'''This package contains stuff used at run-time for installing a generated
Plone product.'''
# ------------------------------------------------------------------------------
from appy.gen.plone25.installer import PloneInstaller as Plone25Installer
class PloneInstaller(Plone25Installer):
'''This Plone installer runs every time the generated Plone product is
installed or uninstalled (in the Plone configuration panel).'''
# ------------------------------------------------------------------------------

View file

@ -17,7 +17,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA.
# ------------------------------------------------------------------------------
import os, os.path, re, sys, traceback, unicodedata, shutil
import os, os.path, re, time, sys, traceback, unicodedata, shutil
# ------------------------------------------------------------------------------
class FolderDeleter:
@ -141,6 +141,19 @@ def getOsTempFolder():
raise "Sorry, I can't find a temp folder on your machine."
return res
def getTempFileName(prefix='', extension=''):
'''Returns the absolute path to a unique file name in the OS temp folder.
The caller will then be able to create a file with this name.
A p_prefix to this file can be provided. If an p_extension is provided,
it will be appended to the name. Both dotted and not dotted versions
of p_extension are allowed (ie, ".pdf" or "pdf").'''
res = '%s/%s_%f' % (getOsTempFolder(), prefix, time.time())
if extension:
if extension.startswith('.'): res += extension
else: res += '.' + extension
return res
# ------------------------------------------------------------------------------
def executeCommand(cmd):
'''Executes command p_cmd and returns the content of its stderr.'''