[zopeorg-checkins] CVS: Products/ZopeOrg-NV/Extensions - NZOMigrate.py:1.4

Sidnei da Silva sidnei at x3ng.com.br
Mon Dec 30 10:30:17 EST 2002


Update of /cvs-zopeorg/Products/ZopeOrg-NV/Extensions
In directory cvs.zope.org:/tmp/cvs-serv4035/Extensions

Modified Files:
	NZOMigrate.py 
Log Message:
Migrate properties

=== Products/ZopeOrg-NV/Extensions/NZOMigrate.py 1.3 => 1.4 ===
                       obj.description or ''
         text = obj.content
         format = hasattr(obj, 'format') and obj.format or 'structured-text'
+        import pdb; pdb.set_trace()
         subject = (type(obj.subject) in [type(''), type([])]) and \
                   obj.subject or []
         doc.setTitle(title)
@@ -437,15 +438,13 @@
             obj_ids = obj.objectIds()
         
         if obj_ids:
-            if 'index_html' in obj_ids  and \
-            obj.index_html.meta_type in ['DTML Method', 'DTML Document'] :
-                obj_path = obj.getPhysicalPath()
-                for dm in ('index_html', 'local_nav', 'page_title',
+            obj_path = obj.getPhysicalPath()
+            for dm in ('local_nav', 'page_title',
                            'standard_html_footer', 'standard_html_header',
-                           'local_css', 'custom_html_header',
+                           'custom_html_header',
                            'custom_html_footer', 'local_exit'):
-                    if dm in obj_ids:
-                        ignore_path.append(obj_path + (dm,))
+                if dm in obj_ids:
+                    ignore_path.append(obj_path + (dm,))
         return ignore_path
 
     def fixOwnership(self, orig, new):
@@ -462,6 +461,14 @@
         if hasattr(aq_base(new), 'setModificationDate'):
             new.setModificationDate(mod_date)
         return new
+
+    def copyProperties(self, orig, new):
+        for prop in orig.propertyIds():
+            if not new.hasProperty(prop):
+                new._setProperty(prop, orig.getProperty(prop), \
+                                 orig.getPropertyType(prop))
+            else: new._setPropValue(prop, orig.getProperty(prop))
+        return new
         
     def run(self):
         source = self._source
@@ -495,6 +502,7 @@
                 else:
                     new_obj = self.fixOwnership(obj, new_obj)
                     new_obj = self.fixModificationDate(obj, new_obj)
+                    new_obj = self.copyProperties(obj, new_obj)
                     ct = getToolByName(new_obj, 'portal_catalog', None)
                     if ct is not None:
                         try: ct.reindexObject(obj)





More information about the zopeorg-checkins mailing list