diff options
Diffstat (limited to 'servo')
-rw-r--r-- | servo/models/note.py | 5 | ||||
-rw-r--r-- | servo/tasks.py | 7 | ||||
-rw-r--r-- | servo/views/checkin.py | 3 |
3 files changed, 11 insertions, 4 deletions
diff --git a/servo/models/note.py b/servo/models/note.py index 5db054b..ad92f7e 100644 --- a/servo/models/note.py +++ b/servo/models/note.py @@ -231,6 +231,7 @@ class Note(MPTTModel): return ' '.join(classes) def find_parent(self, txt): + """Finds the parent of this note""" cookie = re.search(r'\(SRO#([\w/]+)\)', txt) if not cookie: @@ -249,9 +250,7 @@ class Note(MPTTModel): @classmethod def from_email(cls, msg, user): - """ - Creates a new Note from an email message - """ + """Creates a new Note from an email message""" sender = decode_header(msg['From']) detected = chardet.detect(sender[0][0]).get('encoding') sender = [i[0].decode(i[1] or detected) for i in sender] diff --git a/servo/tasks.py b/servo/tasks.py index 9520db8..d24da49 100644 --- a/servo/tasks.py +++ b/servo/tasks.py @@ -33,6 +33,7 @@ def get_rules(): @shared_task def apply_rules(event): + counter = 0 rules = cache.get('rules', get_rules()) order = event.content_object @@ -77,7 +78,11 @@ def apply_rules(event): note.body = r['data'] note.save() - return note.send_sms(number, event.triggered_by) + note.send_sms(number, event.triggered_by) + + counter += 1 + + return '%d rules processed' % counter @shared_task diff --git a/servo/views/checkin.py b/servo/views/checkin.py index 16d852c..d48c907 100644 --- a/servo/views/checkin.py +++ b/servo/views/checkin.py @@ -210,7 +210,10 @@ def terms(request): def index(request): + """The checkin page + @FIXME: would be nice to break this into smaller chunks... + """ if request.method == 'GET': reset_session(request) |