##// END OF EJS Templates
Fixed issue in rendering post without having a request
neko259 -
r1117:899891b1 default
parent child Browse files
Show More
@@ -293,7 +293,7 b' class Post(models.Model, Viewable):'
293 """
293 """
294
294
295 if format_type == DIFF_TYPE_HTML:
295 if format_type == DIFF_TYPE_HTML:
296 if PARAMETER_TRUNCATED in request.GET:
296 if request is not None and PARAMETER_TRUNCATED in request.GET:
297 truncated = True
297 truncated = True
298 reply_link = False
298 reply_link = False
299 else:
299 else:
@@ -1,11 +1,9 b''
1 from datetime import datetime
2 import json
1 import json
3 import logging
2 import logging
3
4 from django.db import transaction
4 from django.db import transaction
5 from django.http import HttpResponse
5 from django.http import HttpResponse
6 from django.shortcuts import get_object_or_404, render
6 from django.shortcuts import get_object_or_404
7 from django.template import RequestContext
8 from django.utils import timezone
9 from django.core import serializers
7 from django.core import serializers
10
8
11 from boards.forms import PostForm, PlainErrorList
9 from boards.forms import PostForm, PlainErrorList
@@ -14,6 +12,7 b' from boards.utils import datetime_to_epo'
14 from boards.views.thread import ThreadView
12 from boards.views.thread import ThreadView
15 from boards.models.user import Notification
13 from boards.models.user import Notification
16
14
15
17 __author__ = 'neko259'
16 __author__ = 'neko259'
18
17
19 PARAMETER_TRUNCATED = 'truncated'
18 PARAMETER_TRUNCATED = 'truncated'
@@ -207,7 +206,7 b' def api_get_notifications(request, usern'
207 last_id = int(last_notification_id_str) if last_notification_id_str is not None else None
206 last_id = int(last_notification_id_str) if last_notification_id_str is not None else None
208
207
209 posts = Notification.objects.get_notification_posts(username=username,
208 posts = Notification.objects.get_notification_posts(username=username,
210 last=last_id)
209 last=last_id)
211
210
212 json_post_list = []
211 json_post_list = []
213 for post in posts:
212 for post in posts:
@@ -215,7 +214,6 b' def api_get_notifications(request, usern'
215 return HttpResponse(content=json.dumps(json_post_list))
214 return HttpResponse(content=json.dumps(json_post_list))
216
215
217
216
218
219 def api_get_post(request, post_id):
217 def api_get_post(request, post_id):
220 """
218 """
221 Gets the JSON of a post. This can be
219 Gets the JSON of a post. This can be
General Comments 0
You need to be logged in to leave comments. Login now