Skip to content

Commit ab9d613

Browse files
committed
check_validator -> set_validator in ProtocolBase
1 parent 600e8d4 commit ab9d613

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Changelog
55
rpclib-2.5.1-beta
66
-----------------
77
* Switched to magic cookie constants instead of strings in protocol logic.
8+
* check_validator -> set_validator in ProtocolBase
89

910
rpclib-2.5.0-beta
1011
-----------------

src/rpclib/protocol/_base.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from rpclib.const.http import HTTP_404
3737
from rpclib.const.http import HTTP_413
3838
from rpclib.const.http import HTTP_500
39+
3940
from rpclib.error import ResourceNotFoundError
4041
from rpclib.error import RequestTooLongError
4142
from rpclib.error import Fault
@@ -71,8 +72,7 @@ def __init__(self, app=None, validator=None):
7172

7273
self.set_app(app)
7374
self.event_manager = EventManager(self)
74-
self.validator = validator
75-
self.check_validator()
75+
self.set_validator(validator)
7676

7777
@property
7878
def app(self):
@@ -179,8 +179,10 @@ def fault_to_http_response_code(self, fault):
179179
else:
180180
return HTTP_500
181181

182-
def check_validator(self):
182+
def set_validator(self, validator):
183183
"""You must override this function if your protocol supports validation.
184184
"""
185185

186-
assert self.validator is None
186+
assert validator is None
187+
188+
self.validator = None

src/rpclib/protocol/http.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ def _get_http_headers(req_env):
4343
return retval
4444

4545
class HttpRpc(ProtocolBase):
46-
"""The so-called ReST-minus-the-verbs HttpRpc protocol implementation.
46+
"""The so-called REST-minus-the-verbs HttpRpc protocol implementation.
4747
It only works with the http server (wsgi) transport.
4848
49-
It only parses GET requests where the whole data is in the 'QUERY_STRING'.
49+
It only parses requests where the whole data is in the 'QUERY_STRING', i.e.
50+
the part after '?' character in a URI string.
5051
"""
5152

5253
def check_validator(self):
@@ -66,8 +67,8 @@ def decompose_incoming_envelope(self, ctx):
6667
ctx.in_header_doc = _get_http_headers(ctx.in_document)
6768
ctx.in_body_doc = parse_qs(ctx.in_document['QUERY_STRING'])
6869

69-
logger.debug('body : %r' % (ctx.in_body_doc))
7070
logger.debug('header : %r' % (ctx.in_header_doc))
71+
logger.debug('body : %r' % (ctx.in_body_doc))
7172

7273
def dict_to_object(self, doc, inst_class):
7374
flat_type_info = inst_class.get_flat_type_info(inst_class)

0 commit comments

Comments
 (0)