Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixes Issue #9 #10

Merged
merged 2 commits into from

2 participants

@skeet70

Removed a check for the username, so this assumes that the state has stayed intact and still has the valid username in it. Also added a check to make sure that the event exists before doing things to it.

@paltman paltman merged commit 7d69a06 into eldarion:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
2  brabeion/base.py
@@ -46,8 +46,6 @@ def actually_possibly_award(self, **state):
awarded = self.award(**state)
if awarded is None:
return
- if awarded.user is not None:
- user = awarded.user
if awarded.level is None:
assert len(self.levels) == 1
awarded.level = 1
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
-------------------
Something went wrong with that request. Please try again.