[Zope3-checkins] CVS: Zope3/src/zope/app/content - dtmlpage.py:1.6.24.1 folder.py:1.15.2.1 fssync.py:1.11.24.1 sql.py:1.8.24.1 zpt.py:1.15.4.1

Jim Fulton jim at zope.com
Mon Sep 8 15:22:06 EDT 2003


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

Modified Files:
      Tag: parentgeddon-branch
	dtmlpage.py folder.py fssync.py sql.py zpt.py 
Log Message:
Checking in work in progress on parentgeddon-branch so Fred can help
me to get the tests passing.  Specific log entries will be provided
when we merge this into the head.


=== Zope3/src/zope/app/content/dtmlpage.py 1.6 => 1.6.24.1 ===
--- Zope3/src/zope/app/content/dtmlpage.py:1.6	Sat Jun  7 02:37:23 2003
+++ Zope3/src/zope/app/content/dtmlpage.py	Mon Sep  8 14:21:35 2003
@@ -22,13 +22,12 @@
 from zope.app.interfaces.file import IFileFactory
 from zope.interface import implements
 
-from zope.context import ContextMethod
-from zope.context import getWrapperContainer
 from zope.security.proxy import ProxyFactory
 
 from zope.documenttemplate.dt_html import HTML
+from zope.app.container.contained import Contained
 
-class DTMLPage(Persistent):
+class DTMLPage(Persistent, Contained):
 
     # XXX Putting IFileContent at the end gives an error!
     implements(IFileContent, IDTMLPage, IRenderDTMLPage, IAnnotatable)
@@ -48,7 +47,7 @@
     def render(self, request, *args, **kw):
         """See interface IDTMLRenderPage"""
 
-        instance = ProxyFactory(getWrapperContainer(self))
+        instance = ProxyFactory(self.__parent__)
         request = ProxyFactory(request)
 
         for k in kw:
@@ -57,8 +56,6 @@
 
         return self.template(instance, request, **kw)
 
-
-    render = ContextMethod(render)
 
     __call__ = render
 


=== Zope3/src/zope/app/content/folder.py 1.15 => 1.15.2.1 ===
--- Zope3/src/zope/app/content/folder.py:1.15	Tue Sep  2 16:46:46 2003
+++ Zope3/src/zope/app/content/folder.py	Mon Sep  8 14:21:35 2003
@@ -19,11 +19,11 @@
 from zope.app.interfaces.content.folder import IFolder, IRootFolder
 from zope.app.interfaces.services.service import ISite
 from zope.app.services.servicecontainer import ServiceManagerContainer
-from zope.app.zapi import ContextWrapper
 from zope.exceptions import DuplicationError
 from zope.interface import implements
+from zope.app.container.contained import Contained, contained, uncontained
 
-class Folder(Persistent, ServiceManagerContainer):
+class Folder(Persistent, ServiceManagerContainer, Contained):
     """The standard Zope Folder implementation."""
 
     implements(IFolder, ICloneWithoutChildren)
@@ -92,12 +92,13 @@
         if name in self.data:
             raise DuplicationError("name, %s, is already in use" % name)
 
-        self.data[name] = object
+        self.data[name] = contained(object, self, name)
         return name
 
     def __delitem__(self, name):
         """Delete the named object from the folder. Raises a KeyError
            if the object is not found."""
+        uncontained(self.data[name])
         del self.data[name]
 
     def cloneWithoutChildren(self):
@@ -172,6 +173,5 @@
         result = super(FolderAdapter, self).contents()
         if ISite.isImplementedBy(self.context):
             sm = self.context.getSiteManager()
-            w = ContextWrapper(sm, self.context, name='++etc++site')
-            result.append(('++etc++site', w))
+            result.append(('++etc++site', sm))
         return result


=== Zope3/src/zope/app/content/fssync.py 1.11 => 1.11.24.1 ===
--- Zope3/src/zope/app/content/fssync.py:1.11	Sat Jun  7 02:37:23 2003
+++ Zope3/src/zope/app/content/fssync.py	Mon Sep  8 14:21:35 2003
@@ -18,7 +18,6 @@
 
 from zope.app.fssync.classes import ObjectEntryAdapter, AttrMapping
 from zope.app.interfaces.fssync import IObjectFile, IContentDirectory
-from zope.app.context import ContextWrapper
 from zope.interface import implements
 
 class FileAdapter(ObjectEntryAdapter):
