daemon: Renumber XML versioning.
Consider the current XML representation version 0.0.
This commit is contained in:
parent
bc3ba68b28
commit
899b5ae5be
2 changed files with 6 additions and 6 deletions
|
@ -4,13 +4,13 @@
|
||||||
|
|
||||||
from xml.dom.minidom import parse
|
from xml.dom.minidom import parse
|
||||||
from xmlutils import getoneelement
|
from xmlutils import getoneelement
|
||||||
from xmlparser1 import CoreDocumentParser1
|
from xmlparser0 import CoreDocumentParser0
|
||||||
|
|
||||||
class CoreVersionParser(object):
|
class CoreVersionParser(object):
|
||||||
'''\
|
'''\
|
||||||
Helper class to check the version of Network Plan document. This
|
Helper class to check the version of Network Plan document. This
|
||||||
simply looks for a "Scenario" element; when present, this
|
simply looks for a "Scenario" element; when present, this
|
||||||
indicates a 1.0 version document. The dom member is set in order
|
indicates a 0.0 version document. The dom member is set in order
|
||||||
to prevent parsing a file twice (it can be passed to the
|
to prevent parsing a file twice (it can be passed to the
|
||||||
appropriate CoreDocumentParser class.)
|
appropriate CoreDocumentParser class.)
|
||||||
'''
|
'''
|
||||||
|
@ -21,7 +21,7 @@ class CoreVersionParser(object):
|
||||||
self.dom = parse(filename)
|
self.dom = parse(filename)
|
||||||
self.scenario = getoneelement(self.dom, 'Scenario')
|
self.scenario = getoneelement(self.dom, 'Scenario')
|
||||||
if self.scenario is not None:
|
if self.scenario is not None:
|
||||||
self.version = 1.0
|
self.version = 0.0
|
||||||
else:
|
else:
|
||||||
self.version = 'unknown'
|
self.version = 'unknown'
|
||||||
|
|
||||||
|
@ -29,8 +29,8 @@ def core_document_parser(session, filename, options):
|
||||||
vp = CoreVersionParser(filename, options)
|
vp = CoreVersionParser(filename, options)
|
||||||
if 'dom' not in options:
|
if 'dom' not in options:
|
||||||
options['dom'] = vp.dom
|
options['dom'] = vp.dom
|
||||||
if vp.version == 1.0:
|
if vp.version == 0.0:
|
||||||
doc = CoreDocumentParser1(session, filename, options)
|
doc = CoreDocumentParser0(session, filename, options)
|
||||||
else:
|
else:
|
||||||
raise ValueError, 'unsupported document version: %s' % vp.version
|
raise ValueError, 'unsupported document version: %s' % vp.version
|
||||||
return doc
|
return doc
|
||||||
|
|
|
@ -10,7 +10,7 @@ from core.netns import nodes
|
||||||
from xml.dom.minidom import parse
|
from xml.dom.minidom import parse
|
||||||
from xmlutils import *
|
from xmlutils import *
|
||||||
|
|
||||||
class CoreDocumentParser1(object):
|
class CoreDocumentParser0(object):
|
||||||
def __init__(self, session, filename, options):
|
def __init__(self, session, filename, options):
|
||||||
self.session = session
|
self.session = session
|
||||||
self.verbose = self.session.getcfgitembool('verbose', False)
|
self.verbose = self.session.getcfgitembool('verbose', False)
|
Loading…
Reference in a new issue