Browse code
documented getresponse code
Showing 1 changed files
... | ... |
@@ -88,18 +88,20 @@ class ServerEvents(object): |
88 | 88 |
|
89 | 89 |
NOTE: if an error code is returned, the client error messages will be much less helpful! |
90 | 90 |
|
91 |
+ for example |
|
92 |
+ |
|
93 |
+ def getresponsecode(self, result): |
|
94 |
+ code = 200 |
|
95 |
+ if not isinstance(result, list): |
|
96 |
+ if result is not None and result.error is not None: |
|
97 |
+ code = result.error.code or 500 |
|
98 |
+ return code |
|
99 |
+ |
|
100 |
+ |
|
91 | 101 |
:returns: :py:class:`int`''' |
92 | 102 |
# returns 200 so that the python client can see something useful |
93 | 103 |
return 200 |
94 | 104 |
|
95 |
- # for example |
|
96 |
- #def getresponsecode(self, result): |
|
97 |
- # code = 200 |
|
98 |
- # if not isinstance(result, list): |
|
99 |
- # if result is not None and result.error is not None: |
|
100 |
- # code = result.error.code or 500 |
|
101 |
- # return code |
|
102 |
- |
|
103 | 105 |
def defer(self, method, *a, **kw): |
104 | 106 |
'''Defer to thread. Override this method if you are using a different ThreadPool, or if you want to return immediately. |
105 | 107 |
|