def default_notification(instance, **kw): """ Given an error see if we need to send a notification """ log("Firing signal: default_notification") # todo, this will be changed to lookup a user profile as per # http://github.com/andymckay/arecibo/issues/issue/4 if instance.priority >= 5: return notification = Notification() notification.error = instance notification.user = [ str(u.key()) for u in approved_users() ] notification.save()
def default_notification(instance, **kw): """ Given an error see if we need to send a notification """ log("Firing signal: default_notification") if instance.priority >= 5: return users = approved_users() if not users.count(): return notification = Notification() notification.notifier = instance notification.save() for user in users: notification.user.add(user)
def default_issue_notification(instance, **kw): """ Given an issue see default_issue_notification we need to send a notification """ log("Firing signal: default_notification") users = approved_users() if not users.count(): return notification = Notification() notification.type = "Issue" notification.type_key = str(instance.key()) notification.user = [ str(u.key()) for u in users ] notification.save() # turn this on when its all working #issue_created.connect(default_issue_notification, dispatch_uid="default_issue_notification") #issue_changed.connect(default_issue_notification, dispatch_uid="default_issue_notification")
def default_notification(instance, **kw): """ Given an error see if we need to send a notification """ log("Firing signal: default_notification") users = approved_users() filtered = [] for user in users: profile = get_profile(user) if profile.notification and instance.priority <= profile.notification: filtered.append(user) if not filtered: return notification = Notification() notification.type = "Error" notification.type_key = str(instance.key()) notification.user = [ str(u.key()) for u in filtered ] notification.save()
def default_notification(instance, **kw): """ Given an error see if we need to send a notification """ log("Firing signal: default_notification") users = approved_users() filtered = [] for user in users: profile = get_profile(user) if profile.notification and instance.priority <= profile.notification: filtered.append(user) if not filtered: return notification = Notification() notification.type = "Error" notification.type_key = str(instance.key()) notification.user = [str(u.key()) for u in filtered] notification.save()
def default_issue_notification(instance, **kw): """ Given an issue see default_issue_notification we need to send a notification """ log("Firing signal: default_notification") users = approved_users() if not users.count(): return notification = Notification() notification.type = "Issue" notification.type_key = str(instance.key()) notification.user = [str(u.key()) for u in users] notification.save() # turn this on when its all working #issue_created.connect(default_issue_notification, dispatch_uid="default_issue_notification") #issue_changed.connect(default_issue_notification, dispatch_uid="default_issue_notification")