A comment to the paragraph below was recently added via http://zope.org/Documentation/Books/ZDG/current/Security.stx#3-79
---------------
Objects that are returned from Python Scripts or External
Methods need to have assertions declared for themselves before
they can be used in restricted code. For example, assume you
have an External Method that returns instances of a custom
'Book' class. If you want to call this External Method from
DTML, and you'd like your DTML to be able to use the returned
'Book' instances, you will need to ensure that your class
supports Acquisition, and you'll need to make security
assertions on the 'Book' class and initialize it with the global
class initializer (just as you would with a class defined in a
Product). For example::
# an external method that returns Book instances
from AccessControl import ClassSecurityInfo
from Acquistion import Implicit
import Globals
class Book(Implicit):
def __init__(self, title):
self._title=title
# Create a SecurityInfo for this class
security = ClassSecurityInfo()
security.declareObjectPublic()
security.declarePublic('getTitle')
def getTitle(self):
return self._title
Globals.InitializeClass(Book)
# The actual external method
def GetBooks(self):
books=[]
books.append(Book('King Lear').__of__(self))
books.append(Book('Romeo and Juliet').__of__(self))
books.append(Book('The Tempest').__of__(self))
return books
% Anonymous User - Dec. 3, 2003 11:29 pm:
typo error in the above source code, line 3, missing 'i' for Acquisition:
^
from Acquistion import Implicit
^
_______________________________________________
ZDP maillist - [email protected]
http://mail.zope.org/mailman/listinfo/zdp
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.