[PATCHv5 1/7] Replace 2 regexes with a single one

Sebastian Spaeth Sebastian at SSpaeth.de
Thu May 5 14:59:23 BST 2011


No functional changes

Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
---
 offlineimap/repository/LocalStatus.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/offlineimap/repository/LocalStatus.py b/offlineimap/repository/LocalStatus.py
index a4e036b..5cbf77b 100644
--- a/offlineimap/repository/LocalStatus.py
+++ b/offlineimap/repository/LocalStatus.py
@@ -34,8 +34,9 @@ class LocalStatusRepository(BaseRepository):
         return '.'
 
     def getfolderfilename(self, foldername):
-        foldername = re.sub('/\.$', '/dot', foldername)
-        foldername = re.sub('^\.$', 'dot', foldername)
+        """Return the full path of the status file"""
+        # replace with 'dot' if final path name is '.'
+        foldername = re.sub('(^|\/)\.$','\\1dot', foldername)
         return os.path.join(self.directory, foldername)
 
     def makefolder(self, foldername):
-- 
1.7.4.1





More information about the OfflineIMAP-project mailing list