# HG changeset patch # User Sverre Rabbelier # Date 1252783637 -7200 # Node ID 60d56cf01b549ceea2ff71bbc62d87ce7e4d6e2a # Parent 81eaf0a9101f6504b6ef798aaab01fceabf44ce4 Use the new optional argument to endRequest in the middleware Currently endRequest is called twice on an exception if Django intercepts the exception and returns it's own result. By setting optional=True we do not crash on 'assert self.in_request'. diff -r 81eaf0a9101f -r 60d56cf01b54 app/soc/middleware/value_store.py --- a/app/soc/middleware/value_store.py Sat Sep 12 21:26:27 2009 +0200 +++ b/app/soc/middleware/value_store.py Sat Sep 12 21:27:17 2009 +0200 @@ -39,7 +39,7 @@ core = callback.getCore() core.startNewRequest(request) - def end(self, request): + def end(self, request, optional): """Empties the value store. Args: @@ -47,7 +47,7 @@ """ core = callback.getCore() - core.endRequest(request) + core.endRequest(request, optional) def process_request(self, request): """Called when a request is made. @@ -64,7 +64,7 @@ the method signature. """ - self.end(request) + self.end(request, True) return response def process_exception(self, request, exception): @@ -74,4 +74,4 @@ the method signature. """ - self.end(request) + self.end(request, False)