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

View File

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