Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow empyt value for optional numeric inputs #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CTDopts/CTDopts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -440,6 +441,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)
Expand Down Expand Up @@ -665,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']:
Expand Down