#NEWLINE# def autodiscover( ) : #NEWLINE# #INDENT# '\n    Goes and imports the permissions submodule of every app in INSTALLED_APPS\n    to make sure the permission set classes are registered correctly.\n    ' #NEWLINE# global LOADING #NEWLINE# if LOADING : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# LOADING = True #NEWLINE# import imp #NEWLINE# from django.conf import settings #NEWLINE# for app in settings . INSTALLED_APPS : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# __import__ ( app ) #NEWLINE# app_path = sys . modules [ app ] . __path__ #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# imp . find_module ( 'permissions' , app_path ) #NEWLINE# #UNINDENT# except ImportError : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# __import__ ( ( '%s.permissions' % app ) ) #NEWLINE# app_path = sys . modules [ ( '%s.permissions' % app ) ] #NEWLINE# #UNINDENT# LOADING = False