Commentable redefines process(request, response). The purpose of this
is to
capture POST requests for creating comments. It also redirects back
(doubly
in some cases) after completing the POST operation.
The double-redirect is kind of a hack/kludge that circumvents page
caching
– Radiant was caching the redirect, which resulted in an endless
redirect
loop. Essentially, if the Commentable page received a POST, it
processes
then redirects to the Comments/CommentBucket child page which clears the
cache item for its parent/Commentable page and redirects back to it.
Now,
you could say that I should just make the Commentable page uncached and
avoid this brouhaha, but I wanted the opportunity for greater
performance,
and the number of page requests/time unit will always be an order of
magnitude greater than the number of posted comments/time unit unless
you’re
getting D.O.S.'d or spammed.
Ideally, I’d like to see a flexible caching mechanism that doesn’t cache
POST results, or alternatively, a different method (in the Ruby sense)
for
handling POST requests vs. GET requests. Of course, in the future,
Commentable will use real models and not page hacks!
Ideally, I’d like to see a flexible caching mechanism that doesn’t cache
POST results, or alternatively, a different method (in the Ruby sense) for
handling POST requests vs. GET requests.
If you have time, check out the “corex” developer branch ( http://dev.radiantcms.org/radiant/browser/branches/corex ). Please let
me know what you think of the new caching mechanism. Note that for
r133 or higher, you need to alter your behavior to adjust it to the
new API. Behaviors are now page class extensions. Please contact me
with any questions.
The new API allows you to …
Inherit tags from the parent class (i.e. subclass form
StandardPage and get all the standard tags).
Get rid off the nested tags (now you only have define_tag()
statements in your class definition).
The double-redirect is kind of a hack/kludge that circumvents page caching
– Radiant was caching the redirect, which resulted in an endless redirect
loop.
Would you find it helpful if you could extend (subclass) the
site_controller and have the render*, parse* and process() methods
available in the controller? I would like feedback from anyone who has
developed a Third Party product. You guys have a better idea what
functionality you need.