def func_wrapper(*args, **kwargs): result = func(*args, **kwargs) if isinstance(result, tuple): result = list(result) result.insert(1, event_type) create_event(*result) elif isinstance(result, dict): result.update({"event_type": event_type}) create_event(**result) else: logger.error( "Skipping event creation because incorrect arguments were provided by the decorated function." )
def func_wrapper(*args, **kwargs): result = func(*args, **kwargs) if isinstance(result, tuple): result = list(result) result.insert(1, event_type) create_event(*result) elif isinstance(result, dict): result.update({'event_type': event_type}) create_event(**result) else: logger.error( 'Skipping event creation because incorrect arguments were provided by the decorated function.' )
def social_network_group_photo(instance, user, **kwargs): from notifications import create_event create_event(user, group_photo_event_type(), instance, _(u'A photo has been posted in a group'))
def social_network_group_shared_link(instance, user, **kwargs): from notifications import create_event create_event(user, group_shared_link_event_type(), instance, _(u'A link has been shared in a group'))