Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_default_language error in utils.py in send_notification_email (using notify_and_expire.py script) #18

Open
petersta opened this issue Aug 10, 2016 · 1 comment

Comments

@petersta
Copy link

petersta commented Aug 10, 2016

I solved this as follows in function send_notification_email:

# add imports
from Products.CMFCore.utils import getToolByName
from zope.component.hooks import get Site

# and change in function send_notification_email:

try: 
    language = api.portal.get_default_language()
except:
    site = getSite()
    lt = getToolByName(site, 'portal_languages')
    language = lt.getDefaultLanguage()

`

@frisi
Copy link
Member

frisi commented Aug 24, 2016

iirc we're using the notify_and_expire.py script too and did not experience any errors. (@pcdummy?)

under which circumstances does your error happen?
which plone version are you using?

a bare try except is generally not a good thing to have. try to catch a specific error.

if plone.api does not do a good job in finding the current default language it should probably fixed in there?
https://github.com/plone/plone.api/blob/1.5/src/plone/api/portal.py#L366

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants