def _convertReferenceProperty(model_property, entity): """Converts the specified ReferenceProperty whose value is either a key of GSoCProfile or GCIProfile type. Args: model_property: Property instance. entity: Entity. Returns: The new value for the specified property which Profile key. """ reference_key = model_property.get_value_for_datastore(entity) if not reference_key: return None elif reference_key.kind() not in [GSoCProfile.kind(), GCIProfile.kind()]: raise ValueError('Invalid kind %s for property %s', (reference_key.kind(), model_property.name)) else: return _newKey(reference_key)
def _convertReferenceProperty(model_property, entity): """Converts the specified ReferenceProperty whose value is either a key of GSoCProfile or GCIProfile type. Args: model_property: Property instance. entity: Entity. Returns: The new value for the specified property which Profile key. """ reference_key = model_property.get_value_for_datastore(entity) if not reference_key: return None elif reference_key.kind() not in [GSoCProfile.kind(), GCIProfile.kind()]: raise ValueError( 'Invalid kind %s for property %s', (reference_key.kind(), model_property.name)) else: return _newKey(reference_key)