Ticket #1840: admin-doc-views.diff
File admin-doc-views.diff, 2.7 KB (added by , 18 years ago) |
---|
-
django/contrib/admin/views/decorators.py
104 104 return http.HttpResponseRedirect(request.path) 105 105 else: 106 106 return _display_login_form(request, ERROR_MESSAGE) 107 _checklogin._decorated_func = view_func 107 108 108 109 return _checklogin -
django/contrib/admin/views/doc.py
320 320 def get_readable_field_data_type(field): 321 321 return DATA_TYPE_MAPPING[field.get_internal_type()] % field.__dict__ 322 322 323 def undecorate(func, i=0): 324 try: 325 if i > 10: 326 print "Warning: endless looping !" 327 return func 328 329 if func != func._decorated_func: 330 func = undecorate(func._decorated_func,i+1) 331 except: 332 pass 333 334 return func 335 323 336 def extract_views_from_urlpatterns(urlpatterns, base=''): 324 337 """ 325 338 Return a list of views from a list of urlpatterns. … … 328 341 """ 329 342 views = [] 330 343 for p in urlpatterns: 331 if hasattr(p, ' get_callback'):344 if hasattr(p, '_get_callback'): 332 345 try: 333 views.append(( p.get_callback(), base + p.regex.pattern))346 views.append((undecorate(p._get_callback()), base + p.regex.pattern)) 334 347 except ViewDoesNotExist: 335 348 continue 336 349 elif hasattr(p, '_get_url_patterns'): -
django/contrib/auth/decorators.py
15 15 return HttpResponseRedirect('%s?%s=%s' % (login_url, REDIRECT_FIELD_NAME, quote(request.get_full_path()))) 16 16 _checklogin.__doc__ = view_func.__doc__ 17 17 _checklogin.__dict__ = view_func.__dict__ 18 _checklogin._decorated_func = view_func 18 19 19 20 return _checklogin 21 20 22 return _dec 21 23 22 24 login_required = user_passes_test(lambda u: u.is_authenticated()) -
django/views/decorators/cache.py
39 39 response = view_func(request, *args, **kwargs) 40 40 add_never_cache_headers(response) 41 41 return response 42 _wrapped_view_func._decorated_func = view_func 43 42 44 return _wrapped_view_func