[Python-checkins] r78339 - in python/trunk: Lib/pipes.py Lib/test/test_pipes.py Misc/ACKS
jack.diederich
python-checkins at python.org
Mon Feb 22 22:27:38 CET 2010
Author: jack.diederich
Date: Mon Feb 22 22:27:38 2010
New Revision: 78339
Log:
* fix issue#7476
Modified:
python/trunk/Lib/pipes.py
python/trunk/Lib/test/test_pipes.py
python/trunk/Misc/ACKS
Modified: python/trunk/Lib/pipes.py
==============================================================================
--- python/trunk/Lib/pipes.py (original)
+++ python/trunk/Lib/pipes.py Mon Feb 22 22:27:38 2010
@@ -267,10 +267,13 @@
_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 + '\''
Modified: python/trunk/Lib/test/test_pipes.py
==============================================================================
--- python/trunk/Lib/test/test_pipes.py (original)
+++ python/trunk/Lib/test/test_pipes.py Mon Feb 22 22:27:38 2010
@@ -76,6 +76,8 @@
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=[]>")
Modified: python/trunk/Misc/ACKS
==============================================================================
--- python/trunk/Misc/ACKS (original)
+++ python/trunk/Misc/ACKS Mon Feb 22 22:27:38 2010
@@ -819,6 +819,7 @@
Blake Winton
Jean-Claude Wippler
Lars Wirzenius
+John Wiseman
Chris Withers
Stefan Witzel
David Wolever
More information about the Python-checkins
mailing list