Commit Graph

125 Commits

Author SHA1 Message Date
Adam Johnson c187417611
Refs #9847 -- Added tests for handler403 resolution. 2024-03-04 05:24:36 +01:00
Mariusz Felisiak 305757aec1
Applied Black's 2024 stable style.
https://github.com/psf/black/releases/tag/24.1.0
2024-01-26 12:45:07 +01:00
Mariusz Felisiak 974942a750
Fixed #33955, Fixed #33971 -- Reverted "Fixed #32565 -- Moved internal URLResolver view-strings mapping to admindocs."
This reverts commit 7f3cfaa12b.

Thanks Tom Carrick and Greg Kaleka for reports.
2022-09-01 21:09:16 +02:00
Alokik Vijay 7f3cfaa12b Fixed #32565 -- Moved internal URLResolver view-strings mapping to admindocs.
Moved the functionality of URLResolver._is_callback(),
URLResolver._callback_strs, URLPattern.lookup_str() to
django.contrib.admindocs.
2022-05-17 10:50:09 +02:00
Alokik Vijay baf9604ed8 Fixed #16406 -- Added ResolveMatch.captured_kwargs and extra_kwargs.
Thanks Florian Apolloner for the review and implementation idea.
2022-03-29 10:27:40 +02:00
Mariusz Felisiak 7119f40c98 Refs #33476 -- Refactored code to strictly match 88 characters line length. 2022-02-07 20:37:05 +01:00
django-bot 9c19aff7c7 Refs #33476 -- Reformatted code with Black. 2022-02-07 20:37:05 +01:00
Keryn Knight f4b06a3cc1 Fixed #33426 -- Fixed ResolverMatch.__repr_() for class-based views.
Regression in 7c08f26bf0.
2022-01-10 17:30:41 +01:00
Jonathan Davis 4c6a6d5ac7
Fixed #23895 -- Prevented pickling of ResolverMatch.
Pickling a ResolverMatch did not work correctly in many cases,
especially with CBVs and URLResolvers in the list of tried URL paths.
2021-07-29 07:04:56 +02:00
Igor Fernandes e85d9c02ad Fixed #32870 -- Improved error message when URLconf is empty. 2021-06-22 08:09:53 +02:00
Nick Pope 41850eec99 Fixed #32572 -- Improved ResolverMatch.__repr__().
When a partial function was passed as the view, the __repr__() would
show the `func` argument as `functools.partial` which isn't very
helpful, especially as it doesn't reveal the underlying function or
arguments provided.
2021-03-29 11:28:56 +02:00
Adam Johnson 6e5041f57c
Removed unused param_dict return from URLResolver.resolve_error_handler().
Unused since its introduction in ed114e1510.
2020-06-22 21:28:56 +02:00
Jon Dufresne e42b68debf Fixed #31114 -- Fixed HttpRequest.build_absolute_uri() crash with reverse_lazy() locations. 2019-12-27 09:19:56 +01:00
daniel a rios b24e763846 Added tests for terminated path with optional arguments in django.urls.reverse(). 2019-06-24 11:30:26 +02:00
Jon Dufresne 95b7699ffc Cleaned up exception message checking in some tests. 2019-03-15 19:27:57 -04:00
Jon Dufresne 487d904bf2 Simplified temporary directory handling in AdminScriptTestCase.
Use tempfile.TemporaryDirectory() in AdminScriptTestCase.setUp()
to create and destroy a temporary directory for each test. It removes
the need for individual tests to delete files.

