Ticket #9614: comments.patch

File comments.patch, 878 bytes (added by anonymous, 16 years ago)

patch checking if request has an attribute user

  • comments.py

    old new  
    3131    """
    3232    # Fill out some initial data fields from an authenticated user, if present
    3333    data = request.POST.copy()
    34     if request.user.is_authenticated():
     34    if hasattr(request, 'user') and request.user.is_authenticated():
    3535        if not data.get('name', ''):
    3636            data["name"] = request.user.get_full_name() or request.user.username
    3737        if not data.get('email', ''):
     
    8787    # Otherwise create the comment
    8888    comment = form.get_comment_object()
    8989    comment.ip_address = request.META.get("REMOTE_ADDR", None)
    90     if request.user.is_authenticated():
     90    if hasattr(request, 'user') and request.user.is_authenticated():
    9191        comment.user = request.user
    9292
    9393    # Signal that the comment is about to be saved
Back to Top