def register_extensions(self):
        """
        Function registers extensions given extensions list

        Args
        ----
          extensions (list) : the extensions dict on app.config.<env>

        Raises
        ------
          Exception: Raises exception when extension can't be loaded
            properly.
        """
        try:
            for extension, config in self.config['extensions'].items():

                extension_bstr = ''

                # gather package name if exists
                extension_pieces = extension.split('.')

                # if the extensions is not in glim_extensions package
                if len(extension_pieces) > 1:
                    extension_bstr = '.'.join(extension_pieces)
                else: # if the extension is in glim_extensions package
                    extension_bstr = 'glim_extensions.%s' % extension_pieces[0]

                extension_module = import_module(extension_bstr)

                if extension_module:
                    extension_startstr = '%s.%s' % (extension_bstr, 'start')
                    extension_start = import_module(extension_startstr, pass_errors=True)

                    extension_cmdsstr = '%s.%s' % (extension_bstr, 'commands')
                    extension_cmds = import_module(extension_cmdsstr, pass_errors=True)

                    if extension_start is not None:
                        before = extension_start.before
                        before(config)

                    if extension_cmds is not None:
                        if self.commandadapter is not None:
                            self.commandadapter.register_extension(extension_cmds, extension_pieces[0])
                else:
                    GlimLog.error('Extension %s could not be loaded' % extension)

        except Exception as e:
            GlimLog.error(traceback.format_exc())
def register_extensions ( self ) : try : for extension , config in self . config [ 'extensions' ] . items ( ) : extension_bstr = '' extension_pieces = extension . split ( '.' ) if len ( extension_pieces ) > 1 : extension_bstr = '.' . join ( extension_pieces ) else : extension_bstr = 'glim_extensions.%s' % extension_pieces [ 0 ] extension_module = import_module ( extension_bstr ) if extension_module : extension_startstr = '%s.%s' % ( extension_bstr , 'start' ) extension_start = import_module ( extension_startstr , pass_errors = True ) extension_cmdsstr = '%s.%s' % ( extension_bstr , 'commands' ) extension_cmds = import_module ( extension_cmdsstr , pass_errors = True ) if extension_start is not None : before = extension_start . before before ( config ) if extension_cmds is not None : if self . commandadapter is not None : self . commandadapter . register_extension ( extension_cmds , extension_pieces [ 0 ] ) else : GlimLog . error ( 'Extension %s could not be loaded' % extension ) except Exception as e : GlimLog . error ( traceback . format_exc ( ) )
Function registers extensions given extensions list

        Args
        ----
          extensions (list) : the extensions dict on app.config.<env>

        Raises
        ------
          Exception: Raises exception when extension can't be loaded
            properly.