diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2005-11-28 21:39:04 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2005-11-28 21:39:04 +0000 |
commit | 7fcb71a1a06b4656b75bfa653b13667506cf5ed7 (patch) | |
tree | f28c8bb3a00c001d167dd72f5cd74ef21f67a395 /src/lib | |
parent | e8246855ff91bb1735f998417e86ee12b3ea65b5 (diff) | |
download | bcfg2-7fcb71a1a06b4656b75bfa653b13667506cf5ed7.tar.gz bcfg2-7fcb71a1a06b4656b75bfa653b13667506cf5ed7.tar.bz2 bcfg2-7fcb71a1a06b4656b75bfa653b13667506cf5ed7.zip |
switch to etree errors
(Logical change 1.368)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1552 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Server/Plugins/Base.py | 5 | ||||
-rw-r--r-- | src/lib/Server/Plugins/Bundler.py | 7 | ||||
-rw-r--r-- | src/lib/Server/Plugins/TCheetah.py | 5 |
3 files changed, 7 insertions, 10 deletions
diff --git a/src/lib/Server/Plugins/Base.py b/src/lib/Server/Plugins/Base.py index 0b912cb01..71719263f 100644 --- a/src/lib/Server/Plugins/Base.py +++ b/src/lib/Server/Plugins/Base.py @@ -2,8 +2,7 @@ __revision__ = '$Revision$' from copy import deepcopy -from lxml.etree import Element, XML -from xml.parsers.expat import ExpatError +from lxml.etree import Element, XML, XMLSyntaxError from Bcfg2.Server.Plugin import Plugin, PluginInitError, SingleXMLFileBacked @@ -27,7 +26,7 @@ class Base(Plugin, SingleXMLFileBacked): '''Store XML data in reasonable structures''' try: xdata = XML(self.data) - except ExpatError: + except XMLSyntaxError: self.LogError("Failed to parse base.xml") return self.store = {'all':[], 'Class':{'all':[]}, 'Image':{'all':[]}, 'all':[]} diff --git a/src/lib/Server/Plugins/Bundler.py b/src/lib/Server/Plugins/Bundler.py index c602dceb7..86c52b9e2 100644 --- a/src/lib/Server/Plugins/Bundler.py +++ b/src/lib/Server/Plugins/Bundler.py @@ -3,8 +3,7 @@ __revision__ = '$Revision$' from copy import deepcopy from syslog import LOG_ERR, syslog -from lxml.etree import Element, XML -from xml.parsers.expat import ExpatError +from lxml.etree import Element, XML, XMLSyntaxError from Bcfg2.Server.Plugin import Plugin, SingleXMLFileBacked, XMLFileBacked, DirectoryBacked @@ -19,7 +18,7 @@ class ImageFile(SingleXMLFileBacked): '''Build data structures out of the data''' try: xdata = XML(self.data) - except ExpatError, err: + except XMLSyntaxError, err: syslog(LOG_ERR, "Failed to parse file %s" % (self.name)) syslog(LOG_ERR, err) del self.data @@ -43,7 +42,7 @@ class Bundle(XMLFileBacked): '''Build data structures from the source data''' try: xdata = XML(self.data) - except ExpatError, err: + except XMLSyntaxError, err: syslog(LOG_ERR, "Failed to parse file %s" % (self.name)) syslog(LOG_ERR, str(err)) del self.data diff --git a/src/lib/Server/Plugins/TCheetah.py b/src/lib/Server/Plugins/TCheetah.py index 314a5b0ac..f39ebbad0 100644 --- a/src/lib/Server/Plugins/TCheetah.py +++ b/src/lib/Server/Plugins/TCheetah.py @@ -4,8 +4,7 @@ __revision__ = '$Revision$' from posixpath import isdir from syslog import syslog, LOG_ERR from Bcfg2.Server.Plugin import Plugin, PluginExecutionError, FileBacked, SingleXMLFileBacked -from lxml.etree import XML -from xml.parsers.expat import ExpatError +from lxml.etree import XML, XMLSyntaxError from Cheetah.Template import Template class TemplateFile(FileBacked): @@ -38,7 +37,7 @@ class CheetahProperties(SingleXMLFileBacked): try: self.properties = XML(self.data) del self.data - except ExpatError: + except XMLSyntaxError: syslog(LOG_ERR, "TCheetah: Failed to parse properties") class TCheetah(Plugin): |