+ node = get_object_or_404(Node, id=id)
+ user = request.user
+
+ if not user.is_authenticated():
+ raise AnonymousNotAllowedException(_('mark posts as community wiki'))
+
+ if node.nis.wiki:
+ if not user.can_cancel_wiki(node):
+ raise NotEnoughRepPointsException(_('cancel a community wiki post'))
+
+ if node.nstate.wiki.action_type == "wikify":
+ node.nstate.wiki.cancel()
+ else:
+ node.nstate.wiki = None
+ else:
+ if not user.can_wikify(node):
+ raise NotEnoughRepPointsException(_('mark posts as community wiki'))