def speakers_marshal_with(fields=None, fields_private=None):
 def decorator(func):
  @wraps(func)
  def wrapper(*args, **kwargs):
   user = getattr(g, 'user', None)
   event_id = kwargs.get('event_id')
   if ((user is None) and current_user.is_authenticated):
    user = current_user
   if (user and (user.has_role(event_id) or user.is_staff)):
    model = (fields if fields else SPEAKER)
   else:
    model = (fields_private if fields_private else SPEAKER_PRIVATE)
   func2 = marshal_with(model)(func)
   return func2(*args, **kwargs)
  return wrapper
 return decorator

def speakers_marshal_with ( fields = None , fields_private = None ) : def decorator ( func ) : @ wraps ( func ) def wrapper ( * args , ** kwargs ) : user = getattr ( g , 'user' , None ) event_id = kwargs . get ( 'event_id' ) if ( ( user is None ) and current_user . is_authenticated ) : user = current_user if ( user and ( user . has_role ( event_id ) or user . is_staff ) ) : model = ( fields if fields else SPEAKER ) else : model = ( fields_private if fields_private else SPEAKER_PRIVATE ) func2 = marshal_with ( model ) ( func ) return func2 ( * args , ** kwargs ) return wrapper return decorator
response marshalling for speakers .