[Zope3-checkins] CVS: Zope3/src/zope/app/browser/container - adding.py:1.1.2.3
Fred L. Drake, Jr.
fred@zope.com
Tue, 24 Dec 2002 02:07:23 -0500
Update of /cvs-repository/Zope3/src/zope/app/browser/container
In directory cvs.zope.org:/tmp/cvs-serv19986
Modified Files:
Tag: NameGeddon-branch
adding.py
Log Message:
- fixup and organize imports
- normalize whitespace
=== Zope3/src/zope/app/browser/container/adding.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/browser/container/adding.py:1.1.2.2 Mon Dec 23 18:17:33 2002
+++ Zope3/src/zope/app/browser/container/adding.py Tue Dec 24 02:07:23 2002
@@ -2,33 +2,32 @@
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
$Id$
"""
-
from zope.app.interfaces.container import IAdding
from zope.app.interfaces.container import IContainerNamesContainer
+from zope.app.interfaces.container import IZopeContainer
+
+from zope.app.event.objectevent import ObjectCreatedEvent
+from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
+from zope.component import \
+ getView, getService, createObject, queryFactory, queryView, getAdapter
+from zope.event import publish
+from zope.proxy.context import ContextSuper, ContextMethod
from zope.publisher.browser import BrowserView
from zope.publisher.interfaces import IPublishTraverse
-from zope.component \
- import getView, getService, createObject, \
- queryFactory, queryView, getAdapter
-from Zope.App.PageTemplate import ViewPageTemplateFile
-from zope.proxy.context import ContextMethod
-from zope.event import publish
-from zope.app.event.objectevent import ObjectCreatedEvent
-from zope.app.interfaces.container import IZopeContainer
-from zope.proxy.context import ContextSuper
+
class Adding(BrowserView):
@@ -45,7 +44,7 @@
container = getAdapter(self.context, IZopeContainer)
name = container.setObject(self.contentName, content)
return container[name]
-
+
# See Zope.App.OFS.Container.Views.Browser.IAdding.IAdding
contentName = None # usually set by Adding traverser
@@ -70,7 +69,7 @@
# from: Zope.Publisher.IPublishTraverse.IPublishTraverse
def publishTraverse(self, request, name):
- if '=' in name:
+ if '=' in name:
view_name, content_name = name.split("=", 1)
self.contentName = content_name
@@ -86,7 +85,7 @@
return factory
publishTraverse = ContextMethod(publishTraverse)
-
+
#
############################################################
@@ -110,13 +109,12 @@
raise ValueError("You must specify an id")
self.contentName = id
-
+
content = createObject(self, type_name)
publish(self.context, ObjectCreatedEvent(content))
-
+
self.add(content)
self.request.response.redirect(self.nextURL())
def namesAccepted(self):
return not IContainerNamesContainer.isImplementedBy(self.context)
-