commit/galaxy-central: carlfeberhard: Visualizations registry: remove ElementTree doctype deprecation warning
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/2e13b048a9b7/ Changeset: 2e13b048a9b7 User: carlfeberhard Date: 2015-02-12 19:47:45+00:00 Summary: Visualizations registry: remove ElementTree doctype deprecation warning Affected #: 1 file diff -r 45072dc79c5c8a5d6f1bbc9883e25bb3cb8b6319 -r 2e13b048a9b707224b1f499dbdaf12a45ffd413c lib/galaxy/visualization/registry.py --- a/lib/galaxy/visualization/registry.py +++ b/lib/galaxy/visualization/registry.py @@ -7,6 +7,8 @@ import os import shutil import glob +from xml.etree import ElementTree +from xml.etree import ElementInclude from galaxy import util import galaxy.model @@ -83,6 +85,16 @@ return True +def parse_xml( fname ): + # handle deprecation warning for XMLParsing a file with DOCTYPE + class DoctypeSafeCallbackTarget( ElementTree.TreeBuilder ): + def doctype( *args ): + pass + tree = ElementTree.ElementTree() + root = tree.parse( fname, parser=ElementTree.XMLParser( target=DoctypeSafeCallbackTarget() ) ) + ElementInclude.include( root ) + return tree + # ------------------------------------------------------------------- the registry class VisualizationsRegistry( pluginframework.PageServingPluginManager ): @@ -394,7 +406,7 @@ Parse the given XML file for visualizations data. :returns: visualization config dictionary """ - xml_tree = galaxy.util.parse_xml( xml_filepath ) + xml_tree = parse_xml( xml_filepath ) visualization = self.parse_visualization( xml_tree.getroot() ) return visualization @@ -416,7 +428,7 @@ # allow manually turning off a vis by checking for a disabled property if 'disabled' in xml_tree.attrib: - log.info( '%s, plugin disabled: %s. Skipping...', self, returned[ 'name' ] ) + log.info( 'Visualizations plugin disabled: %s. Skipping...', returned[ 'name' ] ) return None # record the embeddable flag - defaults to false Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org