summaryrefslogtreecommitdiff
path: root/paste
Commit message (Collapse)AuthorAgeFilesLines
* Augment use of imp with importlib.util (#76)Chris Dent2023-04-301-10/+25
| | | | | | | | | | | | | | | | | | imp is deprecated and will go away in Python 3.12 (which is very soon). The preferred replacement is importlib. However, importlib is not available in Python 2.7, so we want to keep both in order to maintain 2.7 some semblance of 2.7 support. This implementation is based on the importlib docs [1] and passes the quite robust tests that are already present for the urlparser module. Unfortunately there's no good way to be 100% certain that this works for all the many ways that Paste can do an import. So this patch is mostly hoping that test coverage is sufficient. [1] https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly Fixes #75
* Fix py3 compatibility in paste.wsgilib.catch_errors (#70)Colin Watson2022-08-181-1/+1
| | | | | | | A Python 3 application might only define `__next__`, not `next`. Use `six.next` instead. This is very similar to https://github.com/cdent/paste/pull/53, and was apparently missed there.
* Replace deprecated threading aliases (#69)Hugo van Kemenade2022-06-223-19/+19
|
* Wsgi.errors is text (#62)Dave Brondsema2020-10-126-11/+4
| | | | | * Update next() to work with py3 * wsgi.errors is supposed to be text, fixes ErrorMiddleware on py3
* Fix AuthBasicAuthenticator base64 decoding to work on py3 (#61)Dave Brondsema2020-10-121-1/+3
|
* Remove deprecated imports (#59)jhance2020-09-241-10/+1
| | | | | The BaseCookie import is cleaned up to use six. Where splittype and splithost are used the returned values are not, so they can go away.
* Patching auth ticket to be python3 compatible (#56)TilmanSchaefer2020-07-221-7/+7
| | | * Patching auth ticket to be python3 compatible
* Py3-compat middleware.py's make_table's item sort (#55)Amit Markel2020-07-141-2/+1
| | | In py2 an array is created and sorted, and in py3 an array of the items needs to be realized in the same fashion hence the sorted(•) fix. Otherwise the code will fail on Python 3 since dict.items() returns a view on the items which doesn't have a .sort() method.
* Make next handling in wsgilib more py3-compatible (#53)jhance2020-06-031-4/+4
| | | | | If the app-iterator being passed in is not defining `next()` (e.g. running under py3 and only defined `__next__`), this will currently crash. Fix by using `six.next` which will use `__next__` or `next` as appropriate.
* add ipv6 support by setting address family (#50)Lekinho2020-02-121-1/+27
| | | * add ipv6 support by setting address family
* add six to check for python 2 or 3 specific implementation (#48)Thomas Cross2020-01-281-2/+4
| | | | | | | | * StringIO imports differently in python 3 - use six for compatibility * Paste requires bytes like objects. in python 2 cStringIO works fine, but in python three it needs to use io.BytesIO * simplify imports and logic by using six.BytesIO exclusively for parsing body content
* StringIO imports differently in python 3 - use six for compatibility (#46)Thomas Cross2020-01-261-1/+1
|
* Update auth_tkt.py for python3 compatibility (#45)marzetas2020-01-261-20/+30
| | | | | | | | * Update auth_tkt.py urllib imports to work in python3 * Add tests for auth AuthTicket * Adapt auth_tkt to be python2 and python3 compatible
* Make gzip middleware stop producing a spurious response body on HEAD ↵Jason Madden2020-01-132-2/+17
| | | | | requests. (#44) Fixes #43
* python3 compatibility issues: list + keys concatenation, bool check (#42)Vitaly Haritonsky2020-01-091-1/+4
|
* Fix deprecation warnings (#41)Xtreak2020-01-052-7/+14
| | | | | | | | * Use is_alive instead of isAlive for Python 3.9 compatibility. * Use encodebytes instead of deprecated encodestring. * Fix Python 2 and 3 compatibility for base64.
* socket write expect bytes instead of str (#38)blidce2019-11-251-1/+1
|
* Avoid some reference cycles through tracebacks. (#36)Benjamin Peterson2019-10-141-5/+3
|
* LimitedLengthFile: Handle io.UnsupportedOperation from socket.tell(). (#35)Benjamin Peterson2019-09-091-3/+6
| | | On Python 3, socket.makefile() returns an object with a tell() method, but one that always raises io.UnsupportedOperation.
* Simplify parse_formvars. (#34)Benjamin Peterson2019-09-061-40/+29
| | | If we don't want to parse the request body with cgi, we can just not use cgi rather than building a fake request.
* TestApp: Make unicode urls always work. (#33)Benjamin Peterson2019-09-041-0/+1
| | | Passing a unicode url to get() always worked (assuming the url contained only ASCII), but it didn't work to post(), put(), or delete() if query parameters were included. This change fixes the latter cases.
* Make LimitedLengthFile file return empty bytes rather than empty string when ↵Benjamin Peterson2019-09-041-1/+1
| | | | it's done. (#32)
* Avoid copying FieldStorage if possible. (#30)Benjamin Peterson2019-08-291-5/+7
| | | | | On Python 3, cgi.FieldStorage has a __del__ method that closes the underlying file [1]. This means that if the copy made from UnicodeMultiDict._decode_value is garbage collected, the file underlying the original FieldStorage will be closed! Fix this by not copying FieldStorage if it is not required by decode_keys=False. I cannot think of a nice way to fix this problem if decode_keys=True. [1] https://github.com/python/cpython/commit/f79126f373a9d5c9b584a8db736fe490fcbfa77a
* Modify TestApp.encode_multipart to handle bytes filenames and params. (#29)3.1.1Benjamin Peterson2019-08-251-15/+7
| | | As the test shows, this fixes passing boths params and upload_files on Python 3.
* Fix WSGIResponse.__call__ on Python 3. (#27)Benjamin Peterson2019-07-241-2/+2
| | | Replace `isinstance(self.content, file)` with a duck type for the `read()` method. Having a read method is what PEP 333 defines as the minimum requirement for a "file-like" object.
* Get MutableMapping from collections.abc on Python 3. (#26)Benjamin Peterson2019-07-243-3/+3
| | | This fixes a deprecation warning on 3.7.
* Fix quoting of bytestrings. (#23)Jelmer Vernooij2019-03-071-1/+4
|
* Write bytestrings when calling wsgi_write_chunk (#22)Chris Dent2019-02-281-2/+2
| | | | | | | | httpservers writes an empty string or an internal server error message, these needs to be bytes in python 3. It might have been useful to have wsgi_write_chunk accept either bytes or strings and do the right thing, but that seemed too invasive to be safe.
* Revert "Remove use of OpenSSL.tsafe, which links to OpenSSL.SSL anyways. (#16)"Chris Dent2019-01-071-3/+3
| | | | | | | | | | | | | | | | | This reverts commit 78dd2ec0138467305f1686558fca4ff8ca0b2b70. That removes the use of the so-called "thread safe" tsafe module, which adds a lock around many messages, but did not account for the use of that lock in the paste/httpserver.py module. An attempt was made to just get rid of that lock, but since there is limited testing of that area, and few resources to confirm the change, it's been decided that keeping tsafe and allow the deprecation warning to be exposed is the best thing to do. With luck the decpration warning will encourage people to not use the httpserver and choose something else instead. Fixes #19
* Remove use of OpenSSL.tsafe, which links to OpenSSL.SSL anyways. (#16)Stephan Richter2018-11-291-3/+3
|
* Don't delete dict item while iterating over same dict (#14)3.0.4Marius van den Beek2018-11-051-1/+1
|
* paste.fixture: fix form offset handling (#12)Daniel Hahler2018-10-311-6/+2
| | | | | It would fail if the length of bytes and unicode differs. It now passes non-bytes to `Form` directly.
* py3 fixes for form handling in paste.fixture (#8)Daniel Hahler2018-10-302-10/+19
| | | | | | | | | | | | | | | | | * py3 fixes for form handling in paste.fixture It uses "not six.PY2" in contrast to other places in the code to be forward-compatible. I've not looked too closely, but it might make sense to decode body/text in the beginning already, instead of having it as bytes internally?! Also, like mentioned in [1] already, it should probably use the correct source encoding?! 1: https://github.com/cdent/paste/blob/36e5b8bd16a6063ec654faf04541f3a20d19f7fe/paste/fixture.py#L820 * Add test, using/fixing SlowConsumer form app
* Pytest fixes (#9)Daniel Hahler2018-10-301-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | * pytest: fix collection warnings via __test__=False Fixes > "cannot collect test class %r because it has a __init__ constructor Ref: https://github.com/pytest-dev/pytest/issues/2007 * pytest: configure testpaths This is faster with test collection. * pytest: fix warning with doctests Fixes > /usr/lib/python3.7/site-packages/_pytest/python.py:764: > RemovedInPytest4Warning: usage of Generator.Function is deprecated, > please use pytest.Function instead * Minor fixes around s/py.test/pytest/
* Remove use of futureChris Dent2018-10-246-5/+30
| | | | | | | | Future is calling installation endless recursion. We are only using it for an html.escape method, so we make our own and get rid of future. Related-Bug: #6
* Make iterators Python3-compatibleZane Bitter2018-10-232-0/+4
| | | | | | | | In Python3, the iterator protocol uses a method named __next__(), not next(). (For compatibility with Python 2.6, we still need to support both though.) Ensure all iterator objects support the Python3 protocol. Signed-off-by: Zane Bitter <zbitter@redhat.com>
* Don't raise StopIteration inside a generatorZane Bitter2018-10-232-3/+2
| | | | | | This will cause a runtime error in Python 3.7, due to PEP479. Signed-off-by: Zane Bitter <zbitter@redhat.com>
* Fix up testing after switch to pytestChris Dent2018-10-236-24/+24
| | | | | | | | | | | | | | pytest exposes many warnings, some but not all of which are cleaned up here. The main switch is to use html.escape instead of cgi.escape. This inspired the addition of 'future' to requirements. The remaining warnings are related to pytest deprecations or over-eager test discovery. It is perhaps ironic that the switch to pytest is to avoid nose being mostly dead, and now we are using features in pytest that pytest wants to make dead. These are left for later cleanups, which means that running the tests is noisy.
* Merged in onovy/paste (pull request #36)Chris Dent2018-10-231-1/+1
|\ | | | | | | Use correct variable when building message for exception
| * Use correct variable when building message for exceptionOnd?ej Nov?2016-03-101-1/+1
| | | | | | | | | | Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=695253
| * Make add_close.next() leverage add_close.__next__()python3_wsgilib_add_close_nextMarc Abramowitz2016-03-081-1/+1
| | | | | | | | so we avoid logic duplication
| * Uncomment/cleanup paste.wsgilib.app_close.__next__Marc Abramowitz2016-03-071-2/+2
| |
| * Merge default to python3_wsgilib_add_close_nextMarc Abramowitz2016-03-071-0/+4
| |\
| | * paste.wsgilib.add_close: Add __next__ methodMarc Abramowitz2016-03-071-0/+4
| | | | | | | | | | | | to support using `add_close` objects as iterators on Python 3.
| | * Don't display invalid error message when socket in useMarc Abramowitz2015-05-111-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, when the listening socket was already in use, this error message was displayed: ... File "/private/tmp/n/lib/python2.7/site-packages/Paste-1.7.5.1-py2.7.egg/paste/httpserver.py", line 1106, in server_close self.thread_pool.shutdown(60) AttributeError: 'WSGIThreadPoolServer' object has no attribute 'thread_pool' We prevent this by checking if `self` has a `thread_pool` attribute before trying to reference it. Fixes issue #5 (https://bitbucket.org/ianb/paste/issue/5/invalid-error-message-when-the-socket-is)
| | * Merged in aodag/paste-py3/fix-has_key (pull request #25)Marc Abramowitz2015-05-112-2/+2
| | |\ | | | | | | | | | | | | replace ``has_key`` method to ``in`` operator #9
| | | * replace ``has_key`` method to ``in`` operator #9fix-has_keyaodag2015-05-022-2/+2
| | | |
| | | * Fix Python 3 issue in paste/fixture.pyMarc Abramowitz2015-04-301-1/+1
| | | | | | | | | | | | | | | | by wrapping `map` with `list`.
| | | * Make utility function private: _get_headersBB-4Marc Abramowitz2015-04-301-4/+9
| | | |
| | | * Make get_headers default to Python 3; fallback to Python 2Marc Abramowitz2015-04-301-4/+4
| | | | | | | | | | | | | | | | as suggested by @haypo at https://bitbucket.org/ianb/paste/pull-request/22/fix-improper-commas-in-request-headers-in/diff#comment-6583636