Author: jmorliaguet
Date: Mon Jun  5 23:50:10 2006
New Revision: 3330

Modified:
   cpsskins/branches/paris-sprint-2006/storage/storage.py

Log:

- fix: if no name is specified use the object type's name, this is better
  than the default container's name chooser's fallback that uses
  object.__class__.__name__



Modified: cpsskins/branches/paris-sprint-2006/storage/storage.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/storage/storage.py      (original)
+++ cpsskins/branches/paris-sprint-2006/storage/storage.py      Mon Jun  5 
23:50:10 2006
@@ -29,6 +29,7 @@
 from zope.traversing.api import getName
 
 from cpsskins.elements.interfaces import IElement
+from cpsskins.setup.interfaces import IType
 from cpsskins.storage.interfaces import IStorage
 
 class Storage(BTreeContainer, Contained):
@@ -39,6 +40,8 @@
     def add(self, object, name=u''):
         """Add an object to the storage.
         """
+        if not name:
+            name = IType(object).name
         chooser = INameChooser(self)
         name = chooser.chooseName(name, object)
         self[name] = object
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to