daemon: Renumber XML versioning.

Consider the current XML representation version 0.0.
This commit is contained in:
tgoff0 2015-02-05 00:15:59 +00:00
parent bc3ba68b28
commit 899b5ae5be
2 changed files with 6 additions and 6 deletions

View file

@ -4,13 +4,13 @@
from xml.dom.minidom import parse
from xmlutils import getoneelement
from xmlparser1 import CoreDocumentParser1
from xmlparser0 import CoreDocumentParser0
class CoreVersionParser(object):
'''\
Helper class to check the version of Network Plan document. 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
appropriate CoreDocumentParser class.)
'''
@ -21,7 +21,7 @@ class CoreVersionParser(object):
self.dom = parse(filename)
self.scenario = getoneelement(self.dom, 'Scenario')
if self.scenario is not None:
self.version = 1.0
self.version = 0.0
else:
self.version = 'unknown'
@ -29,8 +29,8 @@ def core_document_parser(session, filename, options):
vp = CoreVersionParser(filename, options)
if 'dom' not in options:
options['dom'] = vp.dom
if vp.version == 1.0:
doc = CoreDocumentParser1(session, filename, options)
if vp.version == 0.0:
doc = CoreDocumentParser0(session, filename, options)
else:
raise ValueError, 'unsupported document version: %s' % vp.version
return doc

View file

@ -10,7 +10,7 @@ from core.netns import nodes
from xml.dom.minidom import parse
from xmlutils import *
class CoreDocumentParser1(object):
class CoreDocumentParser0(object):
def __init__(self, session, filename, options):
self.session = session
self.verbose = self.session.getcfgitembool('verbose', False)