Kaydet (Commit) 5cac46dd authored tarafından Jack Diederich's avatar Jack Diederich

* fix issue#7476

üst f2055ae4
...@@ -267,10 +267,13 @@ _safechars = string.ascii_letters + string.digits + '!@%_-+=:,./' # Safe unquote ...@@ -267,10 +267,13 @@ _safechars = string.ascii_letters + string.digits + '!@%_-+=:,./' # Safe unquote
_funnychars = '"`$\\' # Unsafe inside "double quotes" _funnychars = '"`$\\' # Unsafe inside "double quotes"
def quote(file): def quote(file):
''' return a shell-escaped version of the file string '''
for c in file: for c in file:
if c not in _safechars: if c not in _safechars:
break break
else: else:
if not file:
return "''"
return file return file
if '\'' not in file: if '\'' not in file:
return '\'' + file + '\'' return '\'' + file + '\''
......
...@@ -76,6 +76,8 @@ class SimplePipeTests(unittest.TestCase): ...@@ -76,6 +76,8 @@ class SimplePipeTests(unittest.TestCase):
self.assertEqual(pipes.quote("test%s'name'" % u), self.assertEqual(pipes.quote("test%s'name'" % u),
'"test\\%s\'name\'"' % u) '"test\\%s\'name\'"' % u)
self.assertEqual(pipes.quote(''), "''")
def testRepr(self): def testRepr(self):
t = pipes.Template() t = pipes.Template()
self.assertEqual(repr(t), "<Template instance, steps=[]>") self.assertEqual(repr(t), "<Template instance, steps=[]>")
......
...@@ -819,6 +819,7 @@ Dik Winter ...@@ -819,6 +819,7 @@ Dik Winter
Blake Winton Blake Winton
Jean-Claude Wippler Jean-Claude Wippler
Lars Wirzenius Lars Wirzenius
John Wiseman
Chris Withers Chris Withers
Stefan Witzel Stefan Witzel
David Wolever David Wolever
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment