lacre.repositories: Configure SQLAlchemy connection pooling #136
2 changed files with 9 additions and 12 deletions
|
@ -152,9 +152,10 @@ class FromStrMixin:
|
|||
|
||||
@classmethod
|
||||
def from_str(cls, name, *, required=False):
|
||||
# If name conversion is available, use it.
|
||||
if hasattr(cls, 'conv'):
|
||||
name = cls.conv(name)
|
||||
if name is None:
|
||||
return None
|
||||
|
||||
name = name.upper()
|
||||
|
||||
if name in cls.__members__:
|
||||
return cls.__members__[name]
|
||||
|
@ -167,7 +168,6 @@ class FromStrMixin:
|
|||
@classmethod
|
||||
def from_config(cls, section, key, *, required=False):
|
||||
param = get_item(section, key)
|
||||
# print(f'from config {param}, {section}:{key}*{required}')
|
||||
return cls.from_str(param, required=required)
|
||||
|
||||
|
||||
|
@ -185,7 +185,3 @@ class PoolingMode(FromStrMixin, Enum):
|
|||
"""
|
||||
OPTIMISTIC = auto()
|
||||
PESSIMISTIC = auto()
|
||||
|
||||
@classmethod
|
||||
def conv(cls, name):
|
||||
return name.upper()
|
||||
|
|
|
@ -88,17 +88,18 @@ def _sort_gpg_recipients(gpg_to) -> Tuple[recpt.RecipientList, recpt.RecipientLi
|
|||
|
||||
for rcpt in gpg_to:
|
||||
# Checking pre defined styles in settings first
|
||||
if conf.config_item_equals('pgp_style', rcpt.email(), 'mime'):
|
||||
style = conf.PGPStyle.from_config('pgp_style', rcpt.email())
|
||||
if style is conf.PGPStyle.MIME:
|
||||
recipients_mime.append(rcpt.email())
|
||||
keys_mime.extend(rcpt.key().split(','))
|
||||
elif conf.config_item_equals('pgp_style', rcpt.email(), 'inline'):
|
||||
elif style is conf.PGPStyle.INLINE:
|
||||
recipients_inline.append(rcpt.email())
|
||||
keys_inline.extend(rcpt.key().split(','))
|
||||
else:
|
||||
# Log message only if an unknown style is defined
|
||||
if conf.config_item_set('pgp_style', rcpt.email()):
|
||||
LOG.debug("Style %s for recipient %s is not known. Use default as fallback."
|
||||
% (conf.get_item("pgp_style", rcpt.email()), rcpt.email()))
|
||||
LOG.debug("Style %s for recipient %s is not known. Use default as fallback.",
|
||||
conf.get_item("pgp_style", rcpt.email()), rcpt.email())
|
||||
|
||||
# If no style is in settings defined for recipient, use default from settings
|
||||
if default_to_pgp_mime:
|
||||
|
|
Loading…
Reference in a new issue