]> khamidou — GitHub mirrors - imapclient.git/commitdiff
Clean up _quote slightly
authorMenno Smits <menno@freshfoo.com>
Tue, 30 Dec 2014 09:30:50 +0000 (22:30 +1300)
committerMenno Smits <menno@freshfoo.com>
Tue, 30 Dec 2014 09:30:50 +0000 (22:30 +1300)
imapclient/imapclient.py

index 8928d142d5625c181dc3db1a022e1aab1aeb18f2..e5b67395922c42afd6e38015f39db3210db62082 100644 (file)
@@ -982,16 +982,16 @@ class IMAPClient(object):
             folder_name = encode_utf7(folder_name)
         return _quote(folder_name)
 
-#XXX revisit
 def _quote(arg):
     if isinstance(arg, text_type):
         arg = arg.replace('\\', '\\\\')
         arg = arg.replace('"', '\\"')
-        return '"%s"' % arg
+        q = '"'
     else:
         arg = arg.replace(b'\\', b'\\\\')
         arg = arg.replace(b'"', b'\\"')
-        return b'"' + arg + b'"'
+        q = b'"'
+    return q + arg + q
 
 # normalise_text_list, seq_to_parentstr etc have to return unicode
 # because imaplib handles flags and sort criteria assuming these are