[Zope] Writing a product

Paul Winkler pw_lists@slinkp.com
Tue, 11 Feb 2003 07:05:27 -0800


On Tue, Feb 11, 2003 at 03:07:14PM +0100, Peter Sabaini wrote:
> and the BoringProduct:
> 
> http://www.zope.org/Members/gtk/Boring
> 
> should give good starting points.

I would like to point out that Boring is rather old (1999)
and uses a deprecated style for security declarations.*

Another nice place to start with product development is here:

http://www.zope.org/Members/maxm/HowTo/minimal_01
http://www.zope.org/Members/maxm/HowTo/minimal_02


*Old style security declaration: put everything in 
__ac_permissions__, usually at the beginning of the class:

 class Foo(SimpleItem.SimpleItem):
    __ac_permissions__ = (
       ('Edit Foos',  ('manage_editFoo',),
        'View Foos',  ('view',)
       )

    def view(self): 
        ...

    def manage_editFoo(self, data):
        ...

    
"New" style (already several years old) registers permissions
with AccessControl.ClassSecurityInfo which can be done 
throughout the class definition:


 import AccessControl 

 class Foo(SimpleItem.SimpleItem):

    security = AccessControl.ClassSecurityInfo()
     
    security.declareProtected('View Foos', 'view')
    def view(self):
       ...

    security.declareProtected('Manage Foos', 'manage_editFoo')
    def manage_editFoo(self, data):
        ...

-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's CARDIO-RAR-HIGH PRIEST!
(random hero from isometric.spaceninja.com)