Closed mhrivnak closed 12 years ago
Looks good to me. I don't think there is anything that needs to be changed in the tests. The problem here was the use of an implicit design contract (via the getargspec line you cited). If you want to strictly enforce this contract it may be reasonable to add validation that all service methods accept a required positional argument 'auth_token' this could easily be done in the service_method
decorator with an assertion.
I agree that the decorator should validate the presence of that argument. Feel free to make it so.
There are some service methods ie. UserManager.login and a couple of others which dont take an auth_token. I think we would have to make another decorator for those to do only what service_method does now. Then we don't have to change as much since nearly all the service methods take an auth_token.
All view methods must list 'auth_token' as the first positional argument after "self" so that this code may function:
https://github.com/TireSwingSoftware/openassign-server/blob/dev/pr_services/rpc/service.py#L206
Wrong:
def exam_view(self, *args, **kwargs)
Right:
exam_view(self, auth_token, *args, **kwargs):
If not, the rpc.service code will raise an exception.