def _get_modules(request):
 perspective = request.user.profile.get_perspective()
 modules = perspective.modules.filter(display=True).order_by('title')
 if (not modules):
  modules = Module.objects.filter(display=True).order_by('title')
 active = None
 for module in modules:
  module.type = 'minor'
  try:
   import_name = ((module.name + '.') + settings.HARDTREE_MODULE_IDENTIFIER)
   hmodule = __import__(import_name, fromlist=[str(module.name)])
   urls = hmodule.URL_PATTERNS
   for regexp in urls:
    if re.match(regexp, request.path):
     active = module
   module.type = hmodule.PROPERTIES['type']
  except ImportError:
   pass
  except AttributeError:
   pass
  except KeyError:
   pass
 return (modules, active)

def _get_modules ( request ) : perspective = request . user . profile . get_perspective ( ) modules = perspective . modules . filter ( display = True ) . order_by ( 'title' ) if ( not modules ) : modules = Module . objects . filter ( display = True ) . order_by ( 'title' ) active = None for module in modules : module . type = 'minor' try : import_name = ( ( module . name + '.' ) + settings . HARDTREE_MODULE_IDENTIFIER ) hmodule = __import__ ( import_name , fromlist = [ str ( module . name ) ] ) urls = hmodule . URL_PATTERNS for regexp in urls : if re . match ( regexp , request . path ) : active = module module . type = hmodule . PROPERTIES [ 'type' ] except ImportError : pass except AttributeError : pass except KeyError : pass return ( modules , active )
returns set of current modules and active module .