def synthesize_versioned_document(document, delta, resource_def):
 versioned_doc = {}
 id_field = versioned_id_field(resource_def)
 if (id_field not in delta):
  abort(400, description=debug_error_message(('You must include %s in any projection with a version query.' % id_field)))
 delta[resource_def['id_field']] = delta[id_field]
 del delta[id_field]
 fields = versioned_fields(resource_def)
 for field in document:
  if (field not in fields):
   versioned_doc[field] = document[field]
 versioned_doc.update(delta)
 return versioned_doc

def synthesize_versioned_document ( document , delta , resource_def ) : versioned_doc = { } id_field = versioned_id_field ( resource_def ) if ( id_field not in delta ) : abort ( 400 , description = debug_error_message ( ( 'You must include %s in any projection with a version query.' % id_field ) ) ) delta [ resource_def [ 'id_field' ] ] = delta [ id_field ] del delta [ id_field ] fields = versioned_fields ( resource_def ) for field in document : if ( field not in fields ) : versioned_doc [ field ] = document [ field ] versioned_doc . update ( delta ) return versioned_doc
synthesizes a versioned document from the latest document and the values of all versioned fields from the old version .