[ZPT] Parent property?

Dieter Maurer dieter at handshake.de
Mon Aug 18 23:56:15 EDT 2003


Philip Kilner wrote at 2003-8-18 19:19 +0100:
 > Am using: -
 > 
 > 	tal:attributes="value here/FolderIssue"
 > 
 > ...to set the value of a hidden form field. However, in production the 
 > "FolderIssue" is a property of the /parent/ folder - what is the syntax 
 > to pull the property value from the parent folder?

Unless your object also has a "FolderIssue" attribute, you
can continue to use "here/FolderIssue". Acquisition then ensures
that you get the parent's property.

File becomes quite complex when your object, too, has a
"FolderIssue" attribute. In many cases, "here/aq_parent/FolderIssue"
will give you the correct value. If, however, "here" is
obtained via acquisition, "here/aq_parent" may give the wrong
object. In this case, you may need an External Method
"aq_container", defined as:

  from Acquisition import aq_inner, aq_parent

  def aq_container(self):
    return aq_parent(aq_inner(self))

and use "python: here.aq_container().FolderIssue".


Dieter



More information about the ZPT mailing list