From 3bfc029ef601b296fde3599561a00a450bf102f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Mon, 31 Oct 2005 17:34:20 +0000 Subject: [PATCH] * fix: autoxml based write routine for SpecFile * fix: use context dammit! --- pisi/specfilenew.py | 7 ++++--- tests/specfilenewtests.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pisi/specfilenew.py b/pisi/specfilenew.py index 6a0ed677..9fcda5b6 100644 --- a/pisi/specfilenew.py +++ b/pisi/specfilenew.py @@ -268,8 +268,9 @@ class SpecFile(XmlFile): def write(self, filename): """Write PSPEC file""" + errs = [] self.newDOM() - self.addChild(self.source.elt(self)) - for pkg in self.packages: - self.addChild(pkg.elt(self)) + self.encode(self, self.rootNode(), errs) + if errs: + raise Error(*errs) self.writexml(filename) diff --git a/tests/specfilenewtests.py b/tests/specfilenewtests.py index cb16f23e..d199b699 100644 --- a/tests/specfilenewtests.py +++ b/tests/specfilenewtests.py @@ -78,6 +78,6 @@ class SpecFileNewTestCase(testcase.TestCase): def testCopy(self): util.check_dir(ctx.config.tmp_dir()) self.spec.read("tests/popt/pspec.xml") - self.spec.write(os.path.join(config.tmp_dir(), 'popt-copy.pspec.xml')) + self.spec.write(os.path.join(ctx.config.tmp_dir(), 'popt-copy.pspec.xml')) suite = unittest.makeSuite(SpecFileNewTestCase)