From: Suresh V <svn...@pl...> - 2010-11-05 17:36:22
|
Author: sureshvv Date: Fri Nov 5 17:35:02 2010 New Revision: 226156 Modified: collective.migrator/trunk/collective/migrator/scripts/memberdata.py collective.migrator/trunk/collective/migrator/scripts/related_items.py collective.migrator/trunk/collective/migrator/scripts/site_config.py Log: changes Modified: collective.migrator/trunk/collective/migrator/scripts/memberdata.py ============================================================================== --- collective.migrator/trunk/collective/migrator/scripts/memberdata.py (original) +++ collective.migrator/trunk/collective/migrator/scripts/memberdata.py Fri Nov 5 17:35:02 2010 @@ -1,4 +1,30 @@ from StringIO import StringIO + +def chk_editor(self): + out = StringIO() + mtool = self.portal_membership + dtool = self.portal_memberdata + props = dtool.propertyIds() + for mem_id in mtool.listMemberIds(): + mem = mtool.getMemberById(mem_id) + if mem.getProperty('wysiwyg_editor') != 'TinyMCE': + print >> out, 'Bad editor', mem.getProperty('wysiwyg_editor'), ' for member', mem_id + print >> out, 'Done' + return out.getvalue() + +def chg_editor(self): + out = StringIO() + mtool = self.portal_membership + dtool = self.portal_memberdata + props = dtool.propertyIds() + last_props = {} + last_props['wysiwyg_editor'] = 'TinyMCE' + for mem_id in mtool.listMemberIds(): + mem = mtool.getMemberById(mem_id) + mem.setMemberProperties(last_props) + print >> out, 'Done' + return out.getvalue() + def load_memberdata(self): out = StringIO() mtool = self.portal_membership Modified: collective.migrator/trunk/collective/migrator/scripts/related_items.py ============================================================================== --- collective.migrator/trunk/collective/migrator/scripts/related_items.py (original) +++ collective.migrator/trunk/collective/migrator/scripts/related_items.py Fri Nov 5 17:35:02 2010 @@ -1,4 +1,5 @@ from StringIO import StringIO +from Products.Archetypes.exceptions import ReferenceException def set_related_items(self): """ this fixes schema of old documents """ @@ -10,7 +11,11 @@ set1 = set(obj[0].getRelatedItems()) set2 = set(obj[1:]) if set1 != set2: - obj[0].setRelatedItems(obj[1:]) + try: + obj[0].setRelatedItems(obj[1:]) + except ReferenceException: + print >> out, 'COULD NOT change', items[0], 'had', set1, 'now', set2 + continue print >> out, 'Changed', items[0], 'had', set1, 'now', set2 return out.getvalue() @@ -31,4 +36,16 @@ print >> out return out.getvalue() - +def show_items(self, ptype): + """ this fixes schema of old documents """ + out = StringIO() + pc = self.portal_catalog + res = pc(portal_type=ptype) + for o1 in res: + try: + o1 = o1.getObject() + print >> out, '/'.join(o1.getPhysicalPath()) + except AttributeError: + print >> out, 'BORKED', o1.getURL() + continue + return out.getvalue() Modified: collective.migrator/trunk/collective/migrator/scripts/site_config.py ============================================================================== --- collective.migrator/trunk/collective/migrator/scripts/site_config.py (original) +++ collective.migrator/trunk/collective/migrator/scripts/site_config.py Fri Nov 5 17:35:02 2010 @@ -13,6 +13,27 @@ from contentratings.interfaces import IEditorRatable, IUserRatable, IUserRating, IEditorialRating from Products.ATContentTypes.content.schemata import finalizeATCTSchema +def chg_catalog_icon(self): + out = StringIO() + pc = self.portal_catalog + res = pc(portal_type='FeedFeederItem') + res = ( o.getObject() for o in res if o.getIcon == 'folder_icon.gif' and o.getObject() ) + cnt = 0 + for obj in res: + obj.reindexObject(idxs=[]) + cnt += 1 + print >> out, cnt, 'objects updated' + return out.getvalue() + +def enable_syndication(self, obj): + """ enable syndication """ + tool = self.portal_syndication + obj = self.restrictedTraverse(obj) + #tool.enableSyndication(obj) + #ob1 = getattr(obj, 'syndication_information') + #return ob1.absolute_url() + return tool.isSyndicationAllowed(obj) + def show_fieldsets(self): """ this fixes schema of old documents """ out = StringIO() |