[Zope-CVS] SVN: zope.webdev/trunk/ Setup base for new resource stuff.

Rocky Burt rocky at serverzen.com
Wed Feb 1 10:10:14 EST 2006


Log message for revision 41533:
  Setup base for new resource stuff.
  

Changed:
  _U  zope.webdev/trunk/
  U   zope.webdev/trunk/configure.zcml
  A   zope.webdev/trunk/container.py
  A   zope.webdev/trunk/container.txt
  A   zope.webdev/trunk/container.zcml
  U   zope.webdev/trunk/interfaces.py
  U   zope.webdev/trunk/tests.py

-=-

Property changes on: zope.webdev/trunk
___________________________________________________________________
Name: svk:merge
   - 98c0701e-2f07-0410-a1a0-c1bc72243522:/local/zope.webdev/trunk:7365
   + 98c0701e-2f07-0410-a1a0-c1bc72243522:/local/zope.webdev/trunk:7417

Modified: zope.webdev/trunk/configure.zcml
===================================================================
--- zope.webdev/trunk/configure.zcml	2006-02-01 13:10:41 UTC (rev 41532)
+++ zope.webdev/trunk/configure.zcml	2006-02-01 15:10:13 UTC (rev 41533)
@@ -28,7 +28,8 @@
   <include file="content.zcml" />
   <include file="page.zcml" />
   <include file="rdb.zcml" />
+  <include file="container.zcml" />
 
   <include package=".browser" />
-
+  
 </configure>

Added: zope.webdev/trunk/container.py
===================================================================
--- zope.webdev/trunk/container.py	2006-02-01 13:10:41 UTC (rev 41532)
+++ zope.webdev/trunk/container.py	2006-02-01 15:10:13 UTC (rev 41533)
@@ -0,0 +1,30 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Content component for the resource container.
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+from zope.app.container.btree import BTreeContainer
+from zope.interface import implements
+from interfaces import IResourceContainer
+
+class ResourceContainer(BTreeContainer):
+    """A content type for holding resources.
+    """
+    implements(IResourceContainer)
+    
+    
+    

Added: zope.webdev/trunk/container.txt
===================================================================
--- zope.webdev/trunk/container.txt	2006-02-01 13:10:41 UTC (rev 41532)
+++ zope.webdev/trunk/container.txt	2006-02-01 15:10:13 UTC (rev 41533)
@@ -0,0 +1,13 @@
+========================
+Resource Container Tests
+========================
+
+Instantiate resource containers.
+
+  >>> from zope.webdev.container import ResourceContainer
+  >>> from zope.webdev.interfaces import IResourceContainer
+  >>> from zope.interface.verify import verifyObject
+  >>> aContainer = ResourceContainer()
+  >>> verifyObject(IResourceContainer, aContainer)
+  True
+  
\ No newline at end of file

Added: zope.webdev/trunk/container.zcml
===================================================================
--- zope.webdev/trunk/container.zcml	2006-02-01 13:10:41 UTC (rev 41532)
+++ zope.webdev/trunk/container.zcml	2006-02-01 15:10:13 UTC (rev 41533)
@@ -0,0 +1,38 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:apidoc="http://namespaces.zope.org/apidoc"
+    xmlns:zcml="http://namespaces.zope.org/zcml"
+    i18n_domain="webdev"
+    >
+
+  <permission
+      id="webdev.CreateResourceContainer"
+      title="Create Resource Container"
+      />
+
+  <permission
+      id="webdev.ManageResourceContainer"
+      title="Manage Resource Container"
+      />
+
+  <permission
+      id="webdev.ViewResourceContainer"
+      title="View Resource Container"
+      />
+      
+  <content class=".container.ResourceContainer">
+  
+    <implements interface="zope.app.annotation.interfaces.IAnnotatable" />
+    
+    <require
+        permission="webdev.ViewResourceContainer"
+        interface=".interfaces.IResourceContainer"
+        />
+    <require
+        permission="webdev.ManageResourceContainer"
+        set_schema=".interfaces.IResourceContainer"
+        />  
+  </content>  
+
+
+</configure>

Modified: zope.webdev/trunk/interfaces.py
===================================================================
--- zope.webdev/trunk/interfaces.py	2006-02-01 13:10:41 UTC (rev 41532)
+++ zope.webdev/trunk/interfaces.py	2006-02-01 15:10:13 UTC (rev 41533)
@@ -27,6 +27,9 @@
 from zope.app.component import interfaces
 from zope.app.container import constraints
 
+from zope.app.container.interfaces import IContainer
+from zope.app.file.interfaces import IFile
+
 _ = zope.i18nmessageid.MessageFactory('zope.webdev')
 
 class IPackage(interfaces.registration.IRegisterableContainer):
@@ -186,3 +189,9 @@
     def getTemplate():
 
         """returns the template"""
+
+class IResourceContainer(IContainer):
+    """An interface for a resource container
+    """
+    
+    constraints.contains(IFile)

Modified: zope.webdev/trunk/tests.py
===================================================================
--- zope.webdev/trunk/tests.py	2006-02-01 13:10:41 UTC (rev 41532)
+++ zope.webdev/trunk/tests.py	2006-02-01 15:10:13 UTC (rev 41533)
@@ -60,6 +60,10 @@
                      setUp=pageTestSetUp, tearDown=tearDown,
                      optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
                      ),
+        DocFileSuite('container.txt',
+                     setUp=setUp, tearDown=tearDown,
+                     optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
+                     ),
         DocTestSuite('zope.webdev.vocabulary',
                      setUp=setUp, tearDown=tearDown,
                      optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,



More information about the Zope-CVS mailing list