6 Jun 17:44
[patch] Catch an exception when processing metadata in entries
Hey,
I've just come across a bug that means PyBlosxom (trunk, r1318) dies
when it encounters a meta ("#") line in an entry that does not have
the full key-value pair. Here's a simple patch to catch that, save the
data, and print a warning to stderr.
Index: pyblosxom/Pyblosxom/pyblosxom.py
===================================================================
--- pyblosxom/Pyblosxom/pyblosxom.py (revision 1318)
+++ pyblosxom/Pyblosxom/pyblosxom.py (working copy)
@@ -994,7 +994,11 @@
meta = lines.pop(0)
meta = meta[1:].strip() # remove the hash
meta = meta.split(" ", 1)
- entryData[meta[0].strip()] = meta[1].strip()
+ try:
+ entryData[meta[0].strip()] = meta[1].strip()
+ except:
+ print >>sys.stderr, "meta %s has no data in %s" %
(meta[0], filename)
+ entryData[meta[0].strip()] = ""
# Call the preformat function
args = {'parser': entryData.get('parser', config.get('parser', 'plain')),
Regards,
--
--
Toby Smithe :: http://fulltinreality.com
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
RSS Feed