[Zope3-checkins] CVS: Zope3/src/zope/app/container - zopecontainer.py:1.18.2.1

Zachery Bir zbir@urbanape.com
Tue, 3 Jun 2003 09:18:58 -0400


Update of /cvs-repository/Zope3/src/zope/app/container
In directory cvs.zope.org:/tmp/cvs-serv19150

Modified Files:
      Tag: pluggable_authentication_service-branch
	zopecontainer.py 
Log Message:
Changed order of conditions to make more sense after Jim's suggestion


=== Zope3/src/zope/app/container/zopecontainer.py 1.18 => 1.18.2.1 ===
--- Zope3/src/zope/app/container/zopecontainer.py:1.18	Sun Jun  1 11:59:29 2003
+++ Zope3/src/zope/app/container/zopecontainer.py	Tue Jun  3 09:18:57 2003
@@ -87,16 +87,17 @@
     def setObject(self, key, object):
         "See IZopeWriteContainer"
 
-        if not isinstance(key, StringTypes):
-            raise TypeError("Item name is not a string.")
-
         container = self.context
 
         if not key:
             if not (IOptionalNamesContainer.isImplementedBy(container)
                     or IContainerNamesContainer.isImplementedBy(container)):
                 raise ValueError("Empty names are not allowed")
-
+            key = ''
+        else:
+            if not isinstance(key, StringTypes):
+                raise TypeError("Item name is not a string.")
+            
         # We remove the proxies from the object before adding it to
         # the container, because we can't store proxies.
         object = removeAllProxies(object)