Esempio n. 1
0
def handle_incoming_sms(sender, **kwargs):
    """
    called through post_save.connect(handle_incoming_sms, sender=MoSms)
    """
    logger.debug("Entering: %s()" % who_am_i())
    # kwargs['raw'] is True when we're running manage.py loaddata
    if kwargs.get('created', False) and not kwargs.get('raw', False):
        new_sms = kwargs['instance']
        try:
            profile = get_model('rsr', 'UserProfile').objects.process_sms(new_sms)
        except Exception, e:
            logger.exception('%s Locals:\n %s\n\n' % (e.message, locals(), ))
Esempio n. 2
0
#            logger.exception('%s Locals:\n %s\n\n' % (e.message, locals(), ))
#    logger.debug("Exiting: %s()" % who_am_i())
    
def handle_incoming_sms(sender, **kwargs):
    """
    called through post_save.connect(handle_incoming_sms, sender=MoSms)
    """
    logger.debug("Entering: %s()" % who_am_i())
    # kwargs['raw'] is True when we're running manage.py loaddata
    if kwargs.get('created', False) and not kwargs.get('raw', False):
        new_sms = kwargs['instance']
        try:
            profile = get_model('rsr', 'UserProfile').objects.process_sms(new_sms)
        except Exception, e:
            logger.exception('%s Locals:\n %s\n\n' % (e.message, locals(), ))
    logger.debug("Exiting: %s()" % who_am_i())

def cleanup_reporters(profile, user):
    if not profile.validation == profile.VALIDATED:
        get_model('rsr', 'SmsReporter').objects.filter(userprofile=profile).delete()

def update_project_budget(sender, **kwargs):
    """
    called when BudgetItem objects are added/changed/deleted
    """
    # kwargs['raw'] is True when we're running manage.py loaddata
    if not kwargs.get('raw', False):
        kwargs['instance'].project.update_budget()
        kwargs['instance'].project.update_funds()
        kwargs['instance'].project.update_funds_needed()