summaryrefslogtreecommitdiff
path: root/paste/reloader.py
diff options
context:
space:
mode:
authorpjenvey <devnull@localhost>2008-10-21 18:57:40 +0000
committerpjenvey <devnull@localhost>2008-10-21 18:57:40 +0000
commitd31da69268777a8d355ef909da958caab987b09d (patch)
tree141e321335075c904ff5cebd652c33f29291e21d /paste/reloader.py
parentee08be4e7794068c556b83c33588f8d65c3db5da (diff)
downloadpaste-d31da69268777a8d355ef909da958caab987b09d.tar.gz
only expose JythonMonitor if on Jython and _systemrestart is supported
Diffstat (limited to 'paste/reloader.py')
-rw-r--r--paste/reloader.py45
1 files changed, 23 insertions, 22 deletions
diff --git a/paste/reloader.py b/paste/reloader.py
index 57915d5..67f704a 100644
--- a/paste/reloader.py
+++ b/paste/reloader.py
@@ -148,33 +148,34 @@ class Monitor(object):
add_file_callback = classinstancemethod(add_file_callback)
-class JythonMonitor(Monitor):
+if sys.platform.startswith('java'):
+ try:
+ from _systemrestart import SystemRestart
+ except ImportError:
+ pass
+ else:
+ class JythonMonitor(Monitor):
- """
- Monitor that utilizes Jython's special
- ``_systemrestart.SystemRestart`` exception.
+ """
+ Monitor that utilizes Jython's special
+ ``_systemrestart.SystemRestart`` exception.
- When raised from the main thread it causes Jython to reload the
- interpreter in the existing Java process (avoiding startup time).
+ When raised from the main thread it causes Jython to reload
+ the interpreter in the existing Java process (avoiding
+ startup time).
- Note that this functionality of Jython is experimental and may
- change in the future.
- """
+ Note that this functionality of Jython is experimental and
+ may change in the future.
+ """
- def __init__(self, *args, **kwargs):
- Monitor.__init__(self, *args, **kwargs)
+ def __init__(self, *args, **kwargs):
+ Monitor.__init__(self, *args, **kwargs)
- def periodic_reload(self):
- while True:
- if not self.check_reload():
- raise SystemRestart()
- time.sleep(self.poll_interval)
+ def periodic_reload(self):
+ while True:
+ if not self.check_reload():
+ raise SystemRestart()
+ time.sleep(self.poll_interval)
-if sys.platform.startswith('java'):
- try:
- from _systemrestart import SystemRestart
- except ImportError:
- del JythonMonitor
-
watch_file = Monitor.watch_file
add_file_callback = Monitor.add_file_callback