def marshal_write_response(document, resource):
 resource_def = app.config['DOMAIN'][resource]
 if (app.config['BANDWIDTH_SAVER'] is True):
  fields = (auto_fields(resource) + resource_def['extra_response_fields'])
  document = dict(((k, v) for (k, v) in document.items() if (k in fields)))
 else:
  auth_field = resource_def.get('auth_field')
  if (auth_field and (auth_field not in resource_def['schema'])):
   try:
    del document[auth_field]
   except:
    pass
 return document

def marshal_write_response ( document , resource ) : resource_def = app . config [ 'DOMAIN' ] [ resource ] if ( app . config [ 'BANDWIDTH_SAVER' ] is True ) : fields = ( auto_fields ( resource ) + resource_def [ 'extra_response_fields' ] ) document = dict ( ( ( k , v ) for ( k , v ) in document . items ( ) if ( k in fields ) ) ) else : auth_field = resource_def . get ( 'auth_field' ) if ( auth_field and ( auth_field not in resource_def [ 'schema' ] ) ) : try : del document [ auth_field ] except : pass return document
limit response document to minimize bandwidth when client supports it .