Ejemplo n.º 1
0
 def setting(self, name, default=None):
     names = (setting_name(self.backend_name, name), setting_name(name),
              to_setting_name(self.backend_name, name), name)
     for name in names:
         try:
             return self.get_setting(name)
         except (AttributeError, KeyError):
             pass
     return default
Ejemplo n.º 2
0
 def setting(self, name, default=None):
     names = (setting_name(self.backend_name, name),
              setting_name(name),
              to_setting_name(self.backend_name, name),
              name)
     for name in names:
         try:
             return self.get_setting(name)
         except (AttributeError, KeyError):
             pass
     return default
Ejemplo n.º 3
0
 def get_setting(self, name):
     """Return value for given setting name. May extract from discussion prefs"""
     # TODO: Add WHITELISTED_DOMAINS
     if name.split("_")[-1] in ('KEY', 'SECRET', 'SERVER'):
         prefs = self.get_preferences()
         backend = prefs["authorization_server_backend"]
         if backend:
             m = re.match(
                 (r"^(?:SOCIAL_AUTH_)?(?:%s_)?(KEY|SECRET|SERVER)$" %
                  to_setting_name(backend)), name)
             if m:
                 val = prefs["authorization_" + m.group(1).lower()]
                 if val:
                     return val
     return super(AssemblStrategy, self).get_setting(name)
Ejemplo n.º 4
0
 def get_setting(self, name):
     """Return value for given setting name. May extract from discussion prefs"""
     # TODO: Add WHITELISTED_DOMAINS
     if name.split("_")[-1] in ('KEY', 'SECRET', 'SERVER'):
         prefs = self.get_preferences()
         backend = prefs["authorization_server_backend"]
         if backend:
             m = re.match((
                 r"^(?:SOCIAL_AUTH_)?(?:%s_)?(KEY|SECRET|SERVER)$"
                 % to_setting_name(backend)), name)
             if m:
                 val = prefs["authorization_" + m.group(1).lower()]
                 if val:
                     return val
     return super(AssemblStrategy, self).get_setting(name)