Re: [Zope] Mail Host problem
Here is the revised code: try: mailhost = context.SuperValues('Mail Host')[0] except: raise AttributeError, "Cannot find a Mail Host object." ..and this is the error message: Zope Error Zope has encountered an error while publishing this resource. Error Type: AttributeError Error Value: Cannot find a Mail Host object. Troubleshooting Suggestions The URL may be incorrect. The parameters passed to this resource may be incorrect. A resource that this resource relies on may be encountering an error. For more detailed information about the error, please refer to the HTML source for this page. If the error persists please contact the site maintainer. Thank you for your patience. Traceback (innermost last): File /usr/local/zope/2-3-1/lib/python/ZPublisher/Publish.py, line 223, in publish_module File /usr/local/zope/2-3-1/lib/python/ZPublisher/Publish.py, line 187, in publish File /usr/local/zope/2-3-1/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook (Object: Traversable) File /usr/local/zope/2-3-1/lib/python/ZPublisher/Publish.py, line 171, in publish File /usr/local/zope/2-3-1/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: test_mail) File /usr/local/zope/2-3-1/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: test_mail) File /usr/local/zope/2-3-1/lib/python/Shared/DC/Scripts/Bindings.py, line 324, in __call__ (Object: test_mail) File /usr/local/zope/2-3-1/lib/python/Shared/DC/Scripts/Bindings.py, line 354, in _bindAndExec (Object: test_mail) File /usr/local/zope/2-3-1/lib/python/Products/PythonScripts/PythonScript.py, line 336, in _exec (Object: test_mail) (Info: ({'script': <PythonScript instance at 8a65798>, 'context': <Folder instance at 89c4640>, 'container': <Folder instance at 89c4640>, 'traverse_subpath': []}, (), {}, None)) File Script (Python), line 5, in test_mail AttributeError: (see above) Note, the Mail Host object is in the same folder as the script. Incidentally, I noted another user who mentioned an issue about permissions. I took out all references to acquire permissions and set all of them manually. Even when running as manager (expressly allowed in the security settings), I still got the above error message. How did people get this working in the past? Thanks again, Ron
try: mailhost=getattr(context, context.SuperValues('Mail Host')[0].id) except: raise AttributeError, "Cannot find a Mail Host object." Perhaps you get an AttributeError on SuperValues()
Isn't it: superValues() ?? ....if it makes a difference at all.
Besides, superValues() returns a sequence of objects ordered in how close they are to 'context', so you can: mailhost = context.superValues('Mail Host')[0]
rm the try: for a moment and paste the error and traceback next time.
Peter
and when you test it with superValues() instead of SuperValues() ?
Here is the revised code:
try: mailhost = context.SuperValues('Mail Host')[0] except: raise AttributeError, "Cannot find a Mail Host object."
..and this is the error message:
Zope Error
Zope has encountered an error while publishing this resource.
Error Type: AttributeError Error Value: Cannot find a Mail Host object.
Troubleshooting Suggestions
The URL may be incorrect. The parameters passed to this resource may be incorrect. A resource that this resource relies on may be encountering an error.
For more detailed information about the error, please refer to the HTML source for this page.
If the error persists please contact the site maintainer. Thank you for your patience.
Traceback (innermost last): File /usr/local/zope/2-3-1/lib/python/ZPublisher/Publish.py, line 223, in publish_module File /usr/local/zope/2-3-1/lib/python/ZPublisher/Publish.py, line 187, in publish File /usr/local/zope/2-3-1/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook (Object: Traversable) File /usr/local/zope/2-3-1/lib/python/ZPublisher/Publish.py, line 171, in publish File /usr/local/zope/2-3-1/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: test_mail) File /usr/local/zope/2-3-1/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: test_mail) File /usr/local/zope/2-3-1/lib/python/Shared/DC/Scripts/Bindings.py, line 324, in __call__ (Object: test_mail) File /usr/local/zope/2-3-1/lib/python/Shared/DC/Scripts/Bindings.py, line 354, in _bindAndExec (Object: test_mail) File /usr/local/zope/2-3-1/lib/python/Products/PythonScripts/PythonScript.py, line 336, in _exec (Object: test_mail) (Info: ({'script': <PythonScript instance at 8a65798>, 'context': <Folder instance at 89c4640>, 'container': <Folder instance at 89c4640>, 'traverse_subpath': []}, (), {}, None)) File Script (Python), line 5, in test_mail AttributeError: (see above)
Note, the Mail Host object is in the same folder as the script. Incidentally, I noted another user who mentioned an issue about permissions. I took out all references to acquire permissions and set all of them manually. Even when running as manager (expressly allowed in the security settings), I still got the above error message.
How did people get this working in the past?
Thanks again,
Ron
try: mailhost=getattr(context, context.SuperValues('Mail Host')[0].id) except: raise AttributeError, "Cannot find a Mail Host object." Perhaps you get an AttributeError on SuperValues()
Isn't it: superValues() ?? ....if it makes a difference at all.
Besides, superValues() returns a sequence of objects ordered in how close they are to 'context', so you can: mailhost = context.superValues('Mail Host')[0]
rm the try: for a moment and paste the error and traceback next time.
Peter
Why not take out the try/except so you can see what the error really is? -steve complaw@hal-pc.org wrote:
Here is the revised code:
try: mailhost = context.SuperValues('Mail Host')[0] except: raise AttributeError, "Cannot find a Mail Host object."
..and this is the error message:
participants (3)
-
complaw@hal-pc.org -
Peter Bengtsson -
Steve Spicklemire