[Zope3-checkins] CVS: Zope3/src/zope/app/browser/container -
adding.py:1.40
Sidnei da Silva
sidnei at x3ng.com.br
Wed Dec 17 16:28:02 EST 2003
Update of /cvs-repository/Zope3/src/zope/app/browser/container
In directory cvs.zope.org:/tmp/cvs-serv14741/src/zope/app/browser/container
Modified Files:
adding.py
Log Message:
Small refactoring to make it easier to reuse the SchemaUtility on different contexts (like, storing the fields on a RDBMS)
=== Zope3/src/zope/app/browser/container/adding.py 1.39 => 1.40 ===
--- Zope3/src/zope/app/browser/container/adding.py:1.39 Wed Dec 17 07:40:29 2003
+++ Zope3/src/zope/app/browser/container/adding.py Wed Dec 17 16:27:31 2003
@@ -50,23 +50,23 @@
container = self.context
name = self.contentName
chooser = zapi.getAdapter(container, INameChooser)
-
+
if IContainerNamesContainer.isImplementedBy(container):
# The container pick's it's own names.
# We need to ask it to pick one.
name = chooser.chooseName(self.contentName or '', content)
else:
- request = self.request
- name = request.get('add_input_name',name)
+ request = self.request
+ name = request.get('add_input_name', name)
if name is None:
name = chooser.chooseName(self.contentName or '', content)
- elif name=='':
+ elif name == '':
name = chooser.chooseName('', content)
chooser.checkName(name, container)
container[name] = content
- self.contentName = name #Set the added object Name
+ self.contentName = name # Set the added object Name
return container[name]
contentName = None # usually set by Adding traverser
@@ -200,10 +200,10 @@
elif item['extra']['factory'] != item['action']:
item['has_custom_add_view']=True
result.append(item)
-
+
result.sort(lambda a, b: cmp(a['title'], b['title']))
return result
-
+
def isSingleMenuItem(self):
"Return whether there is single menu item or not."
return len(self.addingInfo()) == 1
@@ -215,7 +215,7 @@
if 'has_custom_add_view' in menu_item:
return True
return False
-
+
class ContentAdding(Adding):
menu_id = "add_content"
More information about the Zope3-Checkins
mailing list