Ejemplo n.º 1
0
def multilingualMoveObject(content, language):
    """
    Move content object and its contained objects to a new language folder
    Also set the language on all the content moved
    """
    if is_shared(content):
        # In case is shared we are going to create it on the language root
        # folder

        orig_content = get_original_object(content)
        target_folder = getattr(getSite(), language)
        # It's going to be a non shared content so we remove it from
        # portal_catalog

    else:
        orig_content = content
        target_folder = ITranslationLocator(orig_content)(language)

    parent = aq_parent(orig_content)
    cb_copy_data = parent.manage_cutObjects(orig_content.getId())
    list_ids = target_folder.manage_pasteObjects(cb_copy_data)
    new_id = list_ids[0]['new_id']
    new_object = target_folder[new_id]

    if hasattr(new_object, '_v_is_shared_content'):
        new_object._v_is_shared_content = False
    new_object.reindexObject()

    return new_object
Ejemplo n.º 2
0
def multilingualMoveObject(content, language):
    """Move content object and its contained objects to a new language folder
    Also set the language on all the content moved

    """
    if is_language_independent(content):
        # Language independent content will be created into language roo
        target_folder = getattr(getSite(), language)
    else:
        target_folder = ITranslationLocator(content)(language)

    parent = aq_parent(content)

    copy_data = parent.manage_cutObjects(content.getId())
    list_ids = target_folder.manage_pasteObjects(copy_data)
    new_id = list_ids[0]['new_id']
    new_object = target_folder[new_id]

    new_object.reindexObject()

    return new_object