#NEWLINE# def init_addon( app , addon_name , routes = True ) : #NEWLINE# #INDENT# "Load addon module return its create configuration object.\n\n    If `log_fp` is provided, the addon's log templates will be appended\n    to the file.\n\n    :param app: Flask app object\n    :param addon_name: Name of addon directory\n    :param file log_fp: File pointer for the built logs file.\n    :param bool routes: Add routes\n    :return AddonConfig: AddonConfig configuration object if module found,\n        else None\n\n    " #NEWLINE# import_path = 'website.addons.{0}' . format ( addon_name ) #NEWLINE# addon_module = importlib . import_module ( import_path ) #NEWLINE# data = vars ( addon_module ) #NEWLINE# if routes : #NEWLINE# #INDENT# for route_group in getattr ( addon_module , 'ROUTES' , [ ] ) : #NEWLINE# #INDENT# process_rules ( app , ** route_group ) #NEWLINE# #UNINDENT# #UNINDENT# return AddonConfig ( ** { key . lower ( ) : value for ( key , value ) in data . iteritems ( ) } )