From 07b2c79f5e624b805c4ca7aecb3320b0f00903c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Wed, 26 Oct 2005 18:32:58 +0000 Subject: [PATCH] * Release -> release, we're case sensitive * source is not a list * some more working no XmlFile support in autoxml, looking for a way :( --- pisi.e3p | 10 +++++++--- pisi/specfilenew.py | 6 ++++-- pisi/xmlfile.py | 9 +++++---- tests/xmlfiletests.py | 7 +++++-- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/pisi.e3p b/pisi.e3p index ab630a22..80f9738d 100644 --- a/pisi.e3p +++ b/pisi.e3p @@ -1,7 +1,7 @@ - + Python @@ -360,6 +360,10 @@ pisi atomicoperations.py + + tests + specfilenewtests.py + @@ -397,10 +401,10 @@ {'standardLayout': 1} - - + + diff --git a/pisi/specfilenew.py b/pisi/specfilenew.py index 37252bb8..7ad08a12 100644 --- a/pisi/specfilenew.py +++ b/pisi/specfilenew.py @@ -73,7 +73,7 @@ class Patch: class Update: - a_Release = [xmlfile.String, xmlfile.mandatory] + a_release = [xmlfile.String, xmlfile.mandatory] t_Date = [xmlfile.String, xmlfile.mandatory] t_Version = [xmlfile.String, xmlfile.mandatory] t_Type = [xmlfile.String, xmlfile.optional] @@ -168,7 +168,9 @@ class Package: class SpecFile(XmlFile): __metaclass__ = xmlfile.autoxml #needed when we specify a superclass - t_Source = [ [Source], xmlfile.mandatory, "Source"] + tag = "PISI" + + t_Source = [ Source, xmlfile.mandatory] t_Packages = [ [Package], xmlfile.mandatory, "Package"] t_History = [ [Update], xmlfile.mandatory, "Update"] diff --git a/pisi/xmlfile.py b/pisi/xmlfile.py index 231e14c7..82926610 100644 --- a/pisi/xmlfile.py +++ b/pisi/xmlfile.py @@ -199,9 +199,10 @@ class autoxml(oo.autosuper): #print 'generating class', name # add XmlFile as one of the superclasses of cls - bases = list(bases) - if not XmlFile in bases: - bases.append(XmlFile) + #bases = list(bases) + #if not XmlFile in bases: + # bases.append(XmlFile) + bases = (XmlFile) # standard initialization super(autoxml, cls).__init__(name, bases, dict) @@ -267,7 +268,7 @@ class autoxml(oo.autosuper): def check(self, where = unicode()): errs = [] for checker in self.__class__.checkers: - errs.extend(checker(self), where) + errs.extend(checker(self, where)) return errs cls.check = check diff --git a/tests/xmlfiletests.py b/tests/xmlfiletests.py index b7220825..743c0cfb 100644 --- a/tests/xmlfiletests.py +++ b/tests/xmlfiletests.py @@ -28,7 +28,7 @@ class XmlFileTestCase(unittest.TestCase): def testMetaClass(self): - class OtherInfo(object): + class OtherInfo: __metaclass__ = xmlfile.autoxml t_BirthDate = [types.StringType, xmlfile.mandatory] t_Interest = [types.StringType, xmlfile.optional] @@ -41,11 +41,14 @@ class XmlFileTestCase(unittest.TestCase): t_Number = [types.IntType, xmlfile.optional] t_Email = [types.StringType, xmlfile.optional] a_href = [types.StringType, xmlfile.mandatory] - t_Projects = [ [types.StringType], xmlfile.mandatory, 'Project'] + t_Projects = [ [types.StringType], xmlfile.mandatory, 'Project', ''] t_OtherInfo = [ OtherInfo, xmlfile.optional ] a = A() print A.__class__ + print super(A) + print A.__dict__ + print OtherInfo.__dict__ self.assertEqual(a.href, None) dom = mdom.parse('tests/a.xml') node = getNode(dom, 'A')