From 30f525a430368b02aa9b60ee2bb54ca45303112e Mon Sep 17 00:00:00 2001 From: M Bernt Date: Sat, 6 Jul 2019 14:43:03 +0200 Subject: [PATCH 1/2] allow empyt value for numeric inputs --- CTDopts/CTDopts.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CTDopts/CTDopts.py b/CTDopts/CTDopts.py index ba29c15..7548a54 100644 --- a/CTDopts/CTDopts.py +++ b/CTDopts/CTDopts.py @@ -440,6 +440,8 @@ def _validate_numerical_defaults(self, default): else: defaults_to_validate.append(default) for default_to_validate in defaults_to_validate: + if default_to_validate == '': + continue try: if self.type is int: int(default_to_validate) From a717e6a7983e8d3b5fdcd9ac0e1a0fab375e8646 Mon Sep 17 00:00:00 2001 From: M Bernt Date: Mon, 13 Jan 2020 14:28:13 +0100 Subject: [PATCH 2/2] validate docurl and shorten/empty if necessary --- CTDopts/CTDopts.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CTDopts/CTDopts.py b/CTDopts/CTDopts.py index 7548a54..4b8b05c 100644 --- a/CTDopts/CTDopts.py +++ b/CTDopts/CTDopts.py @@ -3,6 +3,7 @@ from itertools import chain from xml.etree.ElementTree import Element, SubElement, tostring, parse from xml.dom.minidom import parseString +import urllib2 import warnings # dummy classes for input-file and output-file CTD types. @@ -667,6 +668,15 @@ def _load_from_file(self, filename): for tool_opt_attrib in ['docurl', 'category']: if tool_opt_attrib in root.attrib: self.opt_attribs[tool_opt_attrib] = root.attrib[tool_opt_attrib] + # check if the URL actually exists (wrong URLs cause errors in Galaxy tests) + if self.opt_attribs.has_key('docurl'): + while self.opt_attribs['docurl'] != '': + try: + urllib2.urlopen(self.opt_attribs['docurl']) + break + except (urllib2.HTTPError, urllib2.URLError): + self.opt_attribs['docurl'] = '/'.join(self.opt_attribs['docurl'].split('/')[:-1]) + for tool_element in root: if tool_element.tag in ['manual', 'description', 'executableName', 'executablePath']: