Skip to content
Snippets Groups Projects
Commit c6e9138a authored by Rolf Niepraschk's avatar Rolf Niepraschk
Browse files

...

parent d78095dc
No related branches found
No related tags found
No related merge requests found
...@@ -51,16 +51,19 @@ def validate(): ...@@ -51,16 +51,19 @@ def validate():
version = request.args.get('v') version = request.args.get('v')
xml_str = request.data xml_str = request.data
xml_tree = utils.parse(xml_str) xml_tree = utils.parse(xml_str)
if xml_tree: try:
utils.parse(xml_str)
app.logger.debug('=== xml_tree OK ===') app.logger.debug('=== xml_tree OK ===')
xsd_str = utils.get_xsd(releases_dict, xsd_version=version, xml_str=xml_str) xsd_str = utils.get_xsd(releases_dict, xsd_version=version, xml_str=xml_str)
if xsd_str: if xsd_str:
app.logger.debug('=== xsd OK ===')
ret = utils.validate(xml_str=xml_str, xsd_str=xsd_str) ret = utils.validate(xml_str=xml_str, xsd_str=xsd_str)
else: else:
app.logger.debug('=== xsd invalid ===')
ret = utils.return_error(error='xsd content not readable') ret = utils.return_error(error='xsd content not readable')
else: except:
app.logger.debug('=== xml_tree invalid ===') app.logger.debug('=== xml_tree invalid ===')
ret = utils.return_error(error='invalid xml data') ret = utils.return_error(error='invalid xml data')
return utils.xml_response(ret) return utils.xml_response(ret)
......
...@@ -53,9 +53,9 @@ def get_version(): ...@@ -53,9 +53,9 @@ def get_version():
return False return False
def get_xsd(d, xsd_version=None, xml_str = None): def get_xsd(d, xsd_version=None, xml_str = None):
url = False url = ''
version = xsd_version version = xsd_version
if not version: # We use the internal version information in the XML structure if not version: # We use the internal version information in the XML data
root = parse(xml_str) root = parse(xml_str)
version = root.attrib.get('schemaVersion') version = root.attrib.get('schemaVersion')
for i in d['releases']: for i in d['releases']:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment