Introduce tostring function

This commit is contained in:
Nicolas Duhamel 2011-04-11 19:53:25 +02:00 committed by Romain Bignon
commit 0f53a02947
2 changed files with 7 additions and 2 deletions

View file

@ -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]

View file

@ -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)