Will's blog

purpose: Will Kahn-Greene's blog of Miro, PyBlosxom, Python, GNU/Linux, random content, PyBlosxom, Miro, and other projects mixed in there ad hoc, half-baked, and with a twist of lemon

[ home | blog home | recent activity ]

Tue, 27 Jan 2004

Tip for debugging plugin code in Pyblosxom

If you're writing plugins and you need a place to do some debug printing, the easiest thing to do is to toss a "$debugprint" variable in your foot.html file (or whatever flavour file you want to toss it in). Then every time you want to print a debug statement, do something like this:

      request = args["request"]
      data = request.getData()
      debugprint = data.get("debugprint", "")
      data["debugprint"] = debugprint + "\nyour print statement here"
   

The neat thing about this is that you can leave the $debugprint in your flavour template file when you're done. If the variable is not defined or it doesn't have any data, it gets removed.

changelog

Comments:

Posted by Zoom.Quiet on Sat Jan 28 04:28:48 2006
Yeah!
in my developing,
i define py['blog_debug'] = "DEBUG::" in config;
and in script:
data["debug"] = "%s
%s
%s"%(datadir
  ,str(pyhttp["QUERY_STRING"])
  ,walkdir)
so in templet usage $debug export debug info.

....


Post a new comment:

Three things:

  1. New comments get placed in a "draft" status and will NOT show up on the site until I explicitly approve it. Sometimes that happens within 24 hours.
  2. I reserve the right to reject/remove inappropriate comments.
  3. Sometimes I'll reply to a comment directly in email--so make sure your email address is correct.

If you can't for some reason post a comment, send me an email: willg at bluesock dot org.

Your name:


Your e-mail address (this doesn't get displayed to anyone--sometimes I'll reply directly to you):


URL of your website (optional):


Comment:


Yes, I am a human!


pyblosxom::1.5-dev git-master

Copyright 1996 to 2012, Will Guaraldi Kahn-Greene, under the Creative Commons BY-SA 3.0 license

Creative Commons License
Will's Blog by William Kahn-Greene is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.