[zopeorg-checkins] CVS: Products/ZopeOrg-NV/Extensions - NZOMigrate.py:1.19 change_modules.py:1.2
Sidnei da Silva
sidnei at x3ng.com.br
Sun Mar 16 08:20:37 EST 2003
Update of /cvs-zopeorg/Products/ZopeOrg-NV/Extensions
In directory cvs.zope.org:/tmp/cvs-serv12194
Modified Files:
NZOMigrate.py change_modules.py
Log Message:
Identation may kill you sometimes. Always use emacs ;)
=== Products/ZopeOrg-NV/Extensions/NZOMigrate.py 1.18 => 1.19 ===
if hasattr(obj, 'objectValues'):
for subob in obj.objectValues():
massPublish(subob)
- if hasattr(obj, 'keys'):
+ elif hasattr(obj, 'keys'):
for id in obj.keys():
- massPublish(obj[id])
+ try:
+ massPublish(obj[id])
+ except (KeyError, AttributeError):
+ log(pretty_exc(sys.exc_info()))
+ pass
+
def filterList(alist):
dict = {}
@@ -426,12 +431,6 @@
'custom_html_footer', 'local_exit'):
if dm in obj_ids:
ignore_path.append(obj_path + (dm,))
- # Exception: when migrating case studies we dont want to bring
- # the dtml methods to the new site. Only images and files.
- if obj_url.find('Resources/CaseStudies/') == 0:
- for o in obj.objectValues():
- if o.meta_type not in ['Image', 'File']:
- ignore_path.append(obj_path + (o.getId(),))
return ignore_path
def fixOwnership(orig, new):
@@ -454,14 +453,14 @@
def copyProperties(orig, new):
if not hasattr(aq_base(orig), 'propertyIds') or \
- not hasattr(aq_base(new), 'propertiIds'):
+ not hasattr(aq_base(new), 'propertyIds'):
return new
for prop in orig.propertyIds():
if not new.hasProperty(prop) and not hasattr(aq_base(new), prop):
type = orig.getPropertyType(prop)
if type in ('selection', 'multiple selection'):
for p in orig._properties:
- if p['id'] == prop:
+ if p['id'] == str(prop):
value = str(p['select_variable'])
break
if not hasattr(aq_base(new), value):
@@ -474,12 +473,12 @@
except:
log(pretty_exc(sys.exc_info()))
value = ''
- try:
- __traceback_info__ = ('copyProperties/setProperty(new)', \
- prop, value, type)
- new._setProperty(prop, value, type)
- except:
- log(pretty_exc(sys.exc_info()))
+ try:
+ __traceback_info__ = ('copyProperties/setProperty(new)', \
+ prop, value, type)
+ new._setProperty(prop, value, type)
+ except:
+ log(pretty_exc(sys.exc_info()))
else:
try:
__traceback_info__ = ('copyProperties/getProperty(existing)',
@@ -583,11 +582,11 @@
for id in ['case_facts', 'problem', 'solution', 'summary', \
'external_url', 'title']:
values[id] = ''
- prop = getattr(source, id, None)
+ prop = getattr(obj, id, None)
if prop is not None:
if callable(prop):
try:
- values[id] = prop(source)
+ values[id] = prop(obj)
except:
try:
values[id] = prop.raw()
@@ -601,7 +600,7 @@
new_obj.setSolution('text/html', values['solution'])
new_obj.setExternalURL(values['external_url'])
new_obj.setTitle(values['title'])
- if hasattr(aq_base(source), 'logo'):
+ if hasattr(aq_base(obj), 'logo'):
new_obj.setLogo('logo')
return (new_obj, dest)
@@ -713,11 +712,11 @@
r = getattr(f, obj.getId())
platform = obj.platform
maturity = obj.status
- info_url = obj.info_url
- license_url = obj.license_url
- changes_url = obj.changes_url
- installation_url = obj.installation_url
- license = obj.license
+ info_url = getattr(aq_base(obj), 'info_url', '')
+ license_url = getattr(aq_base(obj), 'license_url', '')
+ changes_url = getattr(aq_base(obj), 'changes_url', '')
+ installation_url = getattr(aq_base(obj), 'installation_url', '')
+ license = getattr(aq_base(obj), 'license', '')
data = str(obj.data)
size = len(data)
content_type = obj._get_content_type(obj.data, data, obj.__name__,
=== Products/ZopeOrg-NV/Extensions/change_modules.py 1.1 => 1.2 ===
-_trans = {
- ('OFS.ObjectManager', 'Folder'):
- ('CMFCore.PortalFolder', 'PortalFolder'),
- }
+_trans =
-def changeClassModules(self, root_object=None):
+def changeClassModules(self, root_object=None,
+ _trans={('OFS.Folder', 'Folder'):
+ ('Products.CMFCore.PortalFolder', 'PortalFolder'),
+ }):
get_transaction().commit(1) # Make sure the current state is stored
jar = self._p_jar
if root_object is None:
@@ -97,7 +97,7 @@
try:
# Get persistent_load() and find_global() called.
state = unpickler.load()
- except (ImportError, AttributeError):
+ except (ImportError, AttributeError, UnicodeError):
# There are problems with this object.
LOG('changeClasses', WARNING, 'Could not load state for OID '
'%s, class %s' % (repr(oid), repr(class_spec)))
More information about the zopeorg-checkins
mailing list