[Zope] turning off inheritance

2000-12-13 Thread Kyler B. Laird


I am working on generating a directory from Zope
objects.  There is a folder full of units (other
folders).  These units contain people (more
folders).

Units and people both have contact information
stored in their properties.  How do I detect if a
person has, for example, 'contact_email' set?

I've tried
dtml-if "_.hasattr(this(), 'contact_email')"
It succeeds if the person doesn't have
contact_email set but its unit does.  I've also
tried variations of dtml-with ... only, with no
success.

Any pointers?  Where could I have found the
answer to this on my own?

Thank you.

--kyler

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] turning off inheritance

2000-12-13 Thread Oleg Broytmann

On Wed, 13 Dec 2000, Kyler B. Laird wrote:
 Units and people both have contact information
 stored in their properties.  How do I detect if a
 person has, for example, 'contact_email' set?

 I've tried
   dtml-if "_.hasattr(this(), 'contact_email')"

   Something like
dtml-if "_.hasattr(aq_explicit, 'contact_email')"
   (untested, but I use this in External Methods)

Oleg.

 Oleg Broytmann http://www.zope.org/Members/phd/ [EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] turning off inheritance

2000-12-13 Thread Kyler B. Laird


On Wed, 13 Dec 2000 19:39:43 +0300 (MSK) you wrote:
On Wed, 13 Dec 2000, Kyler B. Laird wrote:
 Units and people both have contact information
 stored in their properties.  How do I detect if a
 person has, for example, 'contact_email' set?

 I've tried
  dtml-if "_.hasattr(this(), 'contact_email')"

   Something like
dtml-if "_.hasattr(aq_explicit, 'contact_email')"
   (untested, but I use this in External Methods)

Consider it tested.  It works great from DTML.

Now that I know what to seek, I found a couple of
old messages that reference this.  I'm still
honing my ability to get Zope clues.

Thanks for the quick and effective answer!

--kyler

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] turning off inheritance

2000-12-13 Thread Oleg Broytmann

On Wed, 13 Dec 2000, Kyler B. Laird wrote:
 dtml-if "_.hasattr(aq_explicit, 'contact_email')"
(untested, but I use this in External Methods)

 Consider it tested.  It works great from DTML.

 Now that I know what to seek, I found a couple of
 old messages that reference this.  I'm still
 honing my ability to get Zope clues.

   I got it form exactly this mailing list. I just monitor the list form
the very beginning, I forward many important message to Russian Zope list,
discuss this information, etc. Nothing special. Often I ask questions here.
   Of course I do digging Zope sources from time to time :)

Oleg.

 Oleg Broytmann http://www.zope.org/Members/phd/ [EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] turning off inheritance

2000-12-13 Thread Rik Hoekstra



"Kyler B. Laird" wrote:
 
 I am working on generating a directory from Zope
 objects.  There is a folder full of units (other
 folders).  These units contain people (more
 folders).
 
 Units and people both have contact information
 stored in their properties.  How do I detect if a
 person has, for example, 'contact_email' set?
 
 I've tried
 dtml-if "_.hasattr(this(), 'contact_email')"
 It succeeds if the person doesn't have
 contact_email set but its unit does.  I've also
 tried variations of dtml-with ... only, with no
 success.
 
 Any pointers?  Where could I have found the
 answer to this on my own?
 

I don't claim to know the complete answer, but one approach could be to
do a comparison something like:

(warning code untested):

 dtml-if "_.hasattr(this(), 'contact_email') and contact_email
!= PARENT[0].contact_email"

another approach is to set contact_email by default and test for
emptiness 



dtml-if "contact_email==''"
dtml-let contact_email="PARENTS[0].contact_email"


hth

Rik

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )