betabug... Sascha Welter

home english | home deutsch | Site Map | Sascha | Kontakt | Pro | Weblog | Wiki

14 August 2005

Show Subcategorized Patch

Make COREBlog Subcategorized Entries Show Up in Category Pages
 

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".

Posted by betabug at 20:14 | Comments (1) | Trackbacks (0)
ch athens
Life in Athens (Greece) for a foreigner from the other side of the mountains. And with an interest in digital life and the feeling of change in a big city. Multilingual English - German - Greek.
Main blog page
Recent Entries
Best of
Some of the most sought after posts, judging from access logs and search engine queries.

Apple & Macintosh:
Security & Privacy:
Misc technical:
Athens for tourists and visitors:
Life in general:
<< Sundown at Zemata Beach | Main | Fahnen auf Halbmast >>
Comments
Re: Show Subcategorized Patch

Note that for COREBlog v 1.2.5 the patch is just a tiny but different. I posted the modifed patch at http://www.dudek.org/blog/36 and made a link back here to give credit. Thanks for figuring it out and posting the fix.

Posted by: Greg at February 23,2007 01:31
Trackbacks
You can trackback to: http://betabug.ch/blogs/ch-athens/167/tbping
There are no trackbacks.
Leave a comment