[PATCH 2/9] Re: Replace 2 regexes with a single one

Nicolas Sebrecht nicolas.s-dev at laposte.net
Tue Apr 26 16:54:31 UTC 2011


On Tue, Apr 26, 2011 at 12:31:33PM +0200, Sebastian Spaeth wrote:
> 
> 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)

Why are dots a problem only at the _end_ of the foldername?

-- 
Nicolas Sebrecht



More information about the OfflineIMAP-project mailing list