Skip to content

Commit

Permalink
add a property that is always present for testing if secretballot is …
Browse files Browse the repository at this point in the history
…on a class, fixes #8
  • Loading branch information
jamesturk committed Apr 3, 2014
1 parent d627429 commit fbf6822
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.rst
Expand Up @@ -66,6 +66,10 @@ total_downvotes:
vote_total:
shortcut accessor for (total_upvotes-total_downvotes)
(can be renamed by passing ``total_name`` parameter to ``enable_voting_on``)
_secretballot_enabled
boolean indicating that secretballot is enabled (can be tested for with hasattr)
(cannot be renamed, exists for a reliable check that secretballot is available even if all
other fields were renamed)

Functions
~~~~~~~~~
Expand Down
1 change: 1 addition & 0 deletions secretballot/__init__.py
Expand Up @@ -76,3 +76,4 @@ def from_request(self, request):
cls.add_to_class(total_name, property(get_total))
cls.add_to_class(add_vote_name, add_vote)
cls.add_to_class(remove_vote_name, remove_vote)
setattr(cls, '_secretballot_enabled', True)

0 comments on commit fbf6822

Please sign in to comment.