mirror of
https://github.com/jazzband/django-authority.git
synced 2026-04-03 15:00:35 +00:00
--HG-- rename : src/authority/__init__.py => authority/__init__.py rename : src/authority/admin.py => authority/admin.py rename : src/authority/decorators.py => authority/decorators.py rename : src/authority/exceptions.py => authority/exceptions.py rename : src/authority/fixtures/tests.json => authority/fixtures/tests.json rename : src/authority/forms.py => authority/forms.py rename : src/authority/managers.py => authority/managers.py rename : src/authority/models.py => authority/models.py rename : src/authority/permissions.py => authority/permissions.py rename : src/authority/sites.py => authority/sites.py rename : src/authority/templates/admin/edit_inline/action_tabular.html => authority/templates/admin/edit_inline/action_tabular.html rename : src/authority/templates/admin/permission_change_form.html => authority/templates/admin/permission_change_form.html rename : src/authority/templates/authority/403.html => authority/templates/authority/403.html rename : src/authority/templates/authority/permission_delete_link.html => authority/templates/authority/permission_delete_link.html rename : src/authority/templates/authority/permission_form.html => authority/templates/authority/permission_form.html rename : src/authority/templates/authority/permission_request_approve_link.html => authority/templates/authority/permission_request_approve_link.html rename : src/authority/templates/authority/permission_request_delete_link.html => authority/templates/authority/permission_request_delete_link.html rename : src/authority/templatetags/__init__.py => authority/templatetags/__init__.py rename : src/authority/templatetags/permissions.py => authority/templatetags/permissions.py rename : src/authority/tests.py => authority/tests.py rename : src/authority/urls.py => authority/urls.py rename : src/authority/views.py => authority/views.py rename : src/authority/widgets.py => authority/widgets.py
31 lines
834 B
Python
31 lines
834 B
Python
import sys
|
|
from authority.sites import site, get_check, get_choices_for, register, unregister
|
|
|
|
LOADING = False
|
|
|
|
def autodiscover():
|
|
"""
|
|
Goes and imports the permissions submodule of every app in INSTALLED_APPS
|
|
to make sure the permission set classes are registered correctly.
|
|
"""
|
|
global LOADING
|
|
if LOADING:
|
|
return
|
|
LOADING = True
|
|
|
|
import imp
|
|
from django.conf import settings
|
|
|
|
for app in settings.INSTALLED_APPS:
|
|
try:
|
|
__import__(app)
|
|
app_path = sys.modules[app].__path__
|
|
except AttributeError:
|
|
continue
|
|
try:
|
|
imp.find_module('permissions', app_path)
|
|
except ImportError:
|
|
continue
|
|
__import__("%s.permissions" % app)
|
|
app_path = sys.modules["%s.permissions" % app]
|
|
LOADING = False
|