Hi Alen,

Thanks a lot. I also begin to understand that in Zope 3 you typically create a package even for simple things, whereas in Zope 2 you often could get away with some scripts and ZPTs. It also seems to me that when the learning curve gets a little less steep writing a customized package is actually faster/easier them a Zope 2 Product.

I already made a page type which has a title and I decided to create a ordered container with a title property as well. Then together with your information, I guess I can make a dynamic menu relatively easy.


Alen Stanisic wrote:
On Fri, 2006-02-10 at 14:48 -0800, Paulus Zegwaard wrote:
But although I understand Zope 3 has something like that too, I'm unclear how to achieve that every object provides an absolute_url

Objects that are contained provide ILocation interface
__name__ - object name
__parent__ - container name
it is container's responsibility to set these and it all happens behind
the scenes and contained objects themselves shouldn't have to worry
about it too much.
For example if you had something like this

class IPerson(Interface):
        surname = TextLine(title=_(u"Surname"))
        firstName = TextLine(title=_(u"First Name"))

when implementing this interface you would just say it is persistent and

class Person(Persistent):

        __name__ = None
        __parent__ = None
        surname = u''
        firstName = u''


from zope.app.container.contained import Contained
class Person(Persistent, Contained):

        surname = u''
        firstName = u''
(This way Contained implements the location stuff - the name and

And that should be it. To get absolute url I would do something like
from zope.app import zapi
zapi.absoluteURL(obj, request)

there is also

which will return path of the object

For a better explanation of the location concept look up 'location' in
the index of Philipp's book once it arrives.

A related questions is: is there an obvious way to get the site url (or object) other then just knowing the name?

Not sure about this..


Zope3-users mailing list

Reply via email to