Re: preformatters and entry parsers

David Ascher <[email protected]>
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
On Sat, 21 Aug 2004 10:36:49 -0500 (CDT), will guaraldi
<[email protected]> wrote:
> On Fri, 20 Aug 2004, David Ascher wrote:
> >
> > 1. It looks to me like only the default txt (plain) entry parser calls
> > the cb_preformat and cb_postformat callbacks.  Shouldn't all entry
> > parsers call them?
> 
> They don't have to if they don't want to.  Beyond that, I have no
> experiecne with other dataparsers except the .txt one and one I wrote for
> ..tips for my own blog.

Right.  The suggestion below works for the default parser, but fails
for the other parsers (e.g. the txtl parser won't understand the
markup I'm proposing.

You're right that using cb_preformat will interact badly with caching.

> That should be a postformatter.  postformatters can add additional
> properties to the entry.  You don't want to be dropping information in the
> entryparser/preformatter stage depending on whether the request is for an
> index or not.  That'll screw up caching further down the road since the
> results of entry parsing, preformatting, and postformatting are cached.
> 
> What you want to do is change the name of the above function to
> cb_postformat and then adjust the code like this:

The problem is that then the parsing needs to parse arbitrary HTML,
instead of the raw text.

> Your best bet is to download my cutsie debug mode plugin, create the two
> situations in your blog datadir, and then go to those urls adding
> "?debug=yes" to the end of the url.  That'll let you see all the data in
> the request object.  The thing to look at is the Request.getData() dict
> section.

That is useful.  Is there anyway to make it print out a traceback
instead of silent failures as well?

--david


-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.