From 0f53a029474859c27cef98f8fb3fcf8617869ed2 Mon Sep 17 00:00:00 2001 From: Nicolas Duhamel Date: Mon, 11 Apr 2011 19:53:25 +0200 Subject: [PATCH] Introduce tostring function --- weboob/applications/videoob/videoob.py | 4 ++-- weboob/tools/path.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/weboob/applications/videoob/videoob.py b/weboob/applications/videoob/videoob.py index c12acbaf..1b1e7619 100644 --- a/weboob/applications/videoob/videoob.py +++ b/weboob/applications/videoob/videoob.py @@ -295,11 +295,11 @@ class Videoob(ReplApplication): self.working_path.restore() return 1 except CollectionNotFound: - print >>sys.stderr, "Path: %s not found" % ('/'+'/'.join(req_path)) + print >>sys.stderr, "Path: %s not found" % self.working_path.tostring() self.working_path.restore() return 1 - self.prompt = '%s:%s> ' % (self.APPNAME, '/' + '/'.join(req_path)) + self.prompt = '%s:%s> ' % (self.APPNAME, self.working_path.tostring() ) def complete_cd(self, text, line, begidx, endidx): mline = line.partition(' ')[2] diff --git a/weboob/tools/path.py b/weboob/tools/path.py index 3f0d1246..dd0df6ba 100644 --- a/weboob/tools/path.py +++ b/weboob/tools/path.py @@ -54,3 +54,8 @@ class Path(object): def get(self): return copy.copy(self._working_path) + + def tostring(self): + escape = lambda s: s.replace('/', '\/') + path = map(escape, self._working_path) + return '/' + '/'.join(path)