[Zope3-checkins] CVS: Zope3/src/zope/app/services -
pagefolder.py:1.16 pagefolder.zcml:1.4
Jim Fulton
cvs-admin at zope.org
Fri Nov 21 12:10:02 EST 2003
Update of /cvs-repository/Zope3/src/zope/app/services
In directory cvs.zope.org:/tmp/cvs-serv30085/src/zope/app/services
Modified Files:
pagefolder.py pagefolder.zcml
Log Message:
Moved interfaces here and updated to use presentation service and
the updated view-registration schema.
=== Zope3/src/zope/app/services/pagefolder.py 1.15 => 1.16 ===
--- Zope3/src/zope/app/services/pagefolder.py:1.15 Mon Nov 3 23:04:25 2003
+++ Zope3/src/zope/app/services/pagefolder.py Fri Nov 21 12:10:01 2003
@@ -22,26 +22,80 @@
from zope.app.container.btree import BTreeContainer
from zope.app.fssync.classes import ObjectEntryAdapter, AttrMapping
-from zope.app.interfaces.file import IDirectoryFactory
-from zope.app.interfaces.fssync import IObjectDirectory
-from zope.app.interfaces.services.pagefolder import IPageFolder
from zope.app.interfaces.services.registration import ActiveStatus
from zope.app.interfaces.services.registration import IRegistrationManager
from zope.app.interfaces.services.registration import RegisteredStatus
from zope.app.interfaces.services.registration import UnregisteredStatus
-from zope.app.interfaces.services.view import IZPTTemplate
+from zope.app.services.presentation import PageRegistration
from zope.app.services.registration import RegistrationManagerContainer
-from zope.app.services.view import PageRegistration
+from zope.app.services.zpt import IZPTTemplate
+from zope.app.traversing import getPath
from zope.app.traversing import getPath
from zope.interface import implements
from zope.proxy import removeAllProxies
-from zope.publisher.interfaces.browser import IBrowserPresentation
+from zope.proxy import removeAllProxies
+from zope.publisher.interfaces.browser import IBrowserRequest
+
+import zope.app.component.interfacefield
+import zope.app.interfaces.container
+import zope.app.interfaces.file
+import zope.app.interfaces.fssync
+import zope.app.interfaces.services.registration
+import zope.app.security.permission
+import zope.interface
+import zope.schema
+
+class IPageFolderInfo(zope.interface.Interface):
+ """Default registration information for page folders
+
+ This information is used to configure the pages in the folder.
+ """
+
+ required = zope.app.component.interfacefield.InterfaceField(
+ title = u"For interface",
+ description = u"The interface of the objects being viewed",
+ required = True,
+ )
+
+ factoryName = zope.schema.BytesLine(
+ title=u"The dotted name of a factory for creating the view",
+ required = False,
+ )
+
+ layer = zope.schema.BytesLine(
+ title = u"Layer",
+ description = u"The skin layer the view is registered for",
+ required = False,
+ min_length = 1,
+ default = "default",
+ )
+
+ permission = zope.app.security.permission.PermissionField(
+ title=u"Permission",
+ description=u"The permission required to use the view",
+ required = True,
+ )
+
+ apply = zope.schema.Bool(
+ title=u"Apply changes to existing pages",
+ required = True,
+ )
+
+class IPageFolder(
+ IPageFolderInfo,
+ zope.app.interfaces.container.IContainer,
+ zope.app.interfaces.services.registration.IRegistrationManagerContainer,
+ ):
+
+ def applyDefaults(self):
+ """Apply the default configuration to the already-registered pages.
+ """
class PageFolder(RegistrationManagerContainer, BTreeContainer):
- implements(IPageFolder)
+ zope.interface.implements(IPageFolder)
- presentationType = IBrowserPresentation
+ requestType = IBrowserRequest
layer = "default"
description = ''
title = ''
@@ -69,10 +123,10 @@
template = self[name]
template = getPath(template)
registration = PageRegistration(
- forInterface=self.forInterface,
- viewName=name,
+ required=self.required,
+ name=name,
permission=self.permission,
- class_=self.factoryName,
+ factoryName=self.factoryName,
template=template,
layer=self.layer,
)
@@ -94,11 +148,11 @@
registration.status = RegisteredStatus
registration.status = UnregisteredStatus
- # Cheat and set forInterface and layer even though they're
+ # Cheat and set required and layer even though they're
# read-only. This is ok since the registration is now not
# registered.
- registration.forInterface = removeAllProxies(self.forInterface)
+ registration.required = removeAllProxies(self.required)
registration.factoryName = self.factoryName
registration.layer = self.layer
registration.permission = self.permission
@@ -110,7 +164,7 @@
_attrNames = (
'factoryName',
- 'forInterface',
+ 'required',
'layer',
'permission',
)
@@ -118,7 +172,7 @@
class PageFolderAdapter(ObjectEntryAdapter):
"""ObjectFile adapter for PageFolder objects."""
- implements(IObjectDirectory)
+ zope.interface.implements(zope.app.interfaces.fssync.IObjectDirectory)
def contents(self):
return self.context.items()
@@ -129,7 +183,7 @@
class PageFolderFactory:
- implements(IDirectoryFactory)
+ zope.interface.implements(zope.app.interfaces.file.IDirectoryFactory)
def __init__(self, context):
self.context = context
=== Zope3/src/zope/app/services/pagefolder.zcml 1.3 => 1.4 ===
--- Zope3/src/zope/app/services/pagefolder.zcml:1.3 Sun Sep 21 13:32:55 2003
+++ Zope3/src/zope/app/services/pagefolder.zcml Fri Nov 21 12:10:01 2003
@@ -18,8 +18,8 @@
<require
permission="zope.ManageServices"
interface="zope.app.interfaces.container.IWriteContainer
- zope.app.interfaces.services.pagefolder.IPageFolderInfo"
- set_schema="zope.app.interfaces.services.pagefolder.IPageFolderInfo"
+ zope.app.services.pagefolder.IPageFolderInfo"
+ set_schema="zope.app.services.pagefolder.IPageFolderInfo"
attributes="getRegistrationManager applyDefaults"
/>
<implements
@@ -27,7 +27,7 @@
</content>
<adapter
- for="zope.app.interfaces.services.pagefolder.IPageFolder"
+ for="zope.app.services.pagefolder.IPageFolder"
provides="zope.app.interfaces.file.IFileFactory"
factory=".zpt.ZPTFactory"
permission="zope.ManageServices"
More information about the Zope3-Checkins
mailing list