@@ -43,7 +42,6 @@
     def contents(self):
         result = []
         for name, object in self.context.items():
-            object = ContextWrapper(object, self.context, name=name)
             result.append((name, object))
         return result
 


=== Zope3/src/zope/app/content/sql.py 1.8 => 1.8.24.1 ===
--- Zope3/src/zope/app/content/sql.py:1.8	Fri Jun 13 13:41:15 2003
+++ Zope3/src/zope/app/content/sql.py	Mon Sep  8 14:21:35 2003
@@ -159,13 +159,13 @@
 
 from zope.interface import implements
 from zope.component import getService
-from zope.context import ContextMethod, ContextProperty
 
 from zope.app.cache.caching import getCacheForObj, getLocationForCache
 from zope.app.interfaces.content.file import IFileContent
 from zope.app.interfaces.content.sql import ISQLScript, MissingInput
 from zope.app.rdb import SQLCommand
 from zope.app.rdb import queryForResults
+from zope.app.container.contained import Contained
 
 unparmre = re.compile(r'([\000- ]*([^\000- ="]+))')
 parmre = re.compile(r'([\000- ]*([^\000- ="]+)=([^\000- ="]+))')
@@ -635,7 +635,7 @@
     commands['sqlgroup' ] = SQLGroup
 
 
-class SQLScript(SQLCommand, Persistent):
+class SQLScript(SQLCommand, Persistent, Contained):
 
     implements(ISQLScript, IFileContent)
 
@@ -691,12 +691,8 @@
         connection = connection_service.getConnection(self.connectionName)
         return connection
 
-    getConnection = ContextMethod(getConnection)
-
     # See zope.app.interfaces.content.sql.ISQLScript
-    # We need to preserve the context for connectionName, so we make it
-    # a ContextProperty instead of a property
-    connectionName = ContextProperty(_getConnectionName, _setConnectionName)
+    connectionName = property(_getConnectionName, _setConnectionName)
 
     def __call__(self, **kw):
         'See zope.app.interfaces.rdb'
@@ -742,7 +738,5 @@
             cache.set(result, location, {'query': query})
         return result
 
-    __call__ = ContextMethod(__call__)
-    
 
 valid_type = {'int':1, 'float':1, 'string':1, 'nb': 1}.has_key


=== Zope3/src/zope/app/content/zpt.py 1.15 => 1.15.4.1 ===
--- Zope3/src/zope/app/content/zpt.py:1.15	Thu Aug 21 10:19:22 2003
+++ Zope3/src/zope/app/content/zpt.py	Mon Sep  8 14:21:35 2003
@@ -19,8 +19,6 @@
 
 from persistence import Persistent
 
-from zope.context import ContextMethod
-from zope.context import getWrapperContainer
 from zope.proxy import removeAllProxies
 from zope.security.proxy import ProxyFactory
 
@@ -33,10 +31,11 @@
 
 from zope.app.interfaces.file import IReadFile, IWriteFile, IFileFactory
 from zope.interface import implements
+from zope.app.container.contained import Contained
 
 __metaclass__ = type
 
-class ZPTPage(AppPT, PageTemplate, Persistent):
+class ZPTPage(AppPT, PageTemplate, Persistent, Contained):
 
     implements(IZPTPage, IRenderZPTPage)
 
@@ -65,19 +64,17 @@
         context.evaluateInlineCode = self.evaluateInlineCode
         return context
 
-    def pt_getContext(wrapped_self, instance, request, **_kw):
+    def pt_getContext(self, instance, request, **_kw):
         # instance is a View component
-        self = removeAllProxies(wrapped_self)
+        self = removeAllProxies(self)
         namespace = super(ZPTPage, self).pt_getContext(**_kw)
-        namespace['template'] = wrapped_self
+        namespace['template'] = self
         namespace['request'] = request
         namespace['container'] = namespace['context'] = instance
         return namespace
 
-    pt_getContext = ContextMethod(pt_getContext)
-
     def render(self, request, *args, **keywords):
-        instance = getWrapperContainer(self)
+        instance = self.__parent__
 
         request = ProxyFactory(request)
         instance = ProxyFactory(instance)
@@ -89,7 +86,8 @@
 
         return self.pt_render(namespace)
 
-    render = ContextMethod(render)
+    source = property(getSource, setSource, None,
+                      """Source of the Page Template.""")
 
 
 class SearchableText:




More information about the Zope3-Checkins mailing list