Show More
@@ -174,7 +174,7 def _makefpartparamsizes(nbparams): | |||||
174 |
|
174 | |||
175 | parthandlermapping = {} |
|
175 | parthandlermapping = {} | |
176 |
|
176 | |||
177 | def parthandler(parttype): |
|
177 | def parthandler(parttype, params=()): | |
178 | """decorator that register a function as a bundle2 part handler |
|
178 | """decorator that register a function as a bundle2 part handler | |
179 |
|
179 | |||
180 | eg:: |
|
180 | eg:: | |
@@ -188,6 +188,7 def parthandler(parttype): | |||||
188 | lparttype = parttype.lower() # enforce lower case matching. |
|
188 | lparttype = parttype.lower() # enforce lower case matching. | |
189 | assert lparttype not in parthandlermapping |
|
189 | assert lparttype not in parthandlermapping | |
190 | parthandlermapping[lparttype] = func |
|
190 | parthandlermapping[lparttype] = func | |
|
191 | func.params = frozenset(params) | |||
191 | return func |
|
192 | return func | |
192 | return _decorator |
|
193 | return _decorator | |
193 |
|
194 | |||
@@ -839,7 +840,7 def handlereplycaps(op, inpart): | |||||
839 |
|
840 | |||
840 | raise error.BundleValueError(**kwargs) |
|
841 | raise error.BundleValueError(**kwargs) | |
841 |
|
842 | |||
842 | @parthandler('b2x:error:pushraced') |
|
843 | @parthandler('b2x:error:pushraced', ('message',)) | |
843 | def handlereplycaps(op, inpart): |
|
844 | def handlereplycaps(op, inpart): | |
844 | """Used to transmit push race error over the wire""" |
|
845 | """Used to transmit push race error over the wire""" | |
845 | raise error.ResponseError(_('push failed:'), inpart.params['message']) |
|
846 | raise error.ResponseError(_('push failed:'), inpart.params['message']) |
General Comments 0
You need to be logged in to leave comments.
Login now