Permalink
Browse files

Fixes KeyError when there isn't an event in the registry.

  • Loading branch information...
skeet70 committed Jun 1, 2012
1 parent fdeb3f4 commit a1f25cb6c7bbe809dd2af1c2d4c036c8b699143f
Showing with 5 additions and 4 deletions.
  1. +3 −2 brabeion/internals.py
  2. +1 −1 docs/models.txt
  3. +1 −1 docs/usage.txt
View
@@ -26,8 +26,9 @@ def register(self, badge):
self._event_registry.setdefault(event, []).append(badge)
def possibly_award_badge(self, event, **state):
- for badge in self._event_registry[event]:
- badge.possibly_award(**state)
+ if event in self._event_registry:
+ for badge in self._event_registry[event]:
+ badge.possibly_award(**state)
badges = BadgeCache()
View
@@ -3,7 +3,7 @@ Models in ``brabeion``
.. module:: brabeion.models
-.. class:: BadgeAwarded(models.Model)
+.. class:: BadgeAward(models.Model)
.. attribute:: user
View
@@ -100,7 +100,7 @@ to the user:
By default badges will be awarded at the current time, if you need to overide
the award time of the badge you can pass a ``force_timestamp`` keyword argument
-to ``possible_award_badge()``.
+to ``possibly_award_badge()``.
Asynchronous Badges
-------------------

0 comments on commit a1f25cb

Please sign in to comment.