[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/RoleService/Views/Browser - Adder.py:1.2 Contents.py:1.2 __init__.py:1.2 browser.zcml:1.2

Jim Fulton jim@zope.com
Mon, 10 Jun 2002 19:28:42 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services/RoleService/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv17445/lib/python/Zope/App/OFS/Services/RoleService/Views/Browser

Added Files:
	Adder.py Contents.py __init__.py browser.zcml 
Log Message:
Merged Zope-3x-branch into newly forked Zope3 CVS Tree.


=== Zope3/lib/python/Zope/App/OFS/Services/RoleService/Views/Browser/Adder.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 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.
+# 
+##############################################################################
+"""
+    Define adder component for folders.
+"""
+from Zope.ComponentArchitecture import createObject
+from Zope.App.OFS.Container.Views.Browser.Adder import ContainerAdder
+from Zope.App.OFS.Container.Exceptions import DuplicateIDError
+
+class Adder(ContainerAdder):
+
+    type_name = "Zope.App.OFS.Services.RoleService.Role."
+
+    def _listAddables(self):
+        # XXX Hack, but it lets us reuse the page template for now.
+        return ()
+
+    def action( self, id, REQUEST=None):
+        """
+            Instantiate an object and put it in our folder.
+        """
+        context = self.context
+        
+        if id in context:
+            raise DuplicateIDError, "ID '%s' already in use." % id
+
+        role = createObject(context, self.type_name)
+        role.setId(id)
+
+        context.setObject(id, role)
+
+        if REQUEST is not None:
+            # for unit tests
+            REQUEST.getResponse().redirect(REQUEST.URL['-2'])
+
+        return self.confirmed( type_name="Role", id=id )
+
+


=== Zope3/lib/python/Zope/App/OFS/Services/RoleService/Views/Browser/Contents.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 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.
+# 
+##############################################################################
+""" Define view component for service manager contents.
+
+$Id$
+"""
+
+from Zope.App.OFS.Container.Views.Browser.Contents import Contents
+from Zope.App.OFS.Content.Folder.Views.Browser.FolderContents import FolderContents
+from Interface.Implements import flattenInterfaces, objectImplements
+
+class Contents(Contents):
+    pass
+


=== Zope3/lib/python/Zope/App/OFS/Services/RoleService/Views/Browser/__init__.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 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.
+# 
+##############################################################################
+


=== Zope3/lib/python/Zope/App/OFS/Services/RoleService/Views/Browser/browser.zcml 1.1 => 1.2 ===
+   xmlns='http://namespaces.zope.org/zope'
+   xmlns:security='http://namespaces.zope.org/security'
+   xmlns:zmi='http://namespaces.zope.org/zmi'
+   xmlns:browser='http://namespaces.zope.org/browser'
+>
+
+  <browser:defaultView 
+     for="Zope.App.OFS.Services.RoleService.RoleService.IRoleService"
+     name="index.html"
+     />
+
+  <browser:view 
+     permission="Zope.ManageServices" 
+     for="Zope.App.OFS.Services.RoleService.RoleService.IRoleService"
+     factory="Zope.App.OFS.Services.RoleService.Views.Browser.Contents.">
+
+     <browser:page name="index.html" attribute="index" />
+
+  </browser:view>
+
+  <browser:view 
+     name="adder"
+     permission="Zope.ManageServices" 
+     for="Zope.App.OFS.Services.RoleService.RoleService.IRoleService"
+     factory="Zope.App.OFS.Services.RoleService.Views.Browser.Adder."
+     >
+
+    <browser:page name="addForm.html"
+                  attribute="index"
+                  />
+    <browser:page name="add.html"
+                  attribute="action"
+                  />
+
+  </browser:view>
+
+  <zmi:tabs for="Zope.App.OFS.Services.RoleService.RoleService.IRoleService.">
+    <zmi:tab label="Contents" action="@@index.html"/>
+  </zmi:tabs>
+
+</zopeConfigure>