def processConfig(self, config):
        # if 'inFolder' in config.keys():
        #     inFolder = config['inFolder']
        # if 'outFolder' in config.keys():
        #     outFolder = config['outFolder']
        # if 'logFolder' in config.keys():
        #     logFolder = config['logFolder']

        wc_api_key = config.get(self.optionNamePrefix+'wc_api_key')
        wc_api_secret = config.get(self.optionNamePrefix+'wc_api_secret')
        wp_srv_offset = config.get(self.optionNamePrefix+'wp_srv_offset', 0)
        store_url = config.get(self.optionNamePrefix+'store_url', '')

        # taxoDepth = config.get('taxoDepth')
        # itemDepth = config.get('itemDepth')

        TimeUtils.setWpSrvOffset(wp_srv_offset)

        # json_uri = store_url + 'wp-json/wp/v2'z

        self.wcApiParams = {
            'api_key':wc_api_key,
            'api_secret':wc_api_secret,
            'url':store_url
        }

        self.productParserArgs = {
            'importName': self.importName,
            # 'itemDepth': itemDepth,
            # 'taxoDepth': taxoDepth,
            'cols': ColData_Woo.getImportCols(),
            'defaults': ColData_Woo.getDefaults(),
        }
Esempio n. 2
0
    def setUp(self):
        try:
            os.stat('source')
            os.chdir('source')
        except:
            pass

        yamlPath = "generator_config.yaml"

        importName = TimeUtils.getMsTimeStamp()
        inFolder = "../input/"
        outFolder = "../output/"

        with open(yamlPath) as stream:
            config = yaml.load(stream)
            optionNamePrefix = 'test_'
            optionNamePrefix = ''

            if 'inFolder' in config.keys():
                inFolder = config['inFolder']
            if 'outFolder' in config.keys():
                outFolder = config['outFolder']
            if 'logFolder' in config.keys():
                logFolder = config['logFolder']

            taxoDepth = config.get('taxoDepth')
            itemDepth = config.get('itemDepth')

        self.genPath = inFolder + "generator.csv"

        self.productParserArgs = {
            'importName': importName,
            'itemDepth': itemDepth,
            'taxoDepth': taxoDepth,
            'cols': ColData_Woo.getImportCols(),
            'defaults': ColData_Woo.getDefaults(),
        }

        for var in ['self.productParserArgs']:
            print var, eval(var)

        Registrar.DEBUG_PROGRESS = True
        Registrar.DEBUG_MESSAGE = True
        Registrar.DEBUG_ERROR = True
        Registrar.DEBUG_WARN = True
        # Registrar.DEBUG_SHOP = True
        # Registrar.DEBUG_MRO = True
        # Registrar.DEBUG_TREE = True
        # Registrar.DEBUG_PARSER = True
        # Registrar.DEBUG_GEN = True
        # Registrar.DEBUG_ABSTRACT = True
        # Registrar.DEBUG_WOO = True
        # Registrar.DEBUG_API = True
        CSVParse_TT.do_images = False
        CSVParse_TT.do_specials = False
        CSVParse_TT.do_dyns = False