Commit b7259de4 authored by Andreas Jung's avatar Andreas Jung

added checks to __call__() method for better error handling/messages

parent a828f715
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
This product provides support for external methods, which allow This product provides support for external methods, which allow
domain-specific customization of web environments. domain-specific customization of web environments.
""" """
__version__='$Revision: 1.43 $'[11:-2] __version__='$Revision: 1.44 $'[11:-2]
from Globals import Persistent, DTMLFile, MessageDialog, HTML from Globals import Persistent, DTMLFile, MessageDialog, HTML
import OFS.SimpleItem, Acquisition import OFS.SimpleItem, Acquisition
from string import split, join, find, lower from string import split, join, find, lower
...@@ -245,6 +245,18 @@ class ExternalMethod(OFS.SimpleItem.Item, Persistent, Acquisition.Explicit, ...@@ -245,6 +245,18 @@ class ExternalMethod(OFS.SimpleItem.Item, Persistent, Acquisition.Explicit,
first argument. first argument.
""" """
filePath = self.filepath()
if filePath==None:
raise RuntimeError,\
"external method could not be called " \
"because it is None"
if not os.path.exists(filePath):
raise RuntimeError,\
"external method could not be called " \
"because the file does not exist"
if DevelopmentMode: if DevelopmentMode:
# If the file has been modified since last loaded, force a reload. # If the file has been modified since last loaded, force a reload.
ts=os.stat(self.filepath())[stat.ST_MTIME] ts=os.stat(self.filepath())[stat.ST_MTIME]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment