def action(self, topic): if not perms.may_close_topic(self.request.user, topic): raise PermissionDenied topic.closed = True topic.save()