def lookup_uid(self, uid): context = self.context if HAS_LINGUAPLONE: # If we have LinguaPlone installed, add support for language-aware # references uids = translated_references(context, context.Language(), uid) if len(uids) > 0: uid = uids[0] return uuidToObject(uid)
def sync(self, collection, criterion): # If we copy reference criteria, we need to # adjust their reference to the correct UID in # the new language source_value = self.context.Value() language = collection.Language() value = criterion.Value() if source_value: new_value = translated_references(collection, language, list(source_value)) if list(value) != new_value: criterion.setValue(new_value)