This commit is contained in:
Timo Stollenwerk 2013-04-17 14:55:50 +02:00
parent 048ca0a87a
commit 65ade424d8

View File

@ -107,9 +107,13 @@ class View(BrowserView):
comment.author_name = member.fullname comment.author_name = member.fullname
if not comment.author_name: if not comment.author_name:
# In migrated site member.fullname ='' while member.getProperty('fullname') has the correct value # In migrated site member.fullname = ''
# while member.getProperty('fullname') has the
# correct value
if member: if member:
comment.author_name = member.getProperty('fullname') comment.author_name = member.getProperty(
'fullname'
)
else: else:
comment.author_name = comment.author_username comment.author_name = comment.author_username
@ -140,8 +144,8 @@ class View(BrowserView):
'comment': 'Migrated workflow state', 'comment': 'Migrated workflow state',
'review_state': old_status and old_status.get( 'review_state': old_status and old_status.get(
'review_state', 'review_state',
new_workflow.initial_state) new_workflow.initial_state
or 'published', ) or 'published',
'time': DateTime() 'time': DateTime()
} }
workflow.setStatusOf('comment_review_workflow', workflow.setStatusOf('comment_review_workflow',
@ -186,13 +190,17 @@ class View(BrowserView):
object_provides='Products.CMFCore.interfaces._content.IContentish') object_provides='Products.CMFCore.interfaces._content.IContentish')
log("Found %s content objects." % len(brains)) log("Found %s content objects." % len(brains))
count_discussion_items = len(catalog.searchResults( count_discussion_items = len(
Type='Discussion Item')) catalog.searchResults(Type='Discussion Item')
count_comments_pad = len(catalog.searchResults( )
object_provides=IComment.__identifier__)) count_comments_pad = len(
count_comments_old = len(catalog.searchResults( catalog.searchResults(object_provides=IComment.__identifier__)
object_provides=IDiscussionResponse.\ )
__identifier__)) count_comments_old = len(
catalog.searchResults(
object_provides=IDiscussionResponse.__identifier__
)
)
log("Found %s Discussion Item objects." % count_discussion_items) log("Found %s Discussion Item objects." % count_discussion_items)
log("Found %s old discussion items." % count_comments_old) log("Found %s old discussion items." % count_comments_old)
@ -225,10 +233,14 @@ class View(BrowserView):
obj.talkback = None obj.talkback = None
if self.total_comments_deleted != self.total_comments_migrated: if self.total_comments_deleted != self.total_comments_migrated:
log("Something went wrong during migration. The number of \ log(
migrated comments (%s) differs from the number of deleted \ "Something went wrong during migration. The number of " +
comments (%s)." # pragma: no cover "migrated comments (%s) differs from the number of deleted " +
% (self.total_comments_migrated, self.total_comments_deleted)) "comments (%s)." % (
self.total_comments_migrated,
self.total_comments_deleted
)
)
if not test: # pragma: no cover if not test: # pragma: no cover
transaction.abort() # pragma: no cover transaction.abort() # pragma: no cover
log("Abort transaction") # pragma: no cover log("Abort transaction") # pragma: no cover
@ -241,9 +253,11 @@ class View(BrowserView):
% (self.total_comments_migrated, count_comments_old)) % (self.total_comments_migrated, count_comments_old))
if self.total_comments_migrated != count_comments_old: if self.total_comments_migrated != count_comments_old:
log("%s comments could not be migrated." % log(
(count_comments_old - \ "%s comments could not be migrated." % (
self.total_comments_migrated)) # pragma: no cover count_comments_old - self.total_comments_migrated
)
) # pragma: no cover
log("Please make sure your " + log("Please make sure your " +
"portal catalog is up-to-date.") # pragma: no cover "portal catalog is up-to-date.") # pragma: no cover