mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
080b2ca352
commit
ce2d7c8049
27
daemon.py
27
daemon.py
|
@ -2210,12 +2210,17 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if has_object_dict(message_json):
|
if has_object_dict(message_json):
|
||||||
if debug:
|
if debug:
|
||||||
print('INBOX: checking object fields')
|
print('INBOX: checking object fields')
|
||||||
# check that url is a string or list
|
# check that some fields are a string or list
|
||||||
if message_json['object'].get('url'):
|
string_or_list_fields = ('url', 'attributedTo')
|
||||||
if not isinstance(message_json['object']['url'], str) and \
|
for check_field in string_or_list_fields:
|
||||||
not isinstance(message_json['object']['url'], list):
|
if not message_json['object'].get(check_field):
|
||||||
print('INBOX: url should be a string or list ' +
|
continue
|
||||||
str(message_json['object']['url']))
|
field_value = message_json['object'][check_field]
|
||||||
|
if not isinstance(field_value, str) and \
|
||||||
|
not isinstance(field_value, list):
|
||||||
|
print('INBOX: ' +
|
||||||
|
check_field + ' should be a string or list ' +
|
||||||
|
str(message_json['object'][check_field]))
|
||||||
self._400()
|
self._400()
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
return 3
|
return 3
|
||||||
|
@ -2234,16 +2239,6 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self._400()
|
self._400()
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
return 3
|
return 3
|
||||||
if message_json['object'].get('attributedTo'):
|
|
||||||
attrib_field = message_json['object']['attributedTo']
|
|
||||||
if not isinstance(attrib_field, str) and \
|
|
||||||
not isinstance(attrib_field, list):
|
|
||||||
print('INBOX: ' +
|
|
||||||
'attributedTo should be a string or list ' +
|
|
||||||
str(attrib_field))
|
|
||||||
self._400()
|
|
||||||
self.server.postreq_busy = False
|
|
||||||
return 3
|
|
||||||
# check that some fields are lists
|
# check that some fields are lists
|
||||||
if debug:
|
if debug:
|
||||||
print('INBOX: checking object to and cc fields')
|
print('INBOX: checking object to and cc fields')
|
||||||
|
|
Loading…
Reference in New Issue