Skip to content

Commit 652e7d2

Browse files
committed
Add template title and correct (long) description
1 parent ab6e684 commit 652e7d2

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

intermine/query.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ def __init__(self, model, service=None, validate=True, root=None):
337337
self.root = model.make_path(root).root
338338

339339
self.name = ''
340+
self.title = ''
340341
self.description = ''
341342
self.service = service
342343
self.prefetch_depth = service.prefetch_depth if service is not None else 1
@@ -423,13 +424,20 @@ def from_xml(cls, xml, *args, **kwargs):
423424
doc = minidom.parse(f)
424425
f.close()
425426

427+
templates = doc.getElementsByTagName('template')
428+
if len(templates) != 1:
429+
raise QueryParseError("wrong number of templates in xml. "
430+
+ "Only one <template> element is allowed. Found %d" % len(templates))
431+
t = templates[0]
432+
obj.title = t.getAttribute('title')
433+
426434
queries = doc.getElementsByTagName('query')
427435
if len(queries) != 1:
428436
raise QueryParseError("wrong number of queries in xml. "
429437
+ "Only one <query> element is allowed. Found %d" % len(queries))
430438
q = queries[0]
431439
obj.name = q.getAttribute('name')
432-
obj.description = q.getAttribute('description')
440+
obj.description = q.getAttribute('longDescription')
433441
obj.add_view(q.getAttribute('view'))
434442
for p in q.getElementsByTagName('pathDescription'):
435443
path = p.getAttribute('pathString')

0 commit comments

Comments
 (0)