Commit Graph

97 Commits

Author SHA1 Message Date
Gabriel Hurley 90e530978d Fixed #18210 -- Escaped special characters in reverse prefixes.
Ensured that special characters passed in to reverse via the
prefix argument are properly escaped so that calls to
django.utils.regex_helpers.normalize and/or string formatting
operations don't result in exceptions.

Thanks to toofishes for the error report.
2012-11-03 13:06:57 -07:00
Claude Paroz 28fd876bae Fixed #17892 -- Do not include whole RegexURLPattern lists in RegexURLResolver repr
Thanks milosu for the report and the initial patch.
2012-09-01 22:20:46 +02:00
Claude Paroz ae88e73fa6 Replaced some smart_xxx by force_xxx equivalent
smart_str/smart_text should only be used when a potential lazy
string should be preserved in the result of the function call.
2012-08-30 15:46:16 +02:00
Florian Apolloner 367bfaa522 Don't swallow AttributeError in core.urlresolvers.get_callable. 2012-08-14 21:23:25 +02:00
Claude Paroz dce34dc969 [py3] Made __repr__ return str with Python 3 2012-08-12 20:45:39 +02:00
Aymeric Augustin c5ef65bcf3 [py3] Ported django.utils.encoding.
* Renamed smart_unicode to smart_text (but kept the old name under
  Python 2 for backwards compatibility).
* Renamed smart_str to smart_bytes.
* Re-introduced smart_str as an alias for smart_text under Python 3
  and smart_bytes under Python 2 (which is backwards compatible).
  Thus smart_str always returns a str objects.
* Used the new smart_str in a few places where both Python 2 and 3
  want a str.
