danirus/django-comments-xtd — pull request #7 by bartTC (2013-04-08 15:18:46+00:00)
Title: (WIP) Fix to save a Comment in Django 1.5

**This is work in progress**

In my project using Django 1.5 I can not save a comment due to that the `**Comment` instance cannot be used as initials for a `XtdComment` instance. I had to convert the `Comment` to a dictionary first and also removing attributes starting with an underscore.

This is kind of a hot fix at the moment, the `XtdComment(**Comment)` is quite a common pattern for me too, and I dont know if this is really just not working since Django 1.5 or if Python is involved.

For whats it worth, the test suite runs fine under Django 1.5.

So yeah, need more investigation but I'm opening a pull request in case somebody else ran into this.

The full traceback was:

```
Traceback:
File "/Users/martin/.virtualenv/project/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
115. response = callback(request, *callback_args, **callback_kwargs)
File "/Users/martin/.virtualenv/project/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
91. response = view_func(request, *args, **kwargs)
File "/Users/martin/.virtualenv/project/lib/python2.7/site-packages/django/views/decorators/http.py" in inner
41. return func(request, *args, **kwargs)
File "/Users/martin/.virtualenv/project/lib/python2.7/site-packages/django/contrib/comments/views/comments.py" in post_comment
128. request=request
File "/Users/martin/.virtualenv/project/lib/python2.7/site-packages/django/dispatch/dispatcher.py" in send
170. response = receiver(signal=self, sender=sender, **named)
File "/Users/martin/.virtualenv/project/lib/python2.7/site-packages/django_comments_xtd/views.py" in on_comment_was_posted
72. new_comment = _create_comment(comment)
File "/Users/martin/.virtualenv/project/lib/python2.7/site-packages/django_comments_xtd/views.py" in _create_comment
55. comment = XtdComment(**tmp_comment)

Exception Type: TypeError at /forum/post/
Exception Value: ModelBase object argument after ** must be a mapping, not Comment
```