From: Jack Diederich Date: Mon, 22 Feb 2010 22:31:00 +0000 (+0000) Subject: Merged revisions 78339 via svnmerge from X-Git-Tag: v2.6.5rc1~47 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c65d55fc3f8ab248fc896061111f32b28fb31b9f;p=thirdparty%2FPython%2Fcpython.git Merged revisions 78339 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r78339 | jack.diederich | 2010-02-22 16:27:38 -0500 (Mon, 22 Feb 2010) | 1 line * fix issue#7476 ........ --- diff --git a/Lib/pipes.py b/Lib/pipes.py index 6dcc997b4c73..25e99159b8a1 100644 --- a/Lib/pipes.py +++ b/Lib/pipes.py @@ -267,10 +267,13 @@ _safechars = string.ascii_letters + string.digits + '!@%_-+=:,./' # Safe unquote _funnychars = '"`$\\' # Unsafe inside "double quotes" def quote(file): + ''' return a shell-escaped version of the file string ''' for c in file: if c not in _safechars: break else: + if not file: + return "''" return file if '\'' not in file: return '\'' + file + '\'' diff --git a/Lib/test/test_pipes.py b/Lib/test/test_pipes.py index 0eca8edf102e..dd1cc9e952ed 100644 --- a/Lib/test/test_pipes.py +++ b/Lib/test/test_pipes.py @@ -74,6 +74,8 @@ class SimplePipeTests(unittest.TestCase): self.assertEqual(pipes.quote("test%s'name'" % u), '"test\\%s\'name\'"' % u) + self.assertEqual(pipes.quote(''), "''") + def testRepr(self): t = pipes.Template() self.assertEqual(repr(t), "