Newbie Zope Question
I am trying to build a table of properties for each object located in a folder. I can get the objects OK, but it doesn't seem to be able to pick the user-defined properties (although it does pick up the title property just fine). Here is the code. Why doesn't this work Thanks, Darren <tr tal:repeat="item container/objectValues"> <td class="style2" tal:content="item/targeted_release">targeted_release</td> <td class="style2" tal:content="item/category">category</td> <td class="style2" tal:content="item/title">title</td> <td class="style2" tal:content="item/dev_days">dev_days</td> <td class="style2" tal:content="item/developer">devloper</td> <td class="style2" tal:content="item/biz_design">business_desing</td> <td class="style2" tal:content="item/app_design">app_design</td> <td class="style2" tal:content="item/tech_design">tech_design</td> <td class="style2" tal:content="item/test_plan">test_plan</td> <td class="style2" tal:content="item/coding">coding</td> <td class="style2" tal:content="item/testing">testing</td> </tr>
On Fri, Sep 03, 2004 at 11:32:22AM -0600, Darren Ehlers wrote:
I am trying to build a table of properties for each object located in a folder. I can get the objects OK, but it doesn't seem to be able to pick the user-defined properties (although it does pick up the title property just fine).
Here is the code. Why doesn't this work
Welcome! First bit of advice: never just say "it doesn't work". That is almost never enough information for anyone to help. Always describe the actual result; if there's an error, include the traceback. Your code should basically work. One suspicion:
<tr tal:repeat="item container/objectValues">
That will include the page template itself. Does it have all those properties? If any object in the container is missing even one of those properties, you'll get an AttributeError. To make things more fault-tolerant, you can specify a fallback value, such as the original content of the tag. Something like this: <td class="style2" tal:content="item/coding | default"> (coding: no value available) </td> -- Paul Winkler http://www.slinkp.com
Paul, Thanks for responding. I have verified that all properties exist on the template and have values. I also verified that it is returning what I expect. If I change all of the <td> rows to <td tal:content="item/title">, it works fine. Here is the error I receive: Site Error An error was encountered while publishing this resource. Error Type: AttributeError Error Value: targeted_release Troubleshooting Suggestions * The URL may be incorrect. * The parameters passed to this resource may be incorrect. * A resource that this resource relies on may be encountering an error. For more detailed information about the error, please refer to the error log. If the error persists please contact the site maintainer. Thank you for your patience. -----Original Message----- From: zope-bounces@zope.org [mailto:zope-bounces@zope.org] On Behalf Of Paul Winkler Sent: Friday, September 03, 2004 11:56 AM To: zope@zope.org Subject: Re: [Zope] Newbie Zope Question On Fri, Sep 03, 2004 at 11:32:22AM -0600, Darren Ehlers wrote:
I am trying to build a table of properties for each object located in a folder. I can get the objects OK, but it doesn't seem to be able to pick the user-defined properties (although it does pick up the title property just fine).
Here is the code. Why doesn't this work
Welcome! First bit of advice: never just say "it doesn't work". That is almost never enough information for anyone to help. Always describe the actual result; if there's an error, include the traceback. Your code should basically work. One suspicion:
<tr tal:repeat="item container/objectValues">
That will include the page template itself. Does it have all those properties? If any object in the container is missing even one of those properties, you'll get an AttributeError. To make things more fault-tolerant, you can specify a fallback value, such as the original content of the tag. Something like this: <td class="style2" tal:content="item/coding | default"> (coding: no value available) </td> -- Paul Winkler http://www.slinkp.com _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
On Fri, Sep 03, 2004 at 12:03:30PM -0600, Darren Ehlers wrote:
Paul,
Thanks for responding. I have verified that all properties exist on the template and have values. I also verified that it is returning what I expect. If I change all of the <td> rows to <td tal:content="item/title">, it works fine.
Here is the error I receive: Site Error
An error was encountered while publishing this resource.
Error Type: AttributeError Error Value: targeted_release
OK then, clearly at least one of your objects has no targeted_release property. To find out which one, do what I suggested previously: change the line in your template to something like: <td tal:content="item/targeted_release | default"> BOINK! </td> That'll clear up the error and show you which one(s) are missing the property... assuming there are no other errors lying in wait :)
Troubleshooting Suggestions
* The URL may be incorrect. * The parameters passed to this resource may be incorrect. * A resource that this resource relies on may be encountering an error.
For more detailed information about the error, please refer to the error log.
Note that last line there :-) The error_log is in the root of your zope site. It gives you a lot more information. -- Paul Winkler http://www.slinkp.com
Hi Paul, That worked. It seems there is an extra object that I wasn't expecting that was causing the problem. Thanks a lot for your help. -Darren -----Original Message----- From: zope-bounces@zope.org [mailto:zope-bounces@zope.org] On Behalf Of Paul Winkler Sent: Friday, September 03, 2004 12:30 PM To: zope@zope.org Subject: Re: [Zope] Newbie Zope Question\ On Fri, Sep 03, 2004 at 12:03:30PM -0600, Darren Ehlers wrote:
Paul,
Thanks for responding. I have verified that all properties exist on the template and have values. I also verified that it is returning what I expect. If I change all of the <td> rows to <td tal:content="item/title">, it works fine.
Here is the error I receive: Site Error
An error was encountered while publishing this resource.
Error Type: AttributeError Error Value: targeted_release
OK then, clearly at least one of your objects has no targeted_release property. To find out which one, do what I suggested previously: change the line in your template to something like: <td tal:content="item/targeted_release | default"> BOINK! </td> That'll clear up the error and show you which one(s) are missing the property... assuming there are no other errors lying in wait :)
Troubleshooting Suggestions
* The URL may be incorrect. * The parameters passed to this resource may be incorrect. * A resource that this resource relies on may be encountering an error.
For more detailed information about the error, please refer to the error log.
Note that last line there :-) The error_log is in the root of your zope site. It gives you a lot more information. -- Paul Winkler http://www.slinkp.com _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
participants (2)
-
Darren Ehlers -
Paul Winkler