2012-08-07 12:00:22 +02:00
Aymeric Augustin ee191715ea [py3] Fixed access to dict keys/values/items. 2012-08-07 12:00:22 +02:00
Aymeric Augustin bdca5ea345 [py3] Replaced unicode/str by six.text_type/bytes. 2012-07-22 09:29:54 +02:00
Aymeric Augustin 3cb2457f46 [py3] Replaced basestring by six.string_types. 2012-07-22 09:29:54 +02:00
Julien Phalip 2b6644388f Fixed an `except` statement to be Python3-compatible. Thanks to charettes for the tip. 2012-07-21 15:13:55 -07:00
Aymeric Augustin 4ceb9db9d8 Removed u prefix on a unicode string. 2012-07-21 22:38:25 +02:00
Julien Phalip 1af0271d7c Fixed #6170 -- Ensured that a useful exception is raised when a regex is invalid in the URLConf.
Thanks to abrahamson.j for the report, to guettli for initial work on the patch, and to David Gouldin for the new patch and test.
2012-07-21 13:30:34 -07:00
Claude Paroz 4a103086d5 Fixed #18269 -- Applied unicode_literals for Python 3 compatibility.
Thanks Vinay Sajip for the support of his django3 branch and
Jannis Leidel for the review.
2012-06-07 18:08:47 +02:00
Claude Paroz 2daf1ae8b9 Stopped converting match dict keys to bytestrings when resolving URLs.
Test suite is passing, but if any regression would be detected,
we might replace smart_str by force_unicode.
2012-05-24 13:51:18 +02:00
Claude Paroz 3904b74a3f Fixed #18013 -- Use the new 'as' syntax for exceptions.
Thanks Clueless for the initial patch.
Note that unittest has been purposely left out (external package only used by Python 2.6).
2012-04-29 20:57:15 +02:00
Jannis Leidel 746987f916 Fixed #17734 -- Made sure to only redirect translated URLs if they can actually be resolved to prevent unwanted redirects. Many thanks to Orne Brocaar and Anssi Kääriäinen for input.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17621 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-03-02 11:07:36 +00:00
Gabriel Hurley a0721a3017 Fixed #15900 -- Calls to reverse with nested namespaced urls are escaped properly and capture parameters as expected.
Thanks to teolicy for the report, and dmclain for the patch.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@17251 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-22 23:03:48 +00:00
Ramiro Morales 24f3c06e4a More django.conf.urls.defaults removals. Refs #17132
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17049 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-29 12:24:44 +00:00
Alex Gaynor 3e66913f96 Fixed #17132 -- remove a leftover reference to django.conf.default.urls in Django. THanks to claudep for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17048 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-28 21:23:50 +00:00
Jannis Leidel 02dcbe3317 Fixed #11559 -- Fixed the URL resolver to be able to handle captured parameters in parent URLconfs when also using namespaces. Thanks, cwb, ungenio and hvdklauw.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16608 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-08-12 14:15:50 +00:00
Jannis Leidel 1ca6e9b9e2 Fixed #9847 -- Added 403 response handler. Many thanks to kgrandis, adamnelson, vkryachko, fvox13 and Chris Beaven.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16606 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-08-12 14:15:31 +00:00
Jannis Leidel fffe983da1 Corrected slightly odd wording added in r16420.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16424 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-17 07:39:03 +00:00
Jannis Leidel b4cdf4d111 Fixed #10802 -- Handle ImportErrors and AttributeErrors gracefully when raised by the URL resolver system during startup. Many thanks, IonelMaries and Bas Peschier.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16420 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-16 16:41:14 +00:00
Jannis Leidel 896e3c69c7 Fixed #11585 -- Added ability to translate and prefix URL patterns with a language code as an alternative method for language discovery. Many thanks to Orne Brocaar for his initial work and Carl Meyer for feedback.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16405 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-15 17:29:10 +00:00
Jannis Leidel fe96214939 Fixed #13154 -- Fixed the URL resolver's reverse() to match the behavior of its resolve() with regard to the default kwargs. Many thanks to patrys.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16177 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-05-07 16:59:25 +00:00
Luke Plant 970ae01620 Fixed #15795 - `__repr__` for RegexURLPattern not unicode safe
Thanks to Mark Raddatz for the report and patch

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16158 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-05-05 00:29:16 +00:00
Jannis Leidel 79afd55278 Fixed #5925 -- Added new lazily evaluated version of django.core.urlresolvers.reverse. Thanks, SmileyChris, Preston Timmons and Julien Phalip.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16121 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-29 11:49:59 +00:00
Alex Gaynor fcbf881d82 Refactor all uses of thread locals to be more consistant and sane.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15232 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-17 09:52:47 +00:00
Malcolm Tredinnick 882cba0f69 Debug 404 page now displays names of URL patterns, if they exist.
Thanks to Tobias McNulty for the patch. Fixed #9310.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13769 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-09-12 19:27:33 +00:00
Russell Keith-Magee 859fc020a7 Fixed #5350 -- Added fallback to default 404/500 handlers when they're not explicitly specified (or imported) in a urls.py file. Thanks to Thomas Güttler for the report and initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13590 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-08-14 14:27:35 +00:00
Russell Keith-Magee f90a25551d Fixed #14027 -- Ensure that reverse() raises an exception when you try to reverse None. Thanks to Alex for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13499 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-08-06 14:34:10 +00:00
Russell Keith-Magee 69d1e71fad Corrected [13479], accounting for unnamed urls that are instances of classes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13497 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-08-06 13:47:56 +00:00
Russell Keith-Magee e0fb90b2f3 Fixed #13922 -- Updated resolve() to support namespaces. Thanks to Nowell Strite for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13479 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-08-05 07:09:47 +00:00
Russell Keith-Magee 5211f48ae3 Fixed #12164 -- Removed the Python 2.3 compatibility imports and workarounds. Thanks to timo and claudep for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13094 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-05-04 14:00:30 +00:00
Adrian Holovaty 5ceed0a053 Changed a whole bunch of places to raise exception instances instead of old-style raising exception classes plus a comma. Good for the future Python 3 conversion
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12180 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-10 18:36:20 +00:00
Jacob Kaplan-Moss 1c5fe467bd Fixed #10326: handler500 and handler404 may now be callables. Thanks, dcwatson, adurdin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11854 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-13 20:29:04 +00:00
Brian Rosner 6c61ca3d74 Fixed #5034 -- honor request.urlconf in reverse and resolve.
This enables {% url %} to honor request.urlconf set from process_request
middleware methods.

