A Post's Categories

rand-kzPqTZqrtG+O+QkcXTtFxKWz8mPg4b/[email protected] Sat, 27 Mar 2004 12:23:05 -0700
Newsgroups gmane.comp.pythin.pyds.devel
Message-ID <[email protected]>
Hi,
I am trying to write a macro, to be used from one of my rendering templates or maybe from a nugget, that will
iterate through the categories that a specific post has been assigned to.

I've run into some problems trying to do so; this post contains 2 kinds of question.

First, how to 'browse' available Cheetah template vars and PyDS-post data structures?

I started by inspecting some of the existing templates to see if that contained a reference to what I wanted. I
saw refs to things that *looked like* category lists ($current.categories, $pcategories), but via
experimentation, found they were not exactly what I wanted.

I tried browsing PyDS code, macros, Cheetah doc, but couldn't find these nor what I was looking for - where
should I have been looking? How in general can I browse the vars that are built-in available for use in
templates/macros?

This leads me to my specific instance questions: I then resorted to some trial-and-error educated (seemed like
it anyway) guesses, but this resulted in me breaking PyDS (oops!).

I tried the following code in my weblogrender template:

<tr><td align="left"><span class="smallfont">
#for $cat in $post.$categories
<a href="/weblog/$cat.name">$cat.name</a>
#end for
</span></td></tr>

I was trying to draw from the code in the weblogTemplate edit section where it iterates thru some categories
and checks off the category boxes, but different vars must apply in the rendering context.

[FYI, this code caused PyDS to stop noticing any subsequent blog entry changes or additions; the event log
showed no activity except for the regular heartbeat event. This had me panicking; fortunately, restarting PyDS
got things righted.]

How can I get the list of categories that a given post has been assigned to? 

Thanks,
Rand