Show Subcategorized Patch
Stephan Goeldi from zopehosting.ch brought to my attention that COREBlog entries that have been set at a subcategory are not showing up on the page for that category. Of course this is a matter of taste or expectations. But once you want e.g. to show on the page for "digital" an entry which has "digital" only as a subcategory, you have to dive into the code. I did and produced a short patch. BTW: This all happened in July, but due to much work and then this vacation, now is that I get around to publish this...
The patch is working on my own machine and has been tested by Stephan Goeldi, it seems to work for him too. Even then, procede with caution, use at your own risk etc. The patch essentially changes just one line. The original code checks if there are any categories set (for safety I guess, since I believe this should not happen under normal conditions) and then lists only entries which have the category in question as the first entry of the list. The changed code keeps the check, then lists entries which have the category in question anywhere in the list. Trivial really. Here is the patch:
*** COREBlog.py Wed Jul 6 15:19:04 2005
--- COREBlog.py_backup Wed Jul 6 15:09:56 2005
***************
*** 913,919 ****
break
id = self.entry_list[c]
obj = self.getEntry(id)
! if obj.category and int_cat in obj.category:
if not consider_moderation or obj.moderated:
l.append(obj)
return l
--- 913,919 ----
break
id = self.entry_list[c]
obj = self.getEntry(id)
! if obj.category and obj.category[0] == int_cat:
if not consider_moderation or obj.moderated:
l.append(obj)
return l
Apply as usual with patch -p0 < coreblog_subcategory.patch.
There is only one problem with this code: The numbers behind the category display are off now. The count only the entries with that category as "main category". This could of course be corrected too. And in the end all this maybe should become an option in the administration interface, "list subcategorized entries too".