Thanks SmileyChris for the initial patch work.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11740 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-16 01:58:00 +00:00
Luke Plant 4b82421a85 Improved NoReverseMatch error message when invalid args/kwargs are passed.
Refs #8611



git-svn-id: http://code.djangoproject.com/svn/django/trunk@11482 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-09-10 11:08:16 +00:00
Russell Keith-Magee 8d48eaa064 Fixed #10061 -- Added namespacing for named URLs - most importantly, for the admin site, where the absence of this facility was causing problems. Thanks to the many people who contributed to and helped review this patch.
This change is backwards incompatible for anyone that is using the named URLs
introduced in [9739]. Any usage of the old admin_XXX names need to be modified
to use the new namespaced format; in many cases this will be as simple as a
search & replace for "admin_" -> "admin:". See the docs for more details on
the new URL names, and the namespace resolution strategy.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11250 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-07-16 16:16:13 +00:00
Russell Keith-Magee 88da053e5e Fixed #10834 -- Corrected [11120] to ensure that there is a difference between catching a bad URL pattern and an new (no URLs) project. Thanks to Matt Welch for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11155 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-07-02 14:02:58 +00:00
Russell Keith-Magee 735309341e Fixed #10834 -- Added bucket condition to ensure that URL resolvers won't ever return None. Thanks to Chris Cahoon for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11120 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-29 14:02:17 +00:00
Russell Keith-Magee ff166a3cdc Fixed #10065 -- Corrected an error message when an empty urlpattern object is provided. Thanks to Matthew Flanagan for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10385 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-04 06:54:56 +00:00
Gary Wilson Jr b4f5655c86 Fixed #10553 -- Corrected several uses of `URLconf` in documentation and comments, according to the Django style guide. Based on patch from rduffield.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10256 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-31 16:07:07 +00:00
Jacob Kaplan-Moss c485e236bd Fixed #8193: all dynamic imports in Django are now done correctly. I know this because Brett Cannon borrowed the time machine and brought Python 2.7's '`importlib` back for inclusion in Django. Thanks for the patch-from-the-future, Brett!
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10088 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-18 16:55:59 +00:00
Malcolm Tredinnick fb729cf1d9 Fixed #10472 -- Fixed a race condition in reverse URL resolving.
This only shows up in for reverse() (not forwards resolving), since that
path uses a globally shared resolver object. Based on a patch from
Travis Terry.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10037 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-12 07:28:22 +00:00
Jacob Kaplan-Moss c01098e9cb In urlconfs, include() may now be used on an iterable of patterns instead of just a module string. Refs #6470 -- making the admin use a urlconf is much easier with this work done. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9728 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-10 22:54:20 +00:00
Malcolm Tredinnick 37ee86b7ee Fixed another case of reverse URL resolving that wasn't working.
This is a similar situation to that fixed in r9087. We weren't merging
multiple levels of include() calls together correctly.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9099 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-30 05:52:35 +00:00
Malcolm Tredinnick 15b0158e39 Fixed #9038 -- Correctly handle URL patterns with the same name (or view name),
declared independently and that differ only by argument signatures.

Patch from Russell Keith-Magee.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9087 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-27 06:14:11 +00:00
Malcolm Tredinnick 7838493b9e Fixed #8726 -- When doing reverse URL resolving, make sure we're consistently
dealing with unicode strings throughout by promoting up from UTF-8 as necessary.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8777 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-31 22:47:25 +00:00
Malcolm Tredinnick a63a83e5d8 A rewrite of the reverse URL parsing: the reverse() call and the "url" template tag.
This is fully backwards compatible, but it fixes a bunch of little bugs. Thanks
to SmileyChris and Ilya Semenov for some early patches in this area that were
incorporated into this change.

Fixed #2977, #4915, #6934, #7206.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8760 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-31 11:11:20 +00:00