betabug... Sascha Welter

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

28 January 2005

Patching Moblog to Support Subtitles

Details and source for the patch
 

This procedure will allow you to add entries to your blog with COREblog's "moblog" feature and get a "subtitle" line too. Out of the box "moblogged" entries can just have a title (which is transmitted in the mail's "Subject" line) and picture (attached image, automatically added to the start of the entry). With the patch, you will have Subtitles for your moblog entries too. And yes, WARNING: This works for me, but who knows if it messes up everything for you. Test thoroughly if it works for you and if you don't know the stuff about getting it to work, better ask someone to help you with this.


After the change, the mails you send to to moblog should look like that:

Subject: Title for the Entry Goes Here

password123              <- first line of message, password
digital                  <- 2nd line of messsage, category
Subtitle will be here!   <- 3rd line of the message
And starting right after that is the text of the entry...
There is no switch for the change. If after applying the patch you don't want to have a subtitle for a post, you will have to add an empty line in the proper place. Otherwise the first line of your post will end up as the subtitle.

The patch

Save this to a file "moblog_subtitle.patch" in the Products/COREBlog directory of your Zope instance:

- - - - - - - - - Cut here - - - - - - - - - - -
*** COREBlog_old.py     Wed Jan 26 15:58:24 2005
--- COREBlog.py Wed Jan 26 16:18:10 2005
***************
*** 1543,1552 ****
                  pict_attached = 1
  
              #add entry body
!             if len(body_l) > 1:
                  blog_charcode = self.getProperty("management_page_charset")
                  posting_title = mh.getSubject()
!                 posting_body = join(body_l[1:],"\n")
                  if pict_attached:
                      posting_body = """<img src="./images/%s" border="0">\n""" % (pictid) + posting_body
                  main_category = self.getProperty("moblog_default_category")
--- 1543,1553 ----
                  pict_attached = 1
  
              #add entry body
!             if len(body_l) > 2:
                  blog_charcode = self.getProperty("management_page_charset")
                  posting_title = mh.getSubject()
!                 posting_subtitle = body_l[1]
!                 posting_body = join(body_l[2:],"\n")
                  if pict_attached:
                      posting_body = """<img src="./images/%s" border="0">\n""" % (pictid) + posting_body
                  main_category = self.getProperty("moblog_default_category")
***************
*** 1564,1570 ****
                  new_id = self.manage_addEntry(self.getProperty("author_for_moblog"),\
                                       posting_body,"","",\
                                       main_category,1,sub_category,\
!                                      posting_title,"","",0,comment_status,trackback_status)
                  if pict_attached:
                      try:
                          #set metadata(title,permalink) to added image
--- 1565,1573 ----
                  new_id = self.manage_addEntry(self.getProperty("author_for_moblog"),\
                                       posting_body,"","",\
                                       main_category,1,sub_category,\
!                                      posting_title,\
!                                      posting_subtitle,\
!                                      "",0,comment_status,trackback_status)
                  if pict_attached:
                      try:
                          #set metadata(title,permalink) to added image
- - - - - - - - - Cut here - - - - - - - - - - -
Watch out for any stray line breaks when copy/pasting!

Applying the patch:

This is a multistep process, involving changing the COREblog source code in your Zope's "Product" directory, let's go step by step:

Backup the original file: Move to the "COREblog" directory and there do:

$ cp COREBlog.py COREBlog.py_backup

Apply the patch: With the patch file in the same COREBlog directory, do:

$ patch -p0 < moblog_subtitle.patch
Output should look like that:
Hmm...  Looks like a new-style context diff to me...
The text leading up to this was:
--------------------------
|*** COREBlog_old.py    Wed Jan 26 15:58:24 2005
|--- COREBlog.py        Wed Jan 26 16:18:10 2005
--------------------------
Patching file COREBlog.py using Plan A...
Hunk #1 succeeded at 1543.
Hunk #2 succeeded at 1565.
done

Refresh the COREBlog Product: Navigate in the Zope Web Interface to the ControlPanel/Products/COREBlog screen, click on the "Refresh"-Tab and there on the "Refresh this Product" button. The changes you made will now be available. How refreshing!

Use this at your own risk and as much as you like, feel free to give my patch away and incorporate it into the COREBlog source if you are the maker :-)

Posted by betabug at 13:22 | Comments (0) | 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:
<< Link zum Artikel online | Main | Earthquake in Headlines >>
Comments
There are no comments.
Trackbacks
You can trackback to: http://betabug.ch/blogs/ch-athens/26/tbping
There are no trackbacks.
Leave a comment