Opened 10 years ago

Last modified 7 years ago

#10677 closed

post_save_moderation breaks confirmation view — at Initial Version

Reported by: nate-django@… Owned by: nobody
Component: contrib.comments Version: 1.1-beta
Severity: Keywords: django comments moderation
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I tried out the new moderation tools and I found that when a comment is deleted in the post_save signal handler post_save_moderation(), it breaks the comment confirmation view because the comment instance is gone and _get_pk_val() returns None. This causes the following traceback for the redirected request.

File "/var/lib/python-support/python2.5/django/core/handlers/base.py" in get_response

  1. response = callback(request, *callback_args, callback_kwargs)

File "/var/lib/python-support/python2.5/django/contrib/comments/views/utils.py" in confirmed

  1. comment = comments.get_model().objects.get(pk=request.GETc?)

File "/var/lib/python-support/python2.5/django/db/models/manager.py" in get

  1. return self.get_query_set().get(*args, kwargs)

File "/var/lib/python-support/python2.5/django/db/models/query.py" in get

  1. clone = self.filter(*args, kwargs)

File "/var/lib/python-support/python2.5/django/db/models/query.py" in filter

  1. return self._filter_or_exclude(False, *args, kwargs)

File "/var/lib/python-support/python2.5/django/db/models/query.py" in _filter_or_exclude

  1. clone.query.add_q(Q(*args, kwargs))

File "/var/lib/python-support/python2.5/django/db/models/sql/query.py" in add_q

  1. can_reuse=used_aliases)

File "/var/lib/python-support/python2.5/django/db/models/sql/query.py" in add_filter

  1. self.where.add((alias, col, field, lookup_type, value), connector)

File "/var/lib/python-support/python2.5/django/db/models/sql/where.py" in add

  1. params = field.get_db_prep_lookup(lookup_type, value)

File "/var/lib/python-support/python2.5/django/db/models/fields/init.py" in get_db_prep_lookup

  1. return [self.get_db_prep_value(value)]

File "/var/lib/python-support/python2.5/django/db/models/fields/init.py" in get_db_prep_value

  1. return int(value)

Exception Type: ValueError at /comments/posted/
Exception Value: invalid literal for int() with base 10: 'None'

Shouldn't moderation.py connect to the comment_will_be_posted signal so post_comment() can handle the signal response?

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top