diff options
| author | ianb <devnull@localhost> | 2005-05-10 22:21:20 +0000 |
|---|---|---|
| committer | ianb <devnull@localhost> | 2005-05-10 22:21:20 +0000 |
| commit | 254573a2ad12d19c10ae50daad0a82450148e25f (patch) | |
| tree | f61bb538bce89096f88b817f78afd32bf62958b7 /paste/webkit | |
| parent | a7e4f3302156781f6cec08b69e70a5473a3497cc (diff) | |
| download | paste-254573a2ad12d19c10ae50daad0a82450148e25f.tar.gz | |
Add WebKit.Application; Task manager setup
Diffstat (limited to 'paste/webkit')
| -rw-r--r-- | paste/webkit/FakeWebware/WebKit/Application.py | 1 | ||||
| -rw-r--r-- | paste/webkit/wkapplication.py | 27 |
2 files changed, 28 insertions, 0 deletions
diff --git a/paste/webkit/FakeWebware/WebKit/Application.py b/paste/webkit/FakeWebware/WebKit/Application.py new file mode 100644 index 0000000..7e1aef0 --- /dev/null +++ b/paste/webkit/FakeWebware/WebKit/Application.py @@ -0,0 +1 @@ +from paste.webkit.wkapplication import * diff --git a/paste/webkit/wkapplication.py b/paste/webkit/wkapplication.py index 1c016a4..33d3f84 100644 --- a/paste/webkit/wkapplication.py +++ b/paste/webkit/wkapplication.py @@ -3,6 +3,30 @@ A mostly dummy class to simulate the Webware Application object. """ from wkcommon import NoDefault +import threading +try: + from TaskKit.Scheduler import Scheduler +except ImportError: + Scheduler = None + +_taskManager = None +_makeTaskManagerLock = threading.Lock() + +def taskManager(): + global _taskManager + if _taskManager is None: + if Scheduler is None: + assert 0, ( + "FakeWebware is not installed, and/or TaskKit is " + "not available") + _makeTaskManagerLock.acquire() + try: + if _taskManager is None: + _taskManager = Scheduler(1) + _taskManager.start() + finally: + _makeTaskManagerLock.release() + return _taskManager class Application(object): @@ -16,3 +40,6 @@ class Application(object): def setting(self, setting, default=NoDefault): assert default is not NoDefault, "No settings are defined" return default + + def taskManager(self): + return taskManager() |
