Ticket #10326: handlerXXX_callable.diff

File handlerXXX_callable.diff, 2.0 KB (added by Dan Watson, 16 years ago)

Patch and doc updates

  • django/core/urlresolvers.py

     
    213213
    214214    def _resolve_special(self, view_type):
    215215        callback = getattr(self.urlconf_module, 'handler%s' % view_type)
    216         mod_name, func_name = get_mod_func(callback)
    217216        try:
    218             return getattr(__import__(mod_name, {}, {}, ['']), func_name), {}
     217            return get_callable(callback), {}
    219218        except (ImportError, AttributeError), e:
    220219            raise ViewDoesNotExist, "Tried %s. Error was: %s" % (callback, str(e))
    221220
  • docs/topics/http/urls.txt

     
    244244handler404
    245245----------
    246246
    247 A string representing the full Python import path to the view that should be
    248 called if none of the URL patterns match.
     247A callable, or a string representing the full Python import path to the view
     248that should be called if none of the URL patterns match.
    249249
    250250By default, this is ``'django.views.defaults.page_not_found'``. That default
    251251value should suffice.
    252252
     253.. versionchanged:: 1.1
     254    Previous versions of Django only accepted strings representing import paths.
     255
    253256handler500
    254257----------
    255258
    256 A string representing the full Python import path to the view that should be
    257 called in case of server errors. Server errors happen when you have runtime
    258 errors in view code.
     259A callable, or a string representing the full Python import path to the view
     260that should be called in case of server errors. Server errors happen when you
     261have runtime errors in view code.
    259262
    260263By default, this is ``'django.views.defaults.server_error'``. That default
    261264value should suffice.
    262265
     266.. versionchanged:: 1.1
     267    Previous versions of Django only accepted strings representing import paths.
     268
    263269include
    264270-------
    265271
Back to Top