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

Jim Fulton jim@zope.com
Mon, 4 Mar 2002 17:19:29 -0500


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

Added Files:
      Tag: Zope-3x-branch
	Adder.py Contents.py __init__.py browser.zcml 
Log Message:
Added first-cut role service

=== Added File Zope3/lib/python/Zope/App/OFS/RoleService/Views/Browser/Adder.py ===
# This software is subject to the provisions of the Zope Public License,
# Version 1.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.

"""
    Define adder component for folders.
"""
from Zope.PageTemplate.PageTemplateFile import PageTemplateFile
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.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.getContext()
        
        if id in context.objectIds():
            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['RESPONSE'].redirect(REQUEST['URL2'])

        return self.confirmed( type_name="Role", id=id )




=== Added File Zope3/lib/python/Zope/App/OFS/RoleService/Views/Browser/Contents.py ===
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 1.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.
##############################################################################
""" Define view component for service manager contents.

$Id: Contents.py,v 1.1.2.1 2002/03/04 22:19:28 jim Exp $
"""

from Zope.App.OFS.Container.Views.Browser.Contents import Contents
from Zope.App.OFS.Folder.FolderContents import FolderContents
from Interface.Util import flattenInterfaces, objectImplements

class Contents(Contents):
    pass



=== Added File Zope3/lib/python/Zope/App/OFS/RoleService/Views/Browser/__init__.py ===



=== Added File Zope3/lib/python/Zope/App/OFS/RoleService/Views/Browser/browser.zcml ===
<zopeConfigure
   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'
>

<security:protectClass 
   name="Zope.App.OFS.RoleService.Views.Browser.Contents."
   permission_id="Zope.ManageServices" 
   methods="index, listContentInfo, remove, removeObjects, confirmRemoved"/>

<browser:defaultView 
   name="contents"
   for="Zope.App.OFS.RoleService.RoleService.IRoleService"
   factory="Zope.App.OFS.RoleService.Views.Browser.Contents." />

<security:protectClass 
   name="Zope.App.OFS.RoleService.Views.Browser.Adder."
   permission_id="Zope.ManageServices" 
   methods="index, confirmed, action, listAddableInfo"/>

<browser:view 
   name="adder"
   for="Zope.App.OFS.RoleService.RoleService.IRoleService"
   factory="Zope.App.OFS.RoleService.Views.Browser.Adder." />

<zmi:tabs for="Zope.App.OFS.RoleService.RoleService.IRoleService.">
  <zmi:tab label="Contents" action="contents;view"/>
</zmi:tabs>

</zopeConfigure>