Skip to content

Commit

Permalink
Fixed Can so that it actually works, TODO review and unittest ASAP
Browse files Browse the repository at this point in the history
  • Loading branch information
devdave committed Jul 7, 2011
1 parent 6bc89ed commit 4a65ded
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions ProxyProject/web/util/smart.py
@@ -1,7 +1,8 @@


from functools import wraps
from twisted.web import (server, resource, static, html )
from twisted.web import (server, resource )
from twisted.web.server import Request

class RequestTypes:
POST = 1<<1
Expand Down Expand Up @@ -93,11 +94,17 @@ def __call__(self, host):


@wraps(host)
def wrapper(request, params = {}):
params, missing, badCast = self.parseRequestArgs(request, params)
success = True
return dumps(dict(success = success, reason = reason))
def wrapper(*args, **kwargs):
request = None
for arg in args:
if isinstance(arg, Request):
request = arg
break
else:
raise InvalidArgument("Missing Request object for wrapped action method call")

params, missing, badCast = self.parseRequestArgs(request, {})
return host(*args, params = params)

return wrapper

Expand Down

0 comments on commit 4a65ded

Please sign in to comment.