#22 — Error caused by lack of email address
by
(anonymous)
—
last modified
Feb 21, 2009 08:57 PM
| State | Resolved |
|---|---|
| Version: | 1.1 |
| Area | Functionality |
| Issue type | Bug |
| Severity | Medium |
| Submitted by | (anonymous) |
| Submitted on | Mar 26, 2008 |
| Responsible | Damien Baty |
| Target release: |
—
|
I have a problem whereby if a notified user does not have a valid email address, CMFNotification errors, stopping the relevant action from ocurring.
I'm using:
Plone 2.5.3
Zope 2.9.7
CMFNotification 1.1
LDAPUserFolder
My users are all on LDAP, and I'm pulling the email addresses through from the LDAP schema. Unfortunately I can't be sure as to whether this is why the issue is ocurring, but due to our network I have to use LDAP anyway.
When all users to be notified have email addresses CMFNotification works 100% as expected. However, when a user is subscribed who doesn't have an email address it causes the error (Traceback below).
Any ideas would be greatly appreciated.
Many thanks
Laurence Pawling
Traceback (innermost last):
Module ZPublisher.Publish, line 115, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 41, in call_object
Module Products.CMFPlone.FactoryTool, line 369, in __call__
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 41, in call_object
Module Products.CMFFormController.FSControllerPageTemplate, line 90, in __call__
Module Products.CMFFormController.BaseControllerPageTemplate, line 28, in _call
Module Products.CMFFormController.ControllerBase, line 245, in getNext
- __traceback_info__: ['id = atct_edit', 'status = success', 'button=None', 'errors={}', 'context=<ATDocument at document.2008-03-26.6692477263>', "kwargs={'portal_status_message': 'Changes saved.'}", 'next_action=None', '']
Module Products.CMFFormController.Actions.TraverseTo, line 38, in __call__
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 41, in call_object
Module Products.CMFFormController.FSControllerPythonScript, line 104, in __call__
Module Products.CMFFormController.Script, line 145, in __call__
Module Products.CMFCore.FSPythonScript, line 108, in __call__
Module Shared.DC.Scripts.Bindings, line 311, in __call__
Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
Module Products.CMFCore.FSPythonScript, line 164, in _exec
Module None, line 1, in content_edit
- <FSControllerPythonScript at /UKWeb/content_edit used for /UKWeb/it/portal_factory/Document/document.2008-03-26.6692477263>
- Line 1
Module Products.CMFCore.FSPythonScript, line 108, in __call__
Module Shared.DC.Scripts.Bindings, line 311, in __call__
Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
Module Products.CMFCore.FSPythonScript, line 164, in _exec
Module None, line 11, in content_edit_impl
- <FSPythonScript at /UKWeb/content_edit_impl used for /UKWeb/it/portal_factory/Document/document.2008-03-26.6692477263>
- Line 11
Module Products.Archetypes.BaseObject, line 655, in processForm
Module Products.CMFNotification.patches, line 112, in at_post_create_script
Module Products.CMFNotification.NotificationTool, line 247, in onItemCreation
Module Products.CMFNotification.NotificationTool, line 398, in _handlerHelper
Module Products.CMFNotification.NotificationTool, line 628, in getEmailAddresses
TypeError: expected string or buffer
I'm using:
Plone 2.5.3
Zope 2.9.7
CMFNotification 1.1
LDAPUserFolder
My users are all on LDAP, and I'm pulling the email addresses through from the LDAP schema. Unfortunately I can't be sure as to whether this is why the issue is ocurring, but due to our network I have to use LDAP anyway.
When all users to be notified have email addresses CMFNotification works 100% as expected. However, when a user is subscribed who doesn't have an email address it causes the error (Traceback below).
Any ideas would be greatly appreciated.
Many thanks
Laurence Pawling
Traceback (innermost last):
Module ZPublisher.Publish, line 115, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 41, in call_object
Module Products.CMFPlone.FactoryTool, line 369, in __call__
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 41, in call_object
Module Products.CMFFormController.FSControllerPageTemplate, line 90, in __call__
Module Products.CMFFormController.BaseControllerPageTemplate, line 28, in _call
Module Products.CMFFormController.ControllerBase, line 245, in getNext
- __traceback_info__: ['id = atct_edit', 'status = success', 'button=None', 'errors={}', 'context=<ATDocument at document.2008-03-26.6692477263>', "kwargs={'portal_status_message': 'Changes saved.'}", 'next_action=None', '']
Module Products.CMFFormController.Actions.TraverseTo, line 38, in __call__
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 41, in call_object
Module Products.CMFFormController.FSControllerPythonScript, line 104, in __call__
Module Products.CMFFormController.Script, line 145, in __call__
Module Products.CMFCore.FSPythonScript, line 108, in __call__
Module Shared.DC.Scripts.Bindings, line 311, in __call__
Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
Module Products.CMFCore.FSPythonScript, line 164, in _exec
Module None, line 1, in content_edit
- <FSControllerPythonScript at /UKWeb/content_edit used for /UKWeb/it/portal_factory/Document/document.2008-03-26.6692477263>
- Line 1
Module Products.CMFCore.FSPythonScript, line 108, in __call__
Module Shared.DC.Scripts.Bindings, line 311, in __call__
Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
Module Products.CMFCore.FSPythonScript, line 164, in _exec
Module None, line 11, in content_edit_impl
- <FSPythonScript at /UKWeb/content_edit_impl used for /UKWeb/it/portal_factory/Document/document.2008-03-26.6692477263>
- Line 11
Module Products.Archetypes.BaseObject, line 655, in processForm
Module Products.CMFNotification.patches, line 112, in at_post_create_script
Module Products.CMFNotification.NotificationTool, line 247, in onItemCreation
Module Products.CMFNotification.NotificationTool, line 398, in _handlerHelper
Module Products.CMFNotification.NotificationTool, line 628, in getEmailAddresses
TypeError: expected string or buffer
Added by
Damien Baty
on
Mar 26, 2008 01:15 PM
Try to change lines 628-629 to something like::
Issue state:
unconfirmed
→
open
Responsible manager:
(UNASSIGNED)
→
dbaty
try:
if EMAIL_REGEXP.match(user):
addresses[user] = 1
except TypeError:
LOG.warning("Something wrong on member '%s'. 'user' value (e-mail address) is '%s'.", member, user)
Then look at the event log of your Zope instance when you create an item. It might be that ``member.getProperty('email')`` returns ``None`` (and not an empty string, as I think it should). Can you check that?
If that is the case, I would propose changing the line 627 to this::
user = member.getProperty('email', '')
If it works for you, I will apply the change.
Hope it helps.
Added by
(anonymous)
on
Mar 26, 2008 04:56 PM
Hi Damien
Many thanks for your swift reply!
The patch worked just with the first fix. In the case of not having an email address I now get a warning in the log instead of an error on the page. I'll keep the second fix up my sleeve for if I encounter any cases I haven't yet discovered, but I can't imagine what those would be.
Thanks again.
Added by
Damien Baty
on
Mar 27, 2008 10:36 AM
Can you tell me what you see in the log? I suspect that you get "(...) 'user' value (e-mail address) is 'None'", but I would like to be sure. The first fix is more a safety belt and a way to debug what is happening. The correct fix is probably the second patch that I have proposed. With further details from you, I could be able to confirm that this is an appropriate correction, apply the change to the code and add your name to the CHANGES.txt files, thus making you rich and famous (though an alternative plan might be helpful, if you have one).
Added by
(anonymous)
on
Mar 27, 2008 03:48 PM
To confirm, the entry I get in the log:
2008-03-27T12:33:47 WARNING CMFNotification Something wrong on member 'ukwebtest'. 'user' value (e-mail address) is 'None'.
Not sure if this has any baring at all, but the above warning appears with or without the ('email', '') fix.
Added by
Damien Baty
on
Apr 01, 2008 08:37 AM
I have implemented the aforementioned patch in the trunk and in the Plone 2.5 compatibility branch.
Issue state:
open
→
resolved
Thanks for your collaboration.
No responses can be added.
If you can, please log in before submitting a reaction.
