Ignore:
Timestamp:
Mar 19, 2014, 11:11:30 AM (11 years ago)
Author:
dmik
Message:

python: Update vendor to 2.7.6.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/vendor/current/Lib/pipes.py

    r2 r388  
    5555To create a new template object initialized to a given one:
    5656   t2 = t.clone()
    57 
    58 For an example, see the function test() at the end of the file.
    5957"""                                     # '
    6058
     
    264262# Reliably quote a string as a single argument for /bin/sh
    265263
    266 _safechars = string.ascii_letters + string.digits + '!@%_-+=:,./' # Safe unquoted
    267 _funnychars = '"`$\\'                           # Unsafe inside "double quotes"
     264# Safe unquoted
     265_safechars = frozenset(string.ascii_letters + string.digits + '@%_-+=:,./')
    268266
    269267def quote(file):
    270     ''' return a shell-escaped version of the file string '''
     268    """Return a shell-escaped version of the file string."""
    271269    for c in file:
    272270        if c not in _safechars:
     
    276274            return "''"
    277275        return file
    278     if '\'' not in file:
    279         return '\'' + file + '\''
    280     res = ''
    281     for c in file:
    282         if c in _funnychars:
    283             c = '\\' + c
    284         res = res + c
    285     return '"' + res + '"'
     276    # use single quotes, and put single quotes into double quotes
     277    # the string $'b is then quoted as '$'"'"'b'
     278    return "'" + file.replace("'", "'\"'\"'") + "'"
Note: See TracChangeset for help on using the changeset viewer.