Re: Outdated plugins ?
Steven Armstrong <[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.user |
|---|---|
| Message-ID | <[email protected]> |
On 09/21/05 15:24, john wrote: > Hi pyblosxom's Gurus. > > > I try to use the showmore.py and pylists.py > (http://persson.cx/pyblosxom/code/pyblosxom/) with > Pyblosxom 1.2.1 and Python 2.3.2. Here the stacktrace for showmore.py. > > Hi John I've attached a version of showmore.py which should work with a recent pyblosxom installation. pylist.py: Maybe it'll work if you remove all import statements and the cb_filelist function and then just use the template variables $xyz-list in your flavour-template (assuming your list is named xyz). None of the imported modules are needed. The cb_filelist is IMHO also not needed. It doesn't do what a cb_filelist callback is supposed to do anyway. hope this helps cheers Steven
showmore.py
(text/x-python, 1.1 KB)
"""
Split the output so that the first paragraph of the entry is showed
on the main page, the full on a show more page
based on
href="http://www.bluesock.org/~willg/pyblosxom-dev/msg01004.html
href="http://www.bluesock.org/~willg/pyblosxom-dev/msg01030.html
"""
def showmore(args, var='More...'):
request = args["request"]
entry = args["entry"]
data = request.getData()
conf = request.getConfiguration()
entries = data['entry_list']
result = ""
if entry.has_key('more') and len(entries) == 1:
result = entry['more']
elif entry.has_key('more'):
result = '<a href="%s/%s">%s</a>' % (conf['base_url'], entry['file_path'], var)
entry["showmore"] = result
def cb_story(args):
showmore(args)
return args
def cb_postformat(args):
req = args['request']
config = req.getConfiguration()
text = str(args['entry_data']['body'])
try:
first, last = text.split("</p>",1)
if last:
args['entry_data']['body'] = first+"</p>"
args['entry_data']['more'] = last
except ValueError:
pass # No such thing as more than more