def get_instance_info(self):
    """ Generate a dictionary about various details from a Zope instance
    relevant to assessing what migration will look like.
    """

    instance_info = {}
    instance_info['Script (Python)'] = {}
    instance_info['Script (Python)']['num'] = 0
    instance_info['Script (Python)']['lines'] = 0
    instance_info['DTML Method'] = {}
    instance_info['DTML Method']['num'] = 0
    instance_info['DTML Method']['lines'] = 0
    instance_info['TinyTable'] = {}
    instance_info['TinyTable']['num'] = 0
    instance_info['TinyTable']['lines'] = 0

    cp_products = get_root_folder().Control_Panel.Products

    folders = load_folders(get_root_folder(), [])
    products_or_zclasses = load_products_or_zclasses(cp_products, [])

    for meta_type in instance_info.keys():
        for obj_container in folders + products_or_zclasses:
            for working_object in obj_container.objectValues(meta_type):
                obj = ZopeObjectWrapper(working_object)
                obj_content = obj.get_content()
           
                if obj_content != None:	    
                    instance_info[meta_type]['num'] += 1
                    if meta_type == "TinyTable":
                        num_lines = len(obj_content)
                    else:
                        num_lines = len(obj_content.split('\n'))

                    instance_info[meta_type]['lines'] += num_lines


    return instance_info
Example #2
0
def get_instance_info(self):
    """ Generate a dictionary about various details from a Zope instance
    relevant to assessing what migration will look like.
    """

    instance_info = {}
    instance_info['Script (Python)'] = {}
    instance_info['Script (Python)']['num'] = 0
    instance_info['Script (Python)']['lines'] = 0
    instance_info['DTML Method'] = {}
    instance_info['DTML Method']['num'] = 0
    instance_info['DTML Method']['lines'] = 0
    instance_info['TinyTable'] = {}
    instance_info['TinyTable']['num'] = 0
    instance_info['TinyTable']['lines'] = 0

    cp_products = get_root_folder().Control_Panel.Products

    folders = load_folders(get_root_folder(), [])
    products_or_zclasses = load_products_or_zclasses(cp_products, [])

    for meta_type in instance_info.keys():
        for obj_container in folders + products_or_zclasses:
            for working_object in obj_container.objectValues(meta_type):
                obj = ZopeObjectWrapper(working_object)
                obj_content = obj.get_content()

                if obj_content != None:
                    instance_info[meta_type]['num'] += 1
                    if meta_type == "TinyTable":
                        num_lines = len(obj_content)
                    else:
                        num_lines = len(obj_content.split('\n'))

                    instance_info[meta_type]['lines'] += num_lines

    return instance_info
Example #3
0
def extract_generic(self, obj_type, ext, path):
    """ Generically handle loading lists of folders and products/zclasses
    filter by meta_type and pass a ZopeObjectWrapper instance to the
    extraction function
    """
    cp_products = get_root_folder().Control_Panel.Products

    # iterate recursively to get folders
    folders = load_folders(self, [])

    # iterate recursively get products
    products_or_zclasses = load_products_or_zclasses(cp_products, [])

    for obj_container in folders + products_or_zclasses:

        for obj in obj_container.objectValues(obj_type):
            # not sure why this extra check is needed,
            # somehow objectValues returns some unexpected objects

            if obj.meta_type == obj_type:
                extract(ZopeObjectWrapper(obj), ext, path)
Example #4
0
def extract_generic(self, obj_type, ext, path):
    """ Generically handle loading lists of folders and products/zclasses
    filter by meta_type and pass a ZopeObjectWrapper instance to the
    extraction function
    """
    cp_products = get_root_folder().Control_Panel.Products

    # iterate recursively to get folders
    folders = load_folders(self, [])

    # iterate recursively get products
    products_or_zclasses = load_products_or_zclasses(cp_products, [])

    for obj_container in folders + products_or_zclasses:

        for obj in obj_container.objectValues(obj_type):
            # not sure why this extra check is needed,
            # somehow objectValues returns some unexpected objects

            if obj.meta_type == obj_type:
                extract(ZopeObjectWrapper(obj), ext, path)
Example #5
0
def extract_pyscripts(self, path):
    """ Initiate extraction of Python Scripts to the file system
    """

    extract_generic(get_root_folder(), "Script (Python)", 'py', path)
Example #6
0
def extract_tinytables(self, path):
    """ Initiate extraction of TinyTables to the file system (in csv format)
    """

    extract_generic(get_root_folder(), "TinyTable", "csv", path)
Example #7
0
def extract_pyscripts(self, path):
    """ Initiate extraction of Python Scripts to the file system
    """

    extract_generic(get_root_folder(), "Script (Python)", "py", path)
Example #8
0
def extract_tinytables(self, path):
    """ Initiate extraction of TinyTables to the file system (in csv format)
    """

    extract_generic(get_root_folder(), "TinyTable", "csv", path)