Parser Fragility
"Sebastian Spaeth" <[email protected]> Tue, 04 May 2010 10:49:56 +0200
| Newsgroups | gmane.comp.web.pyblosxom.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Will,
I was just testing the latest pyblosxom git on my existing blog entries
and they die:
File "/home/spaetz/sspaeth.de/pyblosxom/Pyblosxom/pyblosxom.py", line 439, in run_pyblosxom
p.run()
File "/home/spaetz/sspaeth.de/pyblosxom/Pyblosxom/pyblosxom.py", line 165, in run
blosxom_handler(self._request)
File "/home/spaetz/sspaeth.de/pyblosxom/Pyblosxom/pyblosxom.py", line 925, in blosxom_handler
renderer.render()
File "/home/spaetz/sspaeth.de/pyblosxom/Pyblosxom/renderers/debug.py", line 115, in render
escv(content.get('filename', 'No such file\\n')))
File "/home/spaetz/sspaeth.de/pyblosxom/Pyblosxom/entries/base.py", line 279, in get
return self.__getitem__(key, default)
File "/home/spaetz/sspaeth.de/pyblosxom/Pyblosxom/entries/base.py", line 257, in __getitem__
return self.get_metadata(key, default)
File "/home/spaetz/sspaeth.de/pyblosxom/Pyblosxom/entries/fileentry.py", line 96, in get_metadata
self._populatedata()
File "/home/spaetz/sspaeth.de/pyblosxom/Pyblosxom/entries/fileentry.py", line 151, in _populatedata
entrydict = eparser(self._filename, self._request)
File "/home/spaetz/sspaeth.de/pyblosxom/Pyblosxom/pyblosxom.py", line 970, in blosxom_entry_parser
entry_data[meta[0].strip()] = meta[1].strip()
IndexError: list index out of range
This happens when parsing the #meta data in blog posts, I think. It
absolutely expects to find something after a "#foo " or it will break. I
think we should make pyblosxom a bit more robust, an empty #tags set for
example might be uncommon but no reason to make pyblosxom crash.
Also, I happened to run the tags plugin with the command categoriestotags
previously which inserted loads of "#tags \r" lines, which caused above
crash to occur. Should the category plugin try to insert empty #tags
lines?
Sebastian
------------------------------------------------------------------------------
_______________________________________________
Pyblosxom-devel mailing list
Pyblosxom-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/pyblosxom-devel
signature.asc
(application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAkvf37QACgkQVYX1jMgnoGKS3QCfRK/DzIs45sLAWK70Ssb28TlA zzcAn2POvAuY/KbJ567w2+fuq2zXowb0 =AS4L -----END PGP SIGNATURE-----