def _load_profile_class(self, provider): try: pkey = 'aeauth.strategies.{}'.format(provider) profile_path = Config.get(pkey).user_profile_model profile_class = utils.import_class(profile_path) except AttributeError, e: raise AttributeError("You must provide the location of "\ "the {0} user profile.".format(provider))
def _get_user_model(self): try: return utils.import_class(self._config.user_model) except ImportError, e: raise Exception('The following error occurred while attempting to '\ 'import your custom user model: {}'.format(e))
def test_import_class(self): klass = utils.import_class('utils_test.TestImportStringClass') self.assertEqual(klass, TestImportStringClass)