diff --git a/boards/models/post.py b/boards/models/post.py --- a/boards/models/post.py +++ b/boards/models/post.py @@ -293,7 +293,7 @@ class Post(models.Model, Viewable): """ if format_type == DIFF_TYPE_HTML: - if PARAMETER_TRUNCATED in request.GET: + if request is not None and PARAMETER_TRUNCATED in request.GET: truncated = True reply_link = False else: diff --git a/boards/views/api.py b/boards/views/api.py --- a/boards/views/api.py +++ b/boards/views/api.py @@ -1,11 +1,9 @@ -from datetime import datetime import json import logging + from django.db import transaction from django.http import HttpResponse -from django.shortcuts import get_object_or_404, render -from django.template import RequestContext -from django.utils import timezone +from django.shortcuts import get_object_or_404 from django.core import serializers from boards.forms import PostForm, PlainErrorList @@ -14,6 +12,7 @@ from boards.utils import datetime_to_epo from boards.views.thread import ThreadView from boards.models.user import Notification + __author__ = 'neko259' PARAMETER_TRUNCATED = 'truncated' @@ -207,7 +206,7 @@ def api_get_notifications(request, usern last_id = int(last_notification_id_str) if last_notification_id_str is not None else None posts = Notification.objects.get_notification_posts(username=username, - last=last_id) + last=last_id) json_post_list = [] for post in posts: @@ -215,7 +214,6 @@ def api_get_notifications(request, usern return HttpResponse(content=json.dumps(json_post_list)) - def api_get_post(request, post_id): """ Gets the JSON of a post. This can be