Skip to content

Commit 8925a08

Browse files
committed
fix a bug of Dispatcher.add_class when using as decorator
Below is the code to reveal this bug: @dispatcher.add_class class ProcessOrderAPI(APISet): rpc_exports = ['query', 'detail', 'start', 'update'] rpc_method_prefix = 'ProcessOrder' Model = ProcessOrder def update(self, object, attrs): # NOTE HERE: Since add_class retuns None previously, # So the 1st argument of super() is None return super(ProcessOrderAPI, self).update(object, attrs)
1 parent 4425243 commit 8925a08

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

jsonrpc/dispatcher.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ def add_class(self, cls):
7373
prefix = cls.__name__.lower() + '.'
7474
self.build_method_map(cls(), prefix)
7575

76+
return cls # for working as decorator
77+
7678
def add_object(self, obj):
7779
prefix = obj.__class__.__name__.lower() + '.'
7880
self.build_method_map(obj, prefix)

0 commit comments

Comments
 (0)