mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
* fix issue#7476
This commit is contained in:
parent
f2055ae43d
commit
5cac46dd41
3 changed files with 6 additions and 0 deletions
|
@ -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 + '\''
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue