summaryrefslogtreecommitdiff
path: root/rapid/renamesubfolderprefs.py
diff options
context:
space:
mode:
authorJulien Valroff <julien@kirya.net>2011-01-02 07:56:35 +0100
committerJulien Valroff <julien@kirya.net>2011-01-02 07:56:35 +0100
commitac4d6762d811cfe1aa855280323fb46d7d061e45 (patch)
treedc0a496845cb5a47d0390df33b6b3269e5dc9fa4 /rapid/renamesubfolderprefs.py
parent827935bc83a6bf6b6604f94a87253acca3f42574 (diff)
parentd058c9c1092987228355cc748205bb4ad0b49a1a (diff)
Merge commit 'upstream/0.3.4'
Diffstat (limited to 'rapid/renamesubfolderprefs.py')
-rw-r--r--rapid/renamesubfolderprefs.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/rapid/renamesubfolderprefs.py b/rapid/renamesubfolderprefs.py
index 845f809..d46a8c1 100644
--- a/rapid/renamesubfolderprefs.py
+++ b/rapid/renamesubfolderprefs.py
@@ -64,7 +64,6 @@ _ = Configi18n._
import datetime
-import ValidatedEntry
import config
from common import pythonifyVersion
@@ -1456,6 +1455,8 @@ class SubfolderPreferences(ImageRenamePreferences):
self.component = pn.SUBFOLDER_COMPONENT
ImageRenamePreferences.__init__(self, prefList, parent)
+ self.stripExtraneousWhiteSpace = re.compile(r'\s*%s\s*' % os.sep)
+
def generateNameUsingPreferences(self, photo, existingFilename=None,
stripCharacters = False, fallback_date = None):
"""
@@ -1477,6 +1478,10 @@ class SubfolderPreferences(ImageRenamePreferences):
if subfolders:
if subfolders[0] == os.sep:
subfolders = subfolders[1:]
+
+ # remove any spaces before and after a directory name
+ if subfolders and stripCharacters:
+ subfolders = self.stripExtraneousWhiteSpace.sub(os.sep, subfolders)
return subfolders