[Zope-CMF] Need advice on sorting my custom CMF object

Lynn Walton waltonl@franklin.edu
Thu, 22 Nov 2001 12:42:37 -0600


I'm creating a custom CMF object for a "Job Posting" that is based on
CMFDefault.Document  but has additional properties jobcode, position,
and postdate.
We have 3 categories ... Full Time, Part Time and Faculty Postitions.
What I want to do is something like this:

jobpostings -
                  - fulltime  (folder where full time "Job Posting"
objects are added, edited and deleted)
                  - parttime (folder where part time "Job Posting"
objects are added, edited and deleted)
                  - faculty (folder where faculty "Job Posting" objects
are added, edited and deleted)
                  - index_html  (which in my case will be a ZPT) that
has 3 lists - one for full, one for part, and one for faculty, where
this dynamically goes through each of the three folders to create the
lists of what postings are available at the moment and shows the titles
as hyperlinks to the view of the actual "Job Posting".

My question is in regard to sorting. I want to sort on the postdate
which will be a DateTime() object.  I don't know what my options are and
what is "better". Trying to add an index to the portal catalog for my
CMF type and it's postdate attribute? If so, I'm not sure how to do
that.   I don't anticipate there ever being more than 20 Job Postings in
each of the three folders so I'm guessing it isn't worth doing it with
the portal catalog.   I read somewhere where zpt's don't have the sort
feature that dtml-in does.

Specific questions .... if I were using dtml rather than zpt and was
going to get a list of JobPostings objectValues from each folder, and if
my postdate has a method for returning it called PostDate that returns a
DateTime() object, then will I get the sort I want automatically or do I
have to write a sort or cmp function in my JobPosting CMF object?   In
otherwords, what types does dtml-in's sort know how to deal with by
default? Is DateTime one of them? I tried to find this info in books and
website and came up short.

Thanks for any ideas,
Lynn