Пример #1
0
def get_network(module_name):

	if module_name in network_module_cache:
		return network_module_cache[module_name]

	print "!!! plugin loading of site : " + module_name 
	try:
		module = _importlib.import_module('resources.lib.%s' % (module_name))

		# module must at least have site and rootlist defined
		if hasattr(module, 'SITE') and hasattr(module, 'rootlist'):

			# patch modules with missing meta data
			if not hasattr(module, 'NAME'):
				setattr(module, 'NAME', module_name)
			if not hasattr(module, 'DESCRIPTION'):
				setattr(module, 'DESCRIPTION', module_name)

			network_module_cache[module_name] = module
			return module
		else:
			print "error loading site, SITE and rootlist must be defined"

	except Exception, e:
		print str(e)
def get_network(module_name):
	""" 
	Loads network using a quick and dirty plugin method
	"""
	if module_name in network_module_cache:
		return network_module_cache[module_name]

	print "!!! plugin loading of site : " + module_name 
	try:
		module = _importlib.import_module('resources.lib.%s' % (module_name))

		# module must at least have site and rootlist defined
		if hasattr(module, 'SITE') and hasattr(module, 'rootlist'):

			# patch modules with missing meta data
			if not hasattr(module, 'NAME'):
				setattr(module, 'NAME', module_name)
			if not hasattr(module, 'DESCRIPTION'):
				setattr(module, 'DESCRIPTION', module_name)

			network_module_cache[module_name] = module
			return module
		else:
			print "error loading site, SITE and rootlist must be defined"

	except Exception, e:
		print str(e)
def get_network(module_name):
    """ 
	Loads network using a quick and dirty plugin method
	"""
    if module_name in network_module_cache:
        return network_module_cache[module_name]

    print "!!! plugin loading of site : " + module_name
    try:
        module = _importlib.import_module("resources.lib.%s" % (module_name))

        # module must at least have site and rootlist defined
        if hasattr(module, "SITE") and hasattr(module, "rootlist"):

            # patch modules with missing meta data
            if not hasattr(module, "NAME"):
                setattr(module, "NAME", module_name)
            if not hasattr(module, "DESCRIPTION"):
                setattr(module, "DESCRIPTION", module_name)

            network_module_cache[module_name] = module
            return module
        else:
            print "error loading site, SITE and rootlist must be defined"

    except Exception, e:
        print str(e)
Пример #4
0
def get_network(module_name):
	""" 
	Loads network using a quick and dirty plugin method
	"""
	if module_name in network_module_cache:
		return network_module_cache[module_name]
	print "!!! plugin loading of site : " + module_name 
	try:
		module = _importlib.import_module('resources.lib.%s' % (module_name))
		if hasattr(module, 'SITE') and hasattr(module, 'masterlist'):
			if not hasattr(module, 'NAME'):
				setattr(module, 'NAME', module_name)
			if not hasattr(module, 'DESCRIPTION'):
				setattr(module, 'DESCRIPTION', module_name)
			network_module_cache[module_name] = module
			return module
		else:
			print "error loading site, SITE and materlist must be defined"
	except Exception, e:
		print str(e)
Пример #5
0
def import_parser_by_host(host):
    parser_name = host.replace('.', '_')
    return import_module(PARSER_DIR + "." + parser_name)
Пример #6
0
def import_parser_by_host(host):
    parser_name = host.replace('.','_')
    return import_module(PARSER_DIR + "." + parser_name)