[Zope] non-zope objects in zope
Bernd Dorn
zope-mailinglist at mopa.at
Wed Apr 28 00:47:10 EDT 2004
Sam Gendler wrote:
> I used to be a fairly knowledgable zope user many years ago, but things
> have moved on and I've forgotten most of what I know. I have a largish
> library of python modules which define a number of classes which have
> methods that perform work in a product. Currently, much of the system
> is managed vai commandline tools which utilize the library. We want to
> ad a web interface, and I figured zope would be a natural, since
> everything is already in python.
>
> I created external methods which return instances of classes, but if I
> try to use those instances from within dtml (iterating over a list of
> them, for instance), I just get prompted for authentication
> credentials. I seem to recall that there was some way of applying
> zopishness to external object instances at runtime, but I can't remember
> what that mechanism is, and I couldn't find it in either the zope book
> or the zope bible I went out an bought.
>
> For example, if I have a customer class which has name, id, and revenue
> members, and I create an external method to return a list of customer
> instances, I cannot do the following
>
> <dtml-in extListCustomers prefix="cust">
> <dtml-var expr="cust_item.id"> <dtml-var expr="cust_item.name"> <dtml
> var expr="cust_item.revenue">
> </dtml-in>
>
> Thanks
>
> --sam
>
>
> _______________________________________________
> Zope maillist - Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
had the same problem
you need a security context for your classes
the objects should be derived from Acquisition , either implicit or explicit
and use the securityDeclareXXX Methods of ClassSecurityInfo::
from AccessControl import ClassSecurityInfo
from Acquisition import Explicit
class Klass(Explicit):
security = ClassSecurityInfo()
security.declarePublic('aMethod')
def aMethod(self):
....
More information about the Zope
mailing list