I'm getting a very strange error: TypeError at /admin/
object.__new__() takes no parameters I've isolated the problematic code to my middleware for an application I built called staticpages. It uses the same mechanism and so the same middleware as flatpages. This is the code: from django.http import Http404 from django.conf import settings from asqcom.apps.staticpages.views import staticpage class StaticpageFallbackMiddleware(object): def process_response(self, request, response): if response.status_code != 404: return response try: return staticpage(request, request.path_info) # Return the original response if any errors happened. Because this # is a middleware, we can't assume the errors will be caught elsewhere. except Http404: return response except: if settings.DEBUG: raise 'staticpages.middleware error' return response When I comment out this middleware, everything is okay. Below is the traceback: # /usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py in get_response 85. # Apply view middleware 86. for middleware_method in self._view_middleware: 87. response = middleware_method(request, callback, callback_args, callback_kwargs) 88. if response: 89. return response 90. 91. try: 92. response = callback(request, *callback_args, **callback_kwargs) ... 93. except Exception, e: 94. # If the view raised an exception, run it through exception 95. # middleware, and if the exception middleware returns a 96. # response, use that. Otherwise, reraise the exception. 97. for middleware_method in self._exception_middleware: 98. response = middleware_method(request, e) # /usr/local/lib/python2.6/dist-packages/django/contrib/admin/sites.py in wrapper 185. return update_wrapper(inner, view) 186. 187. def get_urls(self): 188. from django.conf.urls.defaults import patterns, url, include 189. 190. def wrap(view): 191. def wrapper(*args, **kwargs): 192. return self.admin_view(view)(*args, **kwargs) ... 193. return update_wrapper(wrapper, view) 194. 195. # Admin-site-wide views. 196. urlpatterns = patterns('', 197. url(r'^$', 198. wrap(self.index), # /usr/local/lib/python2.6/dist-packages/django/contrib/admin/sites.py in inner 177. url(r'^my_view/$', self.admin_view(some_view)) 178. ) 179. return urls 180. """ 181. def inner(request, *args, **kwargs): 182. if not self.has_permission(request): 183. return self.login(request) 184. return view(request, *args, **kwargs) ... 185. return update_wrapper(inner, view) 186. 187. def get_urls(self): 188. from django.conf.urls.defaults import patterns, url, include 189. 190. def wrap(view): # /usr/local/lib/python2.6/dist-packages/django/views/decorators/ cache.py in _wrapped_view_func 37. 38. def never_cache(view_func): 39. """ 40. Decorator that adds headers to a response so that it will 41. never be cached. 42. """ 43. def _wrapped_view_func(request, *args, **kwargs): 44. response = view_func(request, *args, **kwargs) ... 45. add_never_cache_headers(response) 46. return response 47. return wraps(view_func)(_wrapped_view_func) # /usr/local/lib/python2.6/dist-packages/django/contrib/admin/sites.py in index 359. context = { 360. 'title': _('Site administration'), 361. 'app_list': app_list, 362. 'root_path': self.root_path, 363. } 364. context.update(extra_context or {}) 365. return render_to_response(self.index_template or 'admin/ index.html', context, 366. context_instance=template.RequestContext(request) ... 367. ) 368. index = never_cache(index) 369. 370. def display_login_form(self, request, error_message='', extra_context=None): 371. request.session.set_test_cookie() 372. context = { # /usr/local/lib/python2.6/dist-packages/django/template/context.py in __init__ 99. def __init__(self, request, dict=None, processors=None): 100. Context.__init__(self, dict) 101. if processors is None: 102. processors = () 103. else: 104. processors = tuple(processors) 105. for processor in get_standard_processors() + processors: 106. self.update(processor(request)) ... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---