def doImport(project_names_to_import, source, target):
    last_page = False
    current_page = 1
    log_step("Creating custom fields")
    try:
        target.createCustomFieldDetailed("State", "state[1]", False, True, True, {"attachBundlePolicy": "2"})
    except YouTrackException, e:
        pass
    colors_bundle = EnumBundle()
    colors_bundle.name = "Colors"
    try:
        target.createBundle(colors_bundle)
    except YouTrackException, e:
        log_message(e)
    try:
        target.createCustomFieldDetailed("Color", "enum[1]", False, True, True,
                {"defaultBundle": colors_bundle.name, "attachBundlePolicy": "0"})
    except YouTrackException, e:
        pass
    try:
        status_bundle = StateBundle()
        status_bundle.name = "Statuses"
        target.createBundle(status_bundle)
        target.createCustomFieldDetailed("Status", "state[1]", False, True, True,
                {"defaultBundle": status_bundle.name, "attachBundlePolicy": "0"})
    except YouTrackException, e:
        pass
    try:
        target.createCustomFieldDetailed("Size", "integer", False, True, True)
    except YouTrackException, e:
        pass
    try:
        target.createCustomFieldDetailed("Deadline", "date", False, True, True)
    except YouTrackException, e:
        pass
    while not last_page:
        projects = source.get_projects(page=1, page_size=25)
        if current_page == projects[u'totalPages']:
            last_page = True
        for project in projects[u'items']:
            if project[u'name'] in project_names_to_import:
                import_project(source, target, project)
        current_page += 1
dataset/ETHPy150Open JetBrains/youtrack-rest-python-library/python/agilezen2youtrack.py/doImport/original