Migration from Quills to standard News Item
The Quills blogging product for Plone, former Daily Indigest foundation , seems no longer developed. I need to upgrade my Plone installation, so today I converted all my WeblogEntry's to News Item content types. How did I do?
First of all, I created an old_blog folder where to store migrated content. I intend to create new object keeping old ones as references.
Quills blog post are registered as "WeblogEntry" portal types. So I got all these posts by searching the portal_catalog for portal_type="WeblogEntry".
Once I have this entries list, I can iterate over each element, create a new "News Item" object in the old_blog (context) directory, and fill it with original metadata.
In addition to standard object properties like id, Title, Description, Creation/Effective/ModificationDate, WeblogEntry store its content inside a Text or RawText field. You can verify this by yourself by typing http://...WeblogEntry addrr.../getRawText in a browser. So we now have almost complete access to WeblogEntry data. I will discart Subject (topics) and comments. Not a big loss for me!
Last but not least, the object must be re-indexed in the plone site catalog.
# -*- coding: utf-8 -*-
"""Quills to NewsItem migration script
mythsmith 11/2009"""
request = container.REQUEST
RESPONSE = request.RESPONSE
# List all legacy WeblogEntry objects:
entries=context.portal_catalog.searchResults(
portal_type="WeblogEntry")
for et in entries:
obj=et.getObject()
print obj.id
# Create the newsitem object
context.invokeFactory(
type_name="News Item",
id=obj.id,title=obj.Title())
# Find the new object
nobj = getattr(context,obj.id)
# Set its format, content and description
nobj.setTitle(obj.Title())
nobj.setFormat('text/html')
nobj.setText(obj.getRawText())
nobj.setDescription(obj.Description())
nobj.setModificationDate(obj.modified())
nobj.setEffectiveDate(obj.effective())
nobj.setCreationDate(obj.created())
nobj.indexObject()
return printed
Finally I can uninstall Quills!



