Skip to content

Commit

Permalink
lookup general mail/name from registry and use plone.api
Browse files Browse the repository at this point in the history
  • Loading branch information
petschki committed Apr 16, 2024
1 parent dfd8214 commit 73865e9
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/bda/plone/shop/mailnotify.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ def __init__(self, context):

@property
def admin_email(self):
props = api.portal.get_tool("portal_properties")
return get_shop_settings().admin_email or getattr(
props.site_properties, "email_from_address", ""
return (
get_shop_settings().admin_email
or api.portal.get_registry_record("plone.email_from_address")
)

@property
def admin_name(self):
props = api.portal.get_tool("portal_properties")
return get_shop_settings().admin_name or getattr(
props.site_properties, "email_from_name", ""
return (
get_shop_settings().admin_name
or api.portal.get_registry_record("plone.email_from_name")
)


Expand Down Expand Up @@ -89,8 +89,7 @@ def _lookup_text(self, field):
enum = getattr(settings, field, None)
if enum is None:
return
portal_state = self.context.restrictedTraverse("@@plone_portal_state")
lang = portal_state.language()
lang = api.portal.get_current_language()
for entry in enum:
if entry["lang"] == lang:
return entry["text"]
Expand Down Expand Up @@ -142,8 +141,7 @@ def __init__(self, context):

def payment_text(self, payment):
settings = get_shop_payment_settings()
portal_state = self.context.restrictedTraverse("@@plone_portal_state")
lang = portal_state.language()
lang = api.portal.get_current_language()
for entry in settings.payment_text:
if entry["lang"] == lang and entry["payment"] == payment:
return entry["text"]
Expand Down

0 comments on commit 73865e9

Please sign in to comment.