diff options
| author | ianb <devnull@localhost> | 2005-05-22 06:47:13 +0000 |
|---|---|---|
| committer | ianb <devnull@localhost> | 2005-05-22 06:47:13 +0000 |
| commit | 91c06790dee2bc3f1aaed76eaa80403d14ce6546 (patch) | |
| tree | e5fee25bc5b88219a24ee05b897e32483a03037c /paste/wdg_validate.py | |
| parent | 8ddc354798fbe6f1fd104d2b3000580d19eed83e (diff) | |
| download | paste-91c06790dee2bc3f1aaed76eaa80403d14ce6546.tar.gz | |
Made this module importable even when subprocess module is missing
Diffstat (limited to 'paste/wdg_validate.py')
| -rw-r--r-- | paste/wdg_validate.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/paste/wdg_validate.py b/paste/wdg_validate.py index 31e4a9d..7f16810 100644 --- a/paste/wdg_validate.py +++ b/paste/wdg_validate.py @@ -1,5 +1,9 @@ from cStringIO import StringIO -import subprocess +try: + import subprocess +except ImportError: + # Don't want this to be unimportable in older Python's + subprocess = None from paste import wsgilib from paste.docsupport import metadata import re @@ -72,6 +76,10 @@ class WDGValidateMiddleware(object): return self.add_error(page, html_errors) def call_wdg_validate(self, wdg_path, ops, page): + if subprocess is None: + raise ValueError( + "This middleware requires the subprocess module from " + "Python 2.4") proc = subprocess.Popen([wdg_path] + ops, shell=False, close_fds=True, |
