[Commits] (vajda) - RefDict.__contains__() now accepts None

commits at osafoundation.org commits at osafoundation.org
Tue Sep 28 15:10:55 PDT 2004


Commit by: vajda
Modified files:
chandler/repository/item/ItemRef.py 1.101 1.102

Log message:
   - RefDict.__contains__() now accepts None


ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/repository/item/ItemRef.py.diff?r1=text&tr1=1.101&r2=text&tr2=1.102

Index: chandler/repository/item/ItemRef.py
diff -u chandler/repository/item/ItemRef.py:1.101 chandler/repository/item/ItemRef.py:1.102
--- chandler/repository/item/ItemRef.py:1.101	Mon Sep 27 13:49:16 2004
+++ chandler/repository/item/ItemRef.py	Tue Sep 28 15:10:54 2004
@@ -1,6 +1,6 @@
 
-__revision__  = "$Revision: 1.101 $"
-__date__      = "$Date: 2004/09/27 20:49:16 $"
+__revision__  = "$Revision: 1.102 $"
+__date__      = "$Date: 2004/09/28 22:10:54 $"
 __copyright__ = "Copyright (c) 2002 Open Source Applications Foundation"
 __license__   = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -589,8 +589,16 @@
 
         To verify if there is a value for an alias, use the
         L{resolveAlias} method instead.
+
+        @param obj: the item or uuid sought
+        @type obj: an C{Item} instance, C{UUID} instance or C{None}
+        @return: C{False} if C{obj} is C{None} or is not this collection,
+        C{True} otherwise.
         """
 
+        if obj is None:
+            return False
+        
         load = not self._item.isNew()
         if isinstance(obj, ItemPackage.Item.Item):
             return self.has_key(obj._uuid, load)
@@ -977,12 +985,15 @@
 
         Raises C{NoSuchItemError} if the item is not in this collection.
 
-        @return the 0-based position of the item in the index.
+        @param indexName: the name of the index to search
+        @type indexName: a string
+        @param item: the item sought
+        @type item: an C{Item} instance
+        @return: the 0-based position of the item in the index.
         """
 
-        uuid = item._uuid
-        if uuid in self:
-            return self._index(indexName).getPosition(uuid)
+        if item in self:
+            return self._index(indexName).getPosition(item._uuid)
         else:
             raise NoSuchItemError, (self, item)
 



More information about the Commits mailing list