Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit a1f25cb6c7bbe809dd2af1c2d4c036c8b699143f 1 parent fdeb3f4
@skeet70 authored
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
5 brabeion/internals.py
@@ -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
2  docs/models.txt
@@ -3,7 +3,7 @@ Models in ``brabeion``
.. module:: brabeion.models
-.. class:: BadgeAwarded(models.Model)
+.. class:: BadgeAward(models.Model)
.. attribute:: user
View
2  docs/usage.txt
@@ -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
-------------------
Please sign in to comment.
Something went wrong with that request. Please try again.