mirror of
https://github.com/python/cpython.git
synced 2025-08-15 06:10:47 +00:00
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 ........
This commit is contained in:
parent
0c01ad3525
commit
c65d55fc3f
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"
|
_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 + '\''
|
||||||
|
|
|
@ -74,6 +74,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=[]>")
|
||||||
|
|
|
@ -778,6 +778,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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue