exception with Reverse for function post_comment when user is logged on

Issue #982 resolved
Franck Bret created an issue

This occurs only when a user or admin user is logged.
It doesn't occurs for me in local mode, only occurs with mod_wsgi as i can see.

The server is running with :
Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.9 with Suhosin-Patch proxy_html/3.0.0 mod_ssl/2.2.8 OpenSSL/0.9.8g mod_wsgi/1.3 Python/2.5.2

Seems to be an issue related to how reverse url function walk in django.

I've tried to transform within satchmo_ext/product_ratings/urls.py

commentpatterns = patterns('',
(r'^comments/', include('django.contrib.comments.urls')),
)

to

commentpatterns = patterns('',
(r'^comments/', include('django.contrib.comments.urls')),
(r'^comments/post/$', 'comments.post_rating', {'maxcomments': 1 }, 'satchmo_rating_post'),
)

This do nothing...

I've also try in product_ratings/models.py to put "comments" call before product, like this :
from urls import add_comment_urls, add_product_urls

collect_urls.connect(add_comment_urls, sender=satchmo_store)
collect_urls.connect(add_product_urls, sender=product)

Doesn't resolve too, as clearing server and client cache, removing old cookies etc...

maybe this post can be util :
http://stackoverflow.com/questions/1877940/django-1-1-comments-rendercommentform-returns-templatesyntaxerror

TemplateSyntaxError at /shop/product/neat-book_hard/

Caught an exception while rendering: Reverse for '<function post_comment at 0x2cf3398>' with arguments '()' and keyword arguments '{}' not found.

Original Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/django/template/debug.py", line 71, in render_node
result = node.render(context)
File "/usr/lib/python2.5/site-packages/django/template/init.py", line 909, in render
return func(resolved_vars)
File "/usr/lib/python2.5/site-packages/django/contrib/comments/templatetags/comments.py", line 253, in comment_form_target
return comments.get_form_target()
File "/usr/lib/python2.5/site-packages/django/contrib/comments/init.py", line 61, in get_form_target
return urlresolvers.reverse("django.contrib.comments.views.comments.post_comment")
File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py", line 341, in reverse
args, **kwargs)))
File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py", line 291, in reverse
"arguments '%s' not found." % (lookup_view, args, kwargs))
NoReverseMatch: Reverse for '<function post_comment at 0x2cf3398>' with arguments '()' and keyword arguments '{}' not found.

Comments (7)

  1. Tay Ray Chuan

    Hi,

    I suspect that the signal listeners aren't being triggered. In your log file, check that you see a 'adding comments urls' message.

    If not, I believe a sure-fire way would be to import satchmo_ext.productratings.models in your urls.py. (I've been bitten by this no-show for signals before. )

  2. Former user Account Deleted

    Mr. Tay Ray Chuan, You saved my day!. I had same problems i.e. no-show for signals. Thank you so much for your post solved my problem.

  3. Former user Account Deleted

    In my site the urls were working fine on my local box using runserver but the staging server using mod_python was not loading in the brands urls.

    To get by this I made sure to import the satchmo_ext.brand.model file before the satchmo_store.urls.urlpatterns. This added the signal listener correctly.

  4. Former user Account Deleted

    Thank you so much. I almost finished setting up my shop when this error occurred and didn't know what to do. Now it's fixed with the import.

  5. Log in to comment