Esempio n. 1
0
    def setUp(self):
        """Set up test."""
        google_provider = "allauth.socialaccount.providers.google"
        if google_provider not in settings.INSTALLED_APPS:
            settings.INSTALLED_APPS += (google_provider,)
            apps.app_configs = OrderedDict()
            apps.ready = False
            apps.populate(settings.INSTALLED_APPS)
            importlib.import_module(google_provider + ".provider")

        self.url = reverse("admin:superusertools_provider_overview", kwargs={"provider_id": "google"})
Esempio n. 2
0
 def load(self):
     # TODO: Providers register with the provider registry when
     # loaded. Here, we build the URLs for all registered providers. So, we
     # really need to be sure all providers did register, which is why we're
     # forcefully importing the `provider` modules here. The overall
     # mechanism is way to magical and depends on the import order et al, so
     # all of this really needs to be revisited.
     if not self.loaded:
         for app in settings.INSTALLED_APPS:
             provider_module = app + '.provider'
             try:
                 importlib.import_module(provider_module)
             except ImportError:
                 pass
         self.loaded = True
Esempio n. 3
0
 def load(self):
     # TODO: Providers register with the provider registry when
     # loaded. Here, we build the URLs for all registered providers. So, we
     # really need to be sure all providers did register, which is why we're
     # forcefully importing the `provider` modules here. The overall
     # mechanism is way to magical and depends on the import order et al, so
     # all of this really needs to be revisited.
     if not self.loaded:
         for app in settings.INSTALLED_APPS:
             provider_module = app + '.provider'
             try:
                 importlib.import_module(provider_module)
             except ImportError:
                 pass
         self.loaded = True
Esempio n. 4
0
def import_attribute(path):
    assert isinstance(path, six.string_types)
    pkg, attr = path.rsplit('.', 1)
    ret = getattr(importlib.import_module(pkg), attr)
    return ret
Esempio n. 5
0
def import_attribute(path):
    assert isinstance(path, six.string_types)
    pkg, attr = path.rsplit(".", 1)
    ret = getattr(importlib.import_module(pkg), attr)
    return ret
Esempio n. 6
0
from django.conf.urls import url, include
from allauth.compat import importlib

from allauth.socialaccount import providers

from . import app_settings

urlpatterns = [url('^', include('allauth.account.urls'))]

if app_settings.SOCIALACCOUNT_ENABLED:
    urlpatterns += [url('^social/', include('allauth.socialaccount.urls'))]

for provider in providers.registry.get_list():
    try:
        prov_mod = importlib.import_module(provider.get_package() + '.urls')
    except ImportError:
        continue
    prov_urlpatterns = getattr(prov_mod, 'urlpatterns', None)
    if prov_urlpatterns:
        urlpatterns += prov_urlpatterns
Esempio n. 7
0
from django.conf.urls import url, include
from allauth.compat import importlib
from allauth.socialaccount import providers
from . import app_settings
from django.contrib.sites.models import Site

urlpatterns = [url('^', include('allauth.account.urls'))]

if app_settings.SOCIALACCOUNT_ENABLED:
    urlpatterns += [url('^social/', include('allauth.socialaccount.urls'))]

for provider in providers.registry.get_list():
    try:
        prov_mod = importlib.import_module(provider.get_package() + '.urls')
    except ImportError:
        continue
    prov_urlpatterns = getattr(prov_mod, 'urlpatterns', None)
    if prov_urlpatterns:
        urlpatterns += prov_urlpatterns
Esempio n. 8
0
from django.conf.urls import url, include
from allauth.compat import importlib

from allauth.socialaccount import providers

from . import app_settings

urlpatterns = [url('^', include('allauth.account.urls'))]

if app_settings.SOCIALACCOUNT_ENABLED:
    urlpatterns += [url('^social/', include('allauth.socialaccount.urls'))]

for provider in providers.registry.get_list():
    try:
        prov_mod = importlib.import_module(provider.package + '.urls')
    except ImportError:
        continue
    prov_urlpatterns = getattr(prov_mod, 'urlpatterns', None)
    if prov_urlpatterns:
        urlpatterns += prov_urlpatterns