[Zope-CMF] Working with CMF Event object properties

Phil Glaser StillSmallVoice@DirectvInternet.com
Sun, 15 Sep 2002 18:09:23 -0400


Hi,

I am trying to create an insertable box (on the model of Plone's news_slot)
that lists the latest 5 CMF Events. Using calendar_slot as a model, I have
code that looks something like this:

<table metal:define-macro="eventsBox"
       class="box"
       summary="News listing"
       cellpadding="0" cellspacing="0"
       tal:define="results python:request.get('news',
here.portal_catalog.searchResults(

meta_type='CMF Event',

sort_on='Date',

sort_order='reverse',

review_state='published')[:5]);"
       tal:condition="python:test(template.getId()!='recent_news' and
results, 1, 0)">

And then iterate through the results as follows:

       <tbody tal:repeat="obj results">


I am able to access some of the CMF Event object properties with no problem,
for example:

           <a href="#"
           tal:attributes="href obj/getURL">
           <span tal:replace="python:test(obj.Title, obj.Title, obj.id)">
Product </span></a>

works just fine. But when I try to access other properties, such as
start_date and location, I get an attribute access error
("exceptions.AttributeError on location in '', at line 36, column 25"). In
the case of start_date, I discovered the start method that returns the
DateTime object and all the fun DateTime methods such as aCommon and
AMPMMinutes. But when I try to access location, I get the error. Here's an
example of my syntax:

   <span tal:replace="python:test(obj.location, obj.location,
obj.id)">Location</span>

Why is this not working?

Thanks!

Philip Glaser
Principal and Software Architect
Sustainable Software Solutions, LLC
StillSmallVoice@DirectvInternet.com
www.sustainsoft.com
973-951-9522