[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/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

Christian Theune ct@gocept.com
Sat, 25 May 2002 08:52:30 -0400


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

Added Files:
      Tag: ctheune-services_move-branch
	Adder.py Contents.py __init__.py browser.zcml 
Log Message:
Moving RoleService - Part 1
(physical move of the files)


=== Added File Zope3/lib/python/Zope/App/OFS/Services/RoleService/Views/Browser/Adder.py ===
##############################################################################
#
# 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.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.getResponse().redirect(REQUEST.URL['-2'])

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




=== Added File Zope3/lib/python/Zope/App/OFS/Services/RoleService/Views/Browser/Contents.py ===
##############################################################################
#
# 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: Contents.py,v 1.1.2.1 2002/05/25 12:52:29 ctheune Exp $
"""

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



=== Added File Zope3/lib/python/Zope/App/OFS/Services/RoleService/Views/Browser/__init__.py ===
##############################################################################
#
# 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.
# 
##############################################################################



=== Added File Zope3/lib/python/Zope/App/OFS/Services/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" 
   names="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" 
   names="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>