Commits

Luke Plant  committed d907da2

Made decorator depend on request being the first argument.

  • Participants
  • Parent commits b5aa0b7

Comments (0)

Files changed (5)

File classmethod.py

 
 def mydec(func):
     def _wrapper(*args, **kwargs):
+        assert isinstance(args[0], HttpRequest)
         return func(*args, **kwargs)
     return _wrapper
 
 
 responses = []
 
+class HttpRequest(object):
+    pass
+
 def runview():
     global responses
-    request = object()
+    request = HttpRequest()
     responses.append(view(request))
 
 # Concurrent threads:

File copyoncall.py

 
 def mydec(func):
     def _wrapper(*args, **kwargs):
+        assert isinstance(args[0], HttpRequest)
         return func(*args, **kwargs)
     return _wrapper
 
 
 responses = []
 
+class HttpRequest(object):
+    pass
+
 def runview():
     global responses
-    request = object()
+    request = HttpRequest()
     responses.append(view(request))
 
 # Concurrent threads:
 
 def mydec(func):
     def _wrapper(*args, **kwargs):
+        assert isinstance(args[0], HttpRequest)
         return func(*args, **kwargs)
     return _wrapper
 
 
 responses = []
 
+class HttpRequest(object):
+    pass
+
 def runview():
     global responses
-    request = object()
+    request = HttpRequest()
     responses.append(view(request))
 
 # Concurrent threads:

File magicnew_with_configure.py

 
 def mydec(func):
     def _wrapper(*args, **kwargs):
+        assert isinstance(args[0], HttpRequest)
         return func(*args, **kwargs)
     return _wrapper
 
 
 responses = []
 
+class HttpRequest(object):
+    pass
+
 def runview():
     global responses
-    request = object()
+    request = HttpRequest()
     responses.append(view(request))
 
 # Concurrent threads:
 
 def mydec(func):
     def _wrapper(*args, **kwargs):
+        assert isinstance(args[0], HttpRequest)
         return func(*args, **kwargs)
     return _wrapper
 
 
 responses = []
 
+class HttpRequest(object):
+    pass
+
 def runview():
     global responses
-    request = object()
+    request = HttpRequest()
     responses.append(view(request))
 
 # Concurrent threads: