liqd/adhocracy — pull request #518 by xi (2013-08-01 15:30:08+00:00)
Title: fix comment variant

Comments behaved strangly when not specifying a variant. I tried to track down the reasons for that and here is what I have found:

* Comments may have a variant set. But since `nullable=True` is set in the model the variant may be `None`.
* Other that `Comment.__init__`, `Comment.create` will set variant to `Text.HEAD` if none is given.
* if variant is `None`, `lib.helpers.comments_sorted()` will always return an empty list. Since `None` is the default value for variant this will always happen if no variant is specified

For me it seems like `Comments.variant.nullable` should be False and `Comment.__init__` and `lib.helpers.comments_sorted()` should set variant to `Text.HEAD` if none is given. This is what is done in this PR.

**Warning** I did not yet write a database migration. As I have very little experience with that it would be great if someone could do that for me.