Ticket #3091: comments.patch
File comments.patch, 3.1 KB (added by , 18 years ago) |
---|
-
comments.py
154 154 c.save() 155 155 return c 156 156 157 def post_comment(request ):157 def post_comment(request, extra_context=None, context_processors=None): 158 158 """ 159 159 Post a comment 160 160 … … 232 232 return field_list 233 233 comment = errors and '' or manipulator.get_comment(new_data) 234 234 comment_form = CommentFormWrapper(manipulator, new_data, errors, rating_choices) 235 if extra_context is None: extra_context = {} 235 236 return render_to_response('comments/preview.html', { 236 237 'comment': comment, 237 238 'comment_form': comment_form, … … 243 244 'ratings_required': RATINGS_REQUIRED in option_list, 244 245 'rating_range': rating_range, 245 246 'rating_choices': rating_choices, 246 }, context_instance=RequestContext(request ))247 }, context_instance=RequestContext(request, extra_context, context_processors)) 247 248 elif request.POST.has_key('post'): 248 249 # If the IP is banned, mail the admins, do NOT save the comment, and 249 250 # serve up the "Thanks for posting" page as if the comment WAS posted. … … 256 257 else: 257 258 raise Http404, _("The comment form didn't provide either 'preview' or 'post'") 258 259 259 def post_free_comment(request ):260 def post_free_comment(request, extra_context=None, context_processors=None): 260 261 """ 261 262 Post a free comment (not requiring a log in) 262 263 … … 300 301 errors = manipulator.get_validation_errors(new_data) 301 302 if errors or request.POST.has_key('preview'): 302 303 comment = errors and '' or manipulator.get_comment(new_data) 304 if extra_context is None: extra_context = {} 303 305 return render_to_response('comments/free_preview.html', { 304 306 'comment': comment, 305 307 'comment_form': forms.FormWrapper(manipulator, new_data, errors), 306 308 'options': options, 307 309 'target': target, 308 310 'hash': security_hash, 309 }, context_instance=RequestContext(request ))311 }, context_instance=RequestContext(request, extra_context, context_processors)) 310 312 elif request.POST.has_key('post'): 311 313 # If the IP is banned, mail the admins, do NOT save the comment, and 312 314 # serve up the "Thanks for posting" page as if the comment WAS posted. … … 320 322 else: 321 323 raise Http404, _("The comment form didn't provide either 'preview' or 'post'") 322 324 323 def comment_was_posted(request ):325 def comment_was_posted(request, extra_context=None, context_processors=None): 324 326 """ 325 327 Display "comment was posted" success page 326 328 … … 337 339 obj = content_type.get_object_for_this_type(pk=object_id) 338 340 except ObjectDoesNotExist: 339 341 pass 340 return render_to_response('comments/posted.html', {'object': obj}, context_instance=RequestContext(request)) 342 if extra_context is None: extra_context = {} 343 return render_to_response('comments/posted.html', { 344 'object': obj 345 }, context_instance=RequestContext(request, extra_context, context_processors))