Random ...
 
December 2017
S M T W T F S
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Tags ...
Links



python+zope++:: Converting to Bitakora: getting entries from COREBlog
Posted at 20.Aug,2007 17:36  Comments 0 / Trackbacks 0 / Like this post!
Technorati tag(s):

This was discussed some time ago. And it's been a while.

Here's a working script to get stuff from COREBlog and import to a new Bitakora instance. Put it in your COREBlog instance:

  from DateTime import DateTime
msj= """<?xml version="1.0" encoding="UTF-8"?>
 <posts>
 """

 for i in container.rev_entry_items(start=0,count=100):
  msj+= """ <post>
   <author> %s </author>
   <title><![CDATA[ %s  ]]></title>
   <date>  %s  </date>
   <body><![CDATA[ %s   ]]></body>
   <tags><![CDATA[   ]]></tags>
   <comments>
    """ % (i.author,i.title, i.date_created().strftime('%d/%b/%Y %H:%M'),i.rendered_body)
  if len(i.comments):
    for c in i.comment_list():
      msj += """   
     <comment>
       <author><![CDATA[  %s ]]> </author>
       <date>  %s </date>
       <body><![CDATA[ %s   ]]></body>
       <url><![CDATA[ %s  ]]></url>
       <email><![CDATA[ %s  ]]></email>
     </comment>
     """ % (c.author,DateTime(c.created).strftime('%d/%b/%Y %H:%M'),c.body,c.url,c.email)
  msj+="""</comments>
    </post>
    """
 msj += '</posts>'

 return msj


Bookmark and Share

Is this entry helpful? Comments/Donate/Click some google ads.  
Trackback is http://myzope.kedai.com.my/blogs/kedai/146/tbping 

Comments
Post a comment