[Commits] (vajda) - removed Kind._getSuperKinds()
commits at osafoundation.org
commits at osafoundation.org
Thu Aug 5 06:57:40 PDT 2004
Commit by: vajda
Modified files:
chandler/repository/item/Item.py 1.150 1.151
chandler/repository/packs/schema/model/Item.kind 1.13 1.14
chandler/repository/packs/schema/model/Kind.kind 1.25 1.26
chandler/repository/schema/Cloud.py 1.12 1.13
chandler/repository/schema/Kind.py 1.80 1.81
chandler/repository/tests/TestKinds.py 1.7 1.8
chandler/repository/tests/TestReferenceAttributes.py 1.21 1.22
Log message:
- removed Kind._getSuperKinds()
ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/repository/item/Item.py.diff?r1=text&tr1=1.150&r2=text&tr2=1.151
http://cvs.osafoundation.org/index.cgi/chandler/repository/packs/schema/model/Item.kind.diff?r1=text&tr1=1.13&r2=text&tr2=1.14
http://cvs.osafoundation.org/index.cgi/chandler/repository/packs/schema/model/Kind.kind.diff?r1=text&tr1=1.25&r2=text&tr2=1.26
http://cvs.osafoundation.org/index.cgi/chandler/repository/schema/Cloud.py.diff?r1=text&tr1=1.12&r2=text&tr2=1.13
http://cvs.osafoundation.org/index.cgi/chandler/repository/schema/Kind.py.diff?r1=text&tr1=1.80&r2=text&tr2=1.81
http://cvs.osafoundation.org/index.cgi/chandler/repository/tests/TestKinds.py.diff?r1=text&tr1=1.7&r2=text&tr2=1.8
http://cvs.osafoundation.org/index.cgi/chandler/repository/tests/TestReferenceAttributes.py.diff?r1=text&tr1=1.21&r2=text&tr2=1.22
Index: chandler/repository/item/Item.py
diff -u chandler/repository/item/Item.py:1.150 chandler/repository/item/Item.py:1.151
--- chandler/repository/item/Item.py:1.150 Tue Aug 3 17:10:24 2004
+++ chandler/repository/item/Item.py Thu Aug 5 06:57:37 2004
@@ -1,6 +1,6 @@
-__revision__ = "$Revision: 1.150 $"
-__date__ = "$Date: 2004/08/04 00:10:24 $"
+__revision__ = "$Revision: 1.151 $"
+__date__ = "$Date: 2004/08/05 13:57:37 $"
__copyright__ = "Copyright (c) 2002 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -1621,7 +1621,7 @@
superKinds = []
if self._kind is not None:
if self._kind.isMixin():
- superKinds[:] = self._kind._getSuperKinds()
+ superKinds[:] = self._kind.superKinds
else:
superKinds.append(self._kind)
Index: chandler/repository/schema/Kind.py
diff -u chandler/repository/schema/Kind.py:1.80 chandler/repository/schema/Kind.py:1.81
--- chandler/repository/schema/Kind.py:1.80 Sat Jul 31 08:41:46 2004
+++ chandler/repository/schema/Kind.py Thu Aug 5 06:57:38 2004
@@ -1,6 +1,6 @@
-__revision__ = "$Revision: 1.80 $"
-__date__ = "$Date: 2004/07/31 15:41:46 $"
+__revision__ = "$Revision: 1.81 $"
+__date__ = "$Date: 2004/08/05 13:57:38 $"
__copyright__ = "Copyright (c) 2002 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -71,7 +71,7 @@
superClasses = []
hash = UUIDext.combine(0, self._uuid._hash)
- for superKind in self._getSuperKinds():
+ for superKind in self.superKinds:
c = superKind.getItemClass()
if c is not Item and c not in superClasses:
superClasses.append(c)
@@ -100,8 +100,9 @@
if not self.getAttributeValue('superKinds', default=None,
_attrDict = self._references):
- self.itsView.logger.warn('No superKinds for %s', self.itsPath)
- result = False
+ if self is not self.getItemKind():
+ self.itsView.logger.warn('No superKinds for %s', self.itsPath)
+ result = False
return result
@@ -214,7 +215,7 @@
if inherited:
inheritedAttributes = self.inheritedAttributes
- for superKind in self._getSuperKinds():
+ for superKind in self.superKinds:
for name, attribute in superKind.iterAttributes():
if (attribute._uuid not in inheritedAttributes and
inheritedAttributes.resolveAlias(name) is None):
@@ -230,7 +231,7 @@
return None
cache = True
- for superKind in self._getSuperKinds():
+ for superKind in self.superKinds:
if superKind is not None:
try:
attribute = superKind.getAttribute(name)
@@ -251,16 +252,6 @@
return None
- def _getSuperKinds(self):
-
- superKinds = self.getAttributeValue('superKinds', default=None,
- _attrDict=self._references)
- if not superKinds:
- self.itsView.logger.warn('No superKinds for %s', self.itsPath)
- return [ self.getItemKind() ]
-
- return superKinds
-
def getItemKind(self):
return self._kind.itsParent['Item']
@@ -320,9 +311,9 @@
if self is superKind:
return True
- superKinds = self._getSuperKinds()
+ superKinds = self.superKinds
- if superKinds:
+ if len(superKinds) > 0:
for kind in superKinds:
if kind is superKind:
return True
@@ -479,7 +470,7 @@
if clouds is None or (cloudAlias is not None and
clouds.resolveAlias(cloudAlias) is None):
- for superKind in self._getSuperKinds():
+ for superKind in self.superKinds:
results.extend(superKind.getClouds(cloudAlias))
elif cloudAlias is not None:
@@ -492,12 +483,3 @@
NoneString = "__NONE__"
-
-
-class ItemKind(Kind):
-
- def _getSuperKinds(self):
- return []
-
- def check(self, recursive=False):
- return super(Kind, self).check(recursive)
Index: chandler/repository/packs/schema/model/Item.kind
diff -u chandler/repository/packs/schema/model/Item.kind:1.13 chandler/repository/packs/schema/model/Item.kind:1.14
--- chandler/repository/packs/schema/model/Item.kind:1.13 Tue Mar 23 21:08:33 2004
+++ chandler/repository/packs/schema/model/Item.kind Thu Aug 5 06:57:37 2004
@@ -5,7 +5,11 @@
<item withSchema="True">
<name>Item</name>
<kind type="path">//Schema/Core/Kind</kind>
- <class module="repository.schema.Kind">ItemKind</class>
+ <class module="repository.schema.Kind">Kind</class>
+
+ <ref name="superKinds" cardinality="list"
+ otherName="subKinds" otherCard="list">
+ </ref>
<ref name="attributes" otherName="kinds" cardinality="list"
otherCard="list">
Index: chandler/repository/schema/Cloud.py
diff -u chandler/repository/schema/Cloud.py:1.12 chandler/repository/schema/Cloud.py:1.13
--- chandler/repository/schema/Cloud.py:1.12 Tue Aug 3 12:53:03 2004
+++ chandler/repository/schema/Cloud.py Thu Aug 5 06:57:38 2004
@@ -1,6 +1,6 @@
-__revision__ = "$Revision: 1.12 $"
-__date__ = "$Date: 2004/08/03 19:53:03 $"
+__revision__ = "$Revision: 1.13 $"
+__date__ = "$Date: 2004/08/05 13:57:38 $"
__copyright__ = "Copyright (c) 2002 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -218,7 +218,7 @@
yield (endpoints.getAlias(endpoint), endpoint, self)
if cloudAlias is not None:
- for superKind in self.kind._getSuperKinds():
+ for superKind in self.kind.superKinds:
for cloud in superKind.getClouds(cloudAlias):
for (alias, endpoint,
inCloud) in cloud.iterEndpoints(cloudAlias):
@@ -248,7 +248,7 @@
if cloudAlias is not None:
results = []
- for superKind in self.kind._getSuperKinds():
+ for superKind in self.kind.superKinds:
for cloud in superKind.getClouds(cloudAlias):
results.extend(cloud.getEndpoints(cloudAlias, alias))
return results
Index: chandler/repository/packs/schema/model/Kind.kind
diff -u chandler/repository/packs/schema/model/Kind.kind:1.25 chandler/repository/packs/schema/model/Kind.kind:1.26
--- chandler/repository/packs/schema/model/Kind.kind:1.25 Tue Jul 6 11:02:03 2004
+++ chandler/repository/packs/schema/model/Kind.kind Thu Aug 5 06:57:37 2004
@@ -75,6 +75,7 @@
<attribute name="cardinality">list</attribute>
<attribute name="otherName">subKinds</attribute>
+ <attribute name="initialValue" type="list"></attribute>
</item>
<item withSchema="True">
Index: chandler/repository/tests/TestKinds.py
diff -u chandler/repository/tests/TestKinds.py:1.7 chandler/repository/tests/TestKinds.py:1.8
--- chandler/repository/tests/TestKinds.py:1.7 Thu Jul 29 07:07:14 2004
+++ chandler/repository/tests/TestKinds.py Thu Aug 5 06:57:38 2004
@@ -2,8 +2,8 @@
Unit tests for kinds
"""
-__revision__ = "$Revision: 1.7 $"
-__date__ = "$Date: 2004/07/29 14:07:14 $"
+__revision__ = "$Revision: 1.8 $"
+__date__ = "$Date: 2004/08/05 13:57:38 $"
__copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -24,6 +24,7 @@
self.attrKind = self.itemKind.itsParent['Attribute']
self.kind1 = self.kind.newItem('kind1',self.rep)
+ self.kind1.addValue('superKinds', self.itemKind)
self.kind1Attr1 = Attribute('k1a1', self.rep, self.attrKind)
self.kind1Attr1.cardinality = 'list'
self.kind1Attr1.otherName = 'owner'
@@ -38,6 +39,7 @@
pass
self.kind2 = self.kind.newItem('kind2', self.kind1)
+ self.kind2.addValue('superKinds', self.itemKind)
self.kind2.addValue('attributes', self.kind1Attr1, alias='k1a1')
self.kind2Attr2 = Attribute('k2a2', self.rep, self.attrKind)
self.kind2Attr2.cardinality = 'list'
Index: chandler/repository/tests/TestReferenceAttributes.py
diff -u chandler/repository/tests/TestReferenceAttributes.py:1.21 chandler/repository/tests/TestReferenceAttributes.py:1.22
--- chandler/repository/tests/TestReferenceAttributes.py:1.21 Wed Aug 4 17:09:17 2004
+++ chandler/repository/tests/TestReferenceAttributes.py Thu Aug 5 06:57:38 2004
@@ -2,8 +2,8 @@
Unit tests for reference attributes
"""
-__revision__ = "$Revision: 1.21 $"
-__date__ = "$Date: 2004/08/05 00:09:17 $"
+__revision__ = "$Revision: 1.22 $"
+__date__ = "$Date: 2004/08/05 13:57:38 $"
__copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -223,7 +223,7 @@
(manager, [emp1, emp2, emp3, emp4]) = self._findManagerAndEmployees('//bossA','//employeeA1','//employeeA2','//employeeA3','//employeeA4')
self._checkManagerAndEmployees(manager, [ emp1, emp2, emp3, emp4 ])
- # now test reassigning the same refdictionary
+ # now test reassigning the same ref collection
numEmployees = len(manager.employees)
manager.employees = manager.employees
self.assert_(len(manager.employees) == numEmployees)
@@ -236,7 +236,7 @@
manager.employees = empClone
print "manager has %d employees" % len(manager.employees)
print "manager has %d employee values" % len(manager.employees.values())
- #self.assert_(len(manager.employees) == numEmployees)
+ self.assert_(len(manager.employees) == numEmployees)
def testSubAttributes(self):
"""Test attributes which have sub attributes (subAttributes and superAttribute attributes)"""
More information about the Commits
mailing list