+@decorators.command\r
+def award_points(request, id):\r
+ if (not request.POST) and request.POST.get('points', None):\r
+ raise decorators.CommandException(_("Invalid request type"))\r
+\r
+ if not request.user.is_superuser:\r
+ raise decorators.CommandException(_("Only superusers are allowed to award reputation points"))\r
+\r
+ user = get_object_or_404(User, id=id)\r
+ points = int(request.POST['points'])\r
+\r
+ extra = dict(message=request.POST.get('message', ''), awarding_user=request.user.id, value=points)\r
+\r
+ BonusRepAction(user=user, extra=extra).save(data=dict(value=points))\r
+\r
+ return dict(reputation=user.reputation)\r
+\r
+\r
+@decorators.command\r
+def suspend(request, id):\r
+ user = get_object_or_404(User, id=id)\r
+\r
+ if not request.POST:\r
+ if user.is_suspended():\r
+ suspension = user.suspension\r
+ suspension.cancel(ip=request.META['REMOTE_ADDR'])\r
+ return decorators.RefreshPageCommand()\r
+ else:\r
+ return render_to_response('users/suspend_user.html')\r
+\r
+ if not request.user.is_superuser:\r
+ raise decorators.CommandException(_("Only superusers can ban other users"))\r
+\r
+ data = {\r
+ 'bantype': request.POST.get('bantype', 'indefinetly').strip(),\r
+ 'publicmsg': request.POST.get('publicmsg', _('Bad behaviour')),\r
+ 'privatemsg': request.POST.get('privatemsg', None) or request.POST.get('publicmsg', ''),\r
+ 'suspender': request.user.id\r
+ }\r
+\r
+ if data['bantype'] == 'forxdays':\r
+ try:\r
+ data['forxdays'] = int(request.POST['forxdays'])\r
+ except:\r
+ raise decorators.CommandException(_('Invalid numeric argument for the number of days.'))\r
+\r
+ SuspendAction(user=user, ip=request.META['REMOTE_ADDR']).save(data=data)\r
+\r
+ return decorators.RefreshPageCommand()\r
+\r
+def user_view(template, tab_name, tab_title, tab_description, private=False, tabbed=True, weight=500):\r