+class BonusRepAction(ActionProxy):
+ verb = _("gave bonus")
+
+ def process_data(self, value, affected):
+ self._value = value
+ self._affected = affected
+
+
+ def repute_users(self):
+ self.repute(self._affected, self._value)
+
+ if self._value < 0:
+ messages.info(REQUEST_HOLDER.request, _("You have penalized %s in %s reputation points.") % (self._affected, self._value) +
+ '<br />%s' % self.extra.get('message', ''))
+
+ def describe(self, viewer=None):
+ value = self.extra.get('value', _('unknown'))
+ message = self.extra.get('message', '')
+
+ try:
+ if int(value) > 0:
+ return _("%(user)s awarded an extra %(value)s reputation points to %(users)s: %(message)s") % {
+ 'user': self.hyperlink(self.user.get_absolute_url(), self.friendly_username(viewer, self.user)),
+ 'value': value, 'users':self.affected_links(viewer), 'message': message
+ }
+ else:
+ return _("%(user)s penalised %(users)s in %(value)s reputation points: %(message)s") % {
+ 'user': self.hyperlink(self.user.get_absolute_url(), self.friendly_username(viewer, self.user)),
+ 'value': value, 'users':self.affected_links(viewer), 'message': message
+ }
+ except Exception, e:
+ return ''
+
+class AwardPointsAction(ActionProxy):
+ verb = _("gave reputation points")
+
+ def process_data(self, value, affected):
+ self._value = value
+ self._affected = affected
+
+
+ def repute_users(self):
+ self.repute(self._affected, self._value)
+ self.repute(self.user, -self._value)
+
+ def describe(self, viewer=None):
+ value = self.extra.get('value', _('unknown'))
+
+ try:
+ if int(value) > 0:
+ return _("%(user)s awarded an extra %(value)s reputation points to %(users)s") % {
+ 'user': self.hyperlink(self.user.get_absolute_url(), self.friendly_username(viewer, self.user)),
+ 'value': value, 'users':self.affected_links(viewer),
+ }
+ else:
+ return _("%(user)s penalised %(users)s in %(value)s reputation points") % {
+ 'user': self.hyperlink(self.user.get_absolute_url(), self.friendly_username(viewer, self.user)),
+ 'value': value, 'users':self.affected_links(viewer),
+ }
+ except Exception, e:
+ return ''
+