def dbupdate(func):
    def wrapper(*args, **kwargs):
        logger = logging.getLogger('pysilhouette.db')
        session = args[0]
        model = args[1]
        model_name = repr(model).split("<")[-1]
        model_id = model.id
        try:
            func(*args, **kwargs)
        except UnmappedInstanceError, ui:
            logger.error(('Data to update is failed, '
                          'Invalid value was inputed '
                          '- %s=%s, error=%s') % (model_name, model_id, str(ui.args)))
            raise SilhouetteDBException(('Data to update is failed, '
                          'Invalid value was inputed. '
                          '- %s=%s, error=%s') % (model_name, model_id, str(ui.args)))
        
        num = len(session.dirty)
        if not num:
            logger.warn('Data has not been changed. - %s=%s' %  (model_name, model_id))
            return num  # The return value assume zero
        
        logger.debug('Data to update is succeeded. - %s=%s' % (model_name, model_id))
        return num
    
    wrapper.__name__ = func.__name__
    wrapper.__dict__ = func.__dict__
    wrapper.__doc__ = func.__doc__
    return wrapper
Watch then unwatch a forum.
dataset/ETHPy150Open karesansui/pysilhouette/pysilhouette/db/__init__.py/dbupdate--crossover with--dataset/ETHPy150Open mozilla/kitsune/kitsune/forums/tests/test_views.py/ThreadTests.test_watch_forum