[Zope-dev] ZPT: how to access property sheet of custom ZClass

David Hart dhart@sftower.com
Thu, 07 Mar 2002 17:03:48 +1100


Hi!

I'm implementing a simple db, using the same methods in the JobBoard 
example. I looked at Kube, but I'd like something a bit more generic.

I'm trying to make add/edit forms and display pages as simple as 
possible. Rather than have custom versions of all of these, each with 
copies of the same property names, I'd like to pull the 
property/attribute names from the property sheet of the ZClass in the 
Product I added.

Something like:

  <span tal:repeat="props 
python:root.Control_Panel.Products.CEdb.cedb_record.propertysheets.common.record_default_properties.attrs()">
      <p tal:content="props"></p>
  </span>

The above example is probably very wrong for many reasons-- it shows my 
lack of experience with TAL, python and Zope innards in general --  but 
I think it conveys what I'm trying to do. I'm not sure if I can use 
"python:object.attrs()", or even if the objects under Control Panel are 
accessible to ZPT as the above example produces a guarded_getattr error.

Also, is there a more generic or elegant way to refer to the 
record_default_properties object?

Any help would be much appreciated!

Regards,
Dave