[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Container/Views/Browser - Adder.py:1.1.2.4.6.1
Jim Fulton
jim@zope.com
Sat, 27 Apr 2002 16:24:41 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Container/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv15183
Modified Files:
Tag: SecurityProxy-branch
Adder.py
Log Message:
Added code to remove proxies before adding an object.
=== Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/Adder.py 1.1.2.4 => 1.1.2.4.6.1 ===
from Zope.ComponentArchitecture.ContextDependent import ContextDependent
from Zope.App.OFS.Container.Exceptions import DuplicateIDError
+from Zope.Proxy.ProxyIntrospection import removeAllProxies
class ContainerAdder(AttributePublisher, ContextDependent):
@@ -47,7 +48,14 @@
if id in context.objectIds():
raise DuplicateIDError, "ID '%s' already in use." % id
- context.setObject(id, createObject(context, type_name))
+ # Create the new object
+ new_object = createObject(context, type_name)
+
+ # Remove thye security proxy and context wrappers, if any.
+ # It's a good thing this is trusted code. :)
+ new_object = removeAllProxies(new_object)
+
+ context.setObject(id, new_object)
if REQUEST is not None:
# for unit tests