Hello: I have defined a middleware class. and i have added it to the middleware_classes attribute in setting. When a request comes in, the middleware class gets created (the debugger catches the code when the breakpoint is on the class CommonFiilter(): line)
Now i expect the function def process_template_response(self, request, response): to get called. I have debug point on the inside of the function and the debugger never traps the execution. The debugger, though, traps the execution at the line where the function name and parameters are defined. This is the class: class CommonFilter(): DEBUGGER BREAKS HERE def process_template_response(self, request, response): DEBUGGER BREAKS HERE if response.template_name=='store/index2.html': NOT HERE(or after this line) catnames=getCategories() response.context_data.update({'catnames':catnames,'user':request.GET.get(key='user',default=None)}) return response Hello: I have defined a middleware class. and i have added it to the middleware_classes attribute in setting. When a request comes in, the middleware class gets created (the debugger catches the code when the breakpoint is on the class CommonFiilter(): line) Now i expect the function def process_template_response(self, request, response): to get called. I have debug point on the inside of the function and the debugger never traps the execution. The debugger, though, traps the execution at the line where the function name and parameters are defined. This is the class: class CommonFilter(): DEBUGGER BREAKS HERE def process_template_response(self, request, response): DEBUGGER BREAKS HERE if response.template_name=='store/index2.html': NOT HERE(or after this line) catnames=getCategories() response.context_data.update({'catnames':catnames,'user':request.GET.get(key='user',default=None)}) return response Also tried this: class CommonFilter(): DEBUGGER BREAKS HERE def process_template_response(self, request, response): DEBUGGER BREAKS HERE if response.template_name=='store/index2.html': NOT HERE(or after here) catnames=getCategories() response.context_data['catnames']=catnames response.context_data['user']=request.GET.get(key='user',default=None) return response Just in case, this is the setting MIDDLEWWARE_CLASSES variable: MIDDLEWARE_CLASSES = ( 'store.models.CommonFilter', 'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', ) store is an app in this project and ofcourse CommonFilter is defined in models.py. Why is the function process_template_response function not being executed? Thanks for your time and kind concern. -- 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.