equal
deleted
inserted
replaced
20 __docformat__ = "restructuredtext en" |
20 __docformat__ = "restructuredtext en" |
21 |
21 |
22 import time |
22 import time |
23 import random |
23 import random |
24 import base64 |
24 import base64 |
25 import urllib |
|
26 from StringIO import StringIO |
25 from StringIO import StringIO |
27 from hashlib import sha1 # pylint: disable=E0611 |
26 from hashlib import sha1 # pylint: disable=E0611 |
28 from Cookie import SimpleCookie |
27 from Cookie import SimpleCookie |
29 from calendar import timegm |
28 from calendar import timegm |
30 from datetime import date, datetime |
29 from datetime import date, datetime |
31 from urlparse import urlsplit |
|
32 import httplib |
30 import httplib |
33 from warnings import warn |
31 from warnings import warn |
|
32 |
|
33 from six.moves.urllib.parse import urlsplit, quote as urlquote |
34 |
34 |
35 from rql.utils import rqlvar_maker |
35 from rql.utils import rqlvar_maker |
36 |
36 |
37 from logilab.common.decorators import cached |
37 from logilab.common.decorators import cached |
38 from logilab.common.deprecation import deprecated |
38 from logilab.common.deprecation import deprecated |
578 # see http://greenbytes.de/tech/tc2231/#attwithfilenameandextparamescaped |
578 # see http://greenbytes.de/tech/tc2231/#attwithfilenameandextparamescaped |
579 ascii_filename = ascii_filename.replace('\x5c', r'\\').replace('"', r'\"') |
579 ascii_filename = ascii_filename.replace('\x5c', r'\\').replace('"', r'\"') |
580 header.append('filename="%s"' % ascii_filename) |
580 header.append('filename="%s"' % ascii_filename) |
581 if unicode_filename is not None: |
581 if unicode_filename is not None: |
582 # encoded filename according RFC5987 |
582 # encoded filename according RFC5987 |
583 urlquoted_filename = urllib.quote(unicode_filename.encode('utf-8'), '') |
583 urlquoted_filename = urlquote(unicode_filename.encode('utf-8'), '') |
584 header.append("filename*=utf-8''" + urlquoted_filename) |
584 header.append("filename*=utf-8''" + urlquoted_filename) |
585 self.set_header('content-disposition', ';'.join(header)) |
585 self.set_header('content-disposition', ';'.join(header)) |
586 |
586 |
587 # high level methods for HTML headers management ########################## |
587 # high level methods for HTML headers management ########################## |
588 |
588 |