Re: variable interpolating/substitution
Steven Armstrong <[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.devel |
|---|---|
| Message-ID | <[email protected]> |
On 03/31/05 21:43, Pasi Savolainen wrote: > Hi, > I've worked on a port of Rael's interpolate_fancy -plugin and it's > basically 100% functional. > Original: > <http://www.blosxom.com/plugins/interpolate/interpolate_fancy.htm> > > - Short detour - > In templates following work: > <?$var>display if defined</?> > <?!$var>display if not defined</?> > <?$var operation="value">display if pass</?> > <@plugin.method someparam="baz" output="No" /> > <@otherplugin.somemethod param1="foo" param2="bar" output="Yes">passed as 'content' to p.m</@> > <@123p1.m1 params>foo<@321p2.m2 params>passed to p2.m2</@321> baz for p1.m1</@123> > - - > > The thing that troubles me is that I couldn't figure out if things that > are done in cb_story will be put in cache. > > I also couldn't really figure out the real order of all callbacks and > the context they are called in. Some kind of flowchart would be > extremely helpful for getting to know pyblosxom. I volunteer to draw one > if just someone could clue me in on the pyblosxom flow. > > I'm also missing the 'blosxom2.0 -standard' interpolate -callback. I've > inkling that this is done in some 'Pythonish' way, but there's no hint > for a developer coming from perl-blosxom world. <hint> <hint> :) > > Does anybody knows if it's possible to make epydoc generate annotated > source listings from code? It's a feature I miss from doxygen, it makes > it extremely easy to get acquainted with unfamiliar piece of code as > most functions are just a click away. > > > Thanks. > There used to be some info (e.g. flowchart) in the pyblosxom wiki, but that's currently down. I use the attached plugin to figure out how often and in which order callbacks are called. hth cheers Steven
flow.py
(text/x-python, 1.5 KB)
import sys
prefix = "flow: "
logfile = "/home/sar/weblog/logs/flow.log"
_log = None
def log(msg):
global _log
if _log == None or _log.closed:
_log = open(logfile, "a")
_log.write(msg +"\n")
_log.flush()
def getFuncName():
f = sys._getframe(1)
fn = f.f_code.co_name
return fn
#******************************
# Callbacks
#******************************
def cb_entryparser(entryparsingdict):
log(prefix + getFuncName())
return entryparsingdict
def cb_start(args):
log(prefix + getFuncName())
def cb_handle(args):
log(prefix + getFuncName())
def cb_renderer(args):
log(prefix + getFuncName())
def cb_pathinfo(args):
log(prefix + getFuncName())
def cb_filelist(args):
log(prefix + getFuncName())
def cb_filestat(args):
log(prefix + getFuncName())
return args
def cb_preformat(args):
log(prefix + getFuncName())
return ''.join(args['story'])
def cb_postformat(args):
log(prefix + getFuncName())
def cb_prepare(args):
log(prefix + getFuncName())
def cb_logrequest(args):
log(prefix + getFuncName())
def cb_head(args):
log(prefix + getFuncName())
return args
def cb_date_head(args):
log(prefix + getFuncName())
return args
def cb_story(args):
log(prefix + getFuncName())
return args
def cb_story_end(args):
log(prefix + getFuncName())
return args
def cb_foot(args):
log(prefix + getFuncName())
return args
def cb_end(args):
log(prefix + getFuncName())
if _log:
_log.close()