<s> from app . utils import log <EOL> from notifications . models import Notification <EOL> from profiles . utils import get_profile <EOL> from users . utils import approved_users <EOL> from error . signals import error_created <EOL> from issues . signals import issue_created , issue_changed <EOL> def default_notification ( instance , ** kw ) : <EOL> """<STR_LIT>""" <EOL> log ( "<STR_LIT>" ) <EOL> users = approved_users ( ) <EOL> filtered = [ ] <EOL> for user in users : <EOL> profile = get_profile ( user ) <EOL> if profile . notification and instance . priority <= profile . notification : <EOL> filtered . append ( user ) <EOL> if not filtered : <EOL> return <EOL> notification = Notification ( ) <EOL> notification . type = "<STR_LIT>" <EOL> notification . type_key = str ( instance . key ( ) ) <EOL> notification . user = [ str ( u . key ( ) ) for u in filtered ] <EOL> notification . save ( ) <EOL> error_created . connect ( default_notification , dispatch_uid = "<STR_LIT>" ) <EOL> def default_issue_notification ( instance , ** kw ) : <EOL> """<STR_LIT>""" <EOL> log ( "<STR_LIT>" ) <EOL> users = approved_users ( ) <EOL> if not users . count ( ) : <EOL> return <EOL> notification = Notification ( ) <EOL> notification . type = "<STR_LIT>" <EOL> notification . type_key = str ( instance . key ( ) ) <EOL> notification . user = [ str ( u . key ( ) ) for u in users ] <EOL> notification . save ( ) </s>
