+ # Getting the current object URL -- the Application URL + the object relative URL
+ url = '%s%s' % (settings.APP_BASE_URL, answer.get_absolute_url())
+
+ if not request.POST:
+ # Display the template
+ return render_to_response('node/permanent_link.html', { 'url' : url, })
+
+ return {
+ 'commands' : {
+ 'copy_url' : [request.POST['permanent_link_url'],],
+ },
+ 'message' : _("The permanent URL to the answer has been copied to your clipboard."),
+ }
+
+@decorate.withfn(command)
+def award_points(request, user_id, answer_id):
+ user = request.user
+ awarded_user = get_object_or_404(User, id=user_id)
+ answer = get_object_or_404(Answer, id=answer_id)
+
+ # Users shouldn't be able to award themselves
+ if awarded_user.id == user.id:
+ raise CannotDoOnOwnException(_("award"))
+
+ # Anonymous users cannot award points, they just don't have such
+ if not user.is_authenticated():
+ raise AnonymousNotAllowedException(_('award'))
+
+ if not request.POST:
+ return render_to_response("node/award_points.html", { 'user' : user, 'awarded_user' : awarded_user, })
+ else:
+ points = int(request.POST['points'])