Re: [Zope3-dev] How to resolve bi-directionally navigable association?

2005-08-28 Thread Stephan Richter
On Monday 08 August 2005 12:43, Adam Groszer wrote:
> class IItem(interface):
>     unit = Object(
>         title=u"Unit",
>         description=u"Unit",
>         required = False,
>         schema=IUnit)
>
> class IUnit(interface):
>     item = Object(
>         title=u"Item",
>         description=u"Item",
>         required = False,
>         schema=IItem)
>
> but obviously that does not work, I cannot define one before the
> other.

In IItem specify "Interface" as the schema. After you defined IUnit you can do 
something like:

IItem.getDescriptionFor('unit').schema = IUnit

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] How to resolve bi-directionally navigable association?

2005-08-08 Thread Adam Groszer
Sorry for the crosspost, may I have some expert advice on the
following:

As the subject sais, how can I resolve bi-directionally navigable
association in Z3?
Both objects have to have references of each other, that means that
also the schemas have to have references.

class IItem(interface):
unit = Object(
title=u"Unit",
description=u"Unit",
required = False,
schema=IUnit)

class IUnit(interface):
item = Object(
title=u"Item",
description=u"Item",
required = False,
schema=IItem)

but obviously that does not work, I cannot define one before the
other.

-- 
Best regards,
 Adam  mailto:[EMAIL PROTECTED]

___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com