[Zope] classes in external methods

Tim Edwards Tim.Edwards at hwe.com.au
Tue Mar 16 17:07:55 EST 2004


Try the template below for your classes. You can create objects of classes
you write like this and return them via external methods to ZPTs and Scripts
inside of Zope.


from AccessControl import ClassSecurityInfo
from OFS.ObjectManager import ObjectManager
import Globals

class Class1(ObjectManager):
    security = ClassSecurityInfo()

    def __init__(self):
        pass

    security.declarePublic('Func1')
    def Func1(self): 
        return self.somedata

Globals.InitializeClass(Class1)


-----Original Message-----
From: nwingfield at dixon-hughes.com [mailto:nwingfield at dixon-hughes.com]
Sent: Wednesday, 17 March 2004 8:44 AM
To: zope at zope.org
Subject: [Zope] classes in external methods






Since Zope's Python Scripts will not allow me to import the csv module, I
wrote my own little class within an External Method.  My class opens a CSV
file and returns a dictionary representation of each line, one at a time.
Now Zope pops up an authentication dialog when I try to call my External
Method.  Is there some way around this?  Can someone also explain why Zope
does this?  I thought an External Methods was a failsafe way to write
unrestricted Zope code without going all out and writing a product (which
just doesn't make sense in this instance).
Nathaniel



More information about the Zope mailing list