[FIX] website_forum: avoid access error when closing spam/abuse questions
authorOlivier Dony <odo@openerp.com>
Mon, 10 Nov 2014 15:20:23 +0000 (16:20 +0100)
committerOlivier Dony <odo@openerp.com>
Mon, 10 Nov 2014 15:20:23 +0000 (16:20 +0100)
Logging the user login is not necessary, but
accessing it might cause access errors. Logging
the UID is equivalent anyway, so let's not bother.

addons/website_forum/models/forum.py

index a9e192c..4c36d68 100644 (file)
@@ -393,7 +393,7 @@ class Post(osv.Model):
         for post in self.browse(cr, uid, ids, context=context):
             if post.closed_reason_id.id in (reason_offensive, reason_spam):
                 _logger.info('Upvoting user <%s>, reopening spam/offensive question',
-                             post.create_uid.login)
+                             post.create_uid)
                 # TODO: in master, consider making this a tunable karma parameter
                 self.pool['res.users'].add_karma(cr, SUPERUSER_ID, [post.create_uid.id],
                                                  post.forum_id.karma_gen_question_downvote * -5,
@@ -409,7 +409,7 @@ class Post(osv.Model):
         if reason_id in (reason_offensive, reason_spam):
             for post in self.browse(cr, uid, ids, context=context):
                 _logger.info('Downvoting user <%s> for posting spam/offensive contents',
-                             post.create_uid.login)
+                             post.create_uid)
                 # TODO: in master, consider making this a tunable karma parameter
                 self.pool['res.users'].add_karma(cr, SUPERUSER_ID, [post.create_uid.id],
                                                  post.forum_id.karma_gen_question_downvote * 5,