From 254573a2ad12d19c10ae50daad0a82450148e25f Mon Sep 17 00:00:00 2001 From: ianb Date: Tue, 10 May 2005 22:21:20 +0000 Subject: Add WebKit.Application; Task manager setup --- paste/webkit/FakeWebware/WebKit/Application.py | 1 + paste/webkit/wkapplication.py | 27 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 paste/webkit/FakeWebware/WebKit/Application.py (limited to 'paste/webkit') 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() -- cgit v1.2.1