diff options
author | Jack Diederich <jackdied@gmail.com> | 2010-02-22 21:27:38 (GMT) |
---|---|---|
committer | Jack Diederich <jackdied@gmail.com> | 2010-02-22 21:27:38 (GMT) |
commit | 5cac46dd413766411dc12758d53b6a7e6b691171 (patch) | |
tree | 547964521be128e31195247a75811adfa3355b47 | |
parent | f2055ae43d25013d9e7b74c2cf23128b28229557 (diff) | |
download | cpython-5cac46dd413766411dc12758d53b6a7e6b691171.zip cpython-5cac46dd413766411dc12758d53b6a7e6b691171.tar.gz cpython-5cac46dd413766411dc12758d53b6a7e6b691171.tar.bz2 |
* fix issue#7476
-rw-r--r-- | Lib/pipes.py | 3 | ||||
-rw-r--r-- | Lib/test/test_pipes.py | 2 | ||||
-rw-r--r-- | Misc/ACKS | 1 |
3 files changed, 6 insertions, 0 deletions
diff --git a/Lib/pipes.py b/Lib/pipes.py index 6dcc997..25e9915 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 d1053e8..a638598 100644 --- a/Lib/test/test_pipes.py +++ b/Lib/test/test_pipes.py @@ -76,6 +76,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), "<Template instance, steps=[]>") @@ -819,6 +819,7 @@ Dik Winter Blake Winton Jean-Claude Wippler Lars Wirzenius +John Wiseman Chris Withers Stefan Witzel David Wolever |