def apply_plugin(): """ Apply the plugin - overrideable method """ # This method is expected to perform the following steps. # 1. Register the required hook/plugin function # 2. Get the config object and set/override any required settings # 3. Print any informational messages. # The first step is required, the last two are of course optional # depending upon the required application of the plugin. cfg = GetObject('config') # Makes sense to activate the callback only if swish-integration # is enabled. if cfg.swishplugin: hooks.register_post_callback_method('crawler:fetcher_process_url_callback', process_url_further) # Turn off caching, since no files are saved cfg.pagecache = 0 # Turn off console-logging logger = GetObject('logger') logger.disableConsoleLogging() # Turn off session-saver feature cfg.savesessions = False # Turn off interrupt handling cfg.ignoreinterrupts = True
def apply_plugin(): """ Apply the plugin - overrideable method """ # This method is expected to perform the following steps. # 1. Register the required hook/plugin function # 2. Get the config object and set/override any required settings # 3. Print any informational messages. # The first step is required, the last two are of course optional # depending upon the required application of the plugin. cfg = GetObject("config") # Makes sense to activate the callback only if swish-integration # is enabled. if cfg.swishplugin: hooks.register_post_callback_method("crawler:fetcher_process_url_callback", process_url_further) # Turn off caching, since no files are saved cfg.pagecache = 0 # Turn off console-logging logger = GetObject("logger") logger.disableConsoleLogging() # Turn off session-saver feature cfg.savesessions = False # Turn off interrupt handling cfg.ignoreinterrupts = True
def apply_plugin(): """ All plugin modules need to define this method """ # This method is expected to perform the following steps. # 1. Register the required hook function # 2. Get the config object and set/override any required settings # 3. Print any informational messages. # The first step is required, the last two are of course optional # depending upon the required application of the plugin. from common.common import GetObject cfg = GetObject('config') if cfg.simulate: hooks.register_plugin_function('connector:save_url_plugin', save_url) # Turn off caching, since no files are saved cfg.pagecache = 0 print 'Simulation mode turned on. Crawl will be simulated and no files will be saved.'