For test classes that don't use the temporary directory, inherit from
SimpleTestCase.
2019-02-05 12:11:54 -05:00
Tim Graham 043bd70942 Updated test URL patterns to use path() and re_path(). 2018-12-31 10:47:32 -05:00
Tim Graham 1136d57f01
Updated a test to reflect the fact that "import *" isn't used in URLconfs anymore (refs #14675). 2018-12-31 10:24:28 -05:00
Benjamin Wohlwend 79c196cfb2 Fixed #28766 -- Added ResolverMatch.route.
Co-Authored-By: Xavier Fernandez <xavier.fernandez@polyconseil.fr>
2018-12-06 18:05:40 -05:00
Xavier Fernandez 4d9f51f2b5 Added test for ResolverMatch.__repr__(). 2018-11-30 17:43:55 -05:00
Matthew Power 18098d261f Fixed #29673 -- Reset the URLconf at the end of each request.
Co-authored-by: Ross Thorne <rmwthorne@googlemail.com>
2018-09-26 15:35:24 -04:00
Hasan Ramezani 55b6f7af0c Completed test coverage for django.urls.utils.get_callable(). 2018-07-19 16:48:23 -04:00
Mariusz Felisiak 9bcf73d788 Fixed imports per isort 4.3.0. 2018-02-01 09:29:46 +01:00
Sjoerd Job Postmus df41b5a05d Fixed #28593 -- Added a simplified URL routing syntax per DEP 0201.
Thanks Aymeric Augustin for shepherding the DEP and patch review.
Thanks Marten Kenbeek and Tim Graham for contributing to the code.
Thanks Tom Christie, Shai Berger, and Tim Graham for the docs.
2017-09-20 18:04:42 -04:00
Tim Graham 7cc8507d9c Added a test for mixing args and kwargs in reverse(). 2017-09-14 07:07:41 -04:00
Tim Graham ee4043f735 Refs #28593 -- Moved django.conf.urls.include() to django.urls().
The old location remains for backwards compatibility. Documentation
will be updated separately along with the rest of the URL routing changes.
2017-09-13 16:32:03 -04:00
Mads Jensen a51c4de194 Used assertRaisesMessage() to test Django's error messages. 2017-07-29 19:07:23 -04:00
Marten Kenbeek ceb5f1c9bf Refs #27804 -- Used subTest() in urlpatterns_reverse tests. 2017-07-10 09:27:50 -04:00
Jon Dufresne 2c69824e5a Refs #23968 -- Removed unnecessary lists, generators, and tuple calls. 2017-06-01 19:08:59 -04:00
Robert Roskam 98bcc5d81b Fixed #27367 -- Doc'd and tested reversing of URLs with the same name.
Thanks Reinout van Rees for contributing to the patch.
2017-02-11 08:58:40 -05:00
Tim Graham 29f607927f Fixed spelling of "nonexistent". 2017-02-03 08:01:45 -05:00
Anton Samarchyan 0cbfc844a3 Improved test coverage and error messages for conf.urls.__init__. 2017-01-27 13:16:55 -05:00
Mads Jensen ebf34c3cdc Removed unused variables that are overwritten. 2017-01-25 09:14:05 -05:00
Claude Paroz 042b7350a0 Refs #23919 -- Removed unneeded str() calls 2017-01-20 14:13:55 +01:00
james mike dupont 7d20094996 Fixed spelling mistakes in code and comments. 2017-01-19 07:52:41 -05:00
Simon Charette cecc079168 Refs #23919 -- Stopped inheriting from object to define new style classes. 2017-01-19 08:39:46 +01:00
Claude Paroz 7b2f2e74ad Refs #23919 -- Removed six.<various>_types usage
Thanks Tim Graham and Simon Charette for the reviews.
2017-01-18 20:18:46 +01:00
Claude Paroz c716fe8782 Refs #23919 -- Removed six.PY2/PY3 usage
Thanks Tim Graham for the review.
2017-01-18 16:21:28 +01:00
Claude Paroz d7b9aaa366 Refs #23919 -- Removed encoding preambles and future imports 2017-01-18 09:55:19 +01:00
Tim Graham ad393beeb7 Refs #21927 -- Removed include()'s app_name argument per deprecation timeline.
Also removed support for passing a 3-tuple to include() and support for
setting an instance namespace without an application namespace.

Thanks Marten Kenbeek for completing the patch.
2017-01-17 20:52:00 -05:00
Marten Kenbeek 1358a67bf9 Fixed #27713 -- Clarified NoReverseMatch error message when no view is found. 2017-01-11 21:40:18 -05:00
Tim Graham 51cde873d9 Fixed #27648 -- Deprecated (iLmsu) regex groups in url() patterns. 2016-12-27 15:59:13 -05:00
Tim Graham b5f0b3478d Fixed #27579 -- Added aliases for Python 3's assertion names in SimpleTestCase. 2016-12-07 17:42:31 -05:00
za 321e94fa41 Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings. 2016-11-10 21:30:21 -05:00
Helen Sherwood-Taylor bc1e2d8e8e Fixed #27018 -- Fixed admindocs crash with a view in a class.
Generated correct admindocs URLs on Python 3. URLs generate 404s on
Python 2, as in older versions of Django.
2016-08-20 10:01:57 -04:00
Marten Kenbeek 389a5318a0 Fixed #26888 -- Fixed concurrency issue in URL resolver.
Fixed a regression in 625b8e9295d79650208bfb3fca8bf9e6aaf578e4:
improper short-circuiting could lead to a KeyError when threads
concurrently call RegexURLResolver._populate().
2016-07-14 14:41:52 -04:00
Tim Graham 5f8da22984 Fixed a urlpatterns_reverse test on Python 2 non-ASCII path. 2016-07-01 09:09:31 -04:00
Tim Graham c9ae09addf Replaced use of TestCase.fail() with assertRaises().
Also removed try/except/fail antipattern that hides exceptions.
2016-06-28 11:21:26 -04:00
Tim Graham 4e400dcb79 Refs #22384 -- Readded RegexURLResolver.reverse().
It was removed in 785cc71d5b only because
it was untested and unused in Django itself, however, some third-party
apps use it.
2016-06-20 14:22:27 -04:00
Markus Holtermann 625b8e9295 Fixed #24931 -- Made namespaced RegexURLResolvers populate callback strings.
Fixed a regression in 2f16ff5a6c.

Thanks Tim Graham for the review.
2016-06-18 10:39:32 -04:00