[Osaas-commits] r14 - in trunk: . server/osaas server/test
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Aug 28 16:14:28 CEST 2007
Author: bh
Date: 2007-08-28 16:14:28 +0200 (Tue, 28 Aug 2007)
New Revision: 14
Modified:
trunk/ChangeLog
trunk/server/osaas/server.py
trunk/server/test/test_osasserver.py
Log:
* server/osaas/server.py (OSAASServer.__init__): Rename the
dbhandler parameter to dbbackend. If a dbbackend object is passed
in, use the backend's handle_record method in the dbthreadpool
* server/test/test_osasserver.py (OSAASDBServerTests.handle_record):
(OSAASDBServerTests.dbhandler): Renamed to handle_record
(OSAASDBServerTests.create_server): pass self as the dbbackend to
the server.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-08-28 14:07:59 UTC (rev 13)
+++ trunk/ChangeLog 2007-08-28 14:14:28 UTC (rev 14)
@@ -1,5 +1,16 @@
2007-08-28 Bernhard Herzog <bh at intevation.de>
+ * server/osaas/server.py (OSAASServer.__init__): Rename the
+ dbhandler parameter to dbbackend. If a dbbackend object is passed
+ in, use the backend's handle_record method in the dbthreadpool
+
+ * server/test/test_osasserver.py (OSAASDBServerTests.handle_record):
+ (OSAASDBServerTests.dbhandler): Renamed to handle_record
+ (OSAASDBServerTests.create_server): pass self as the dbbackend to
+ the server.
+
+2007-08-28 Bernhard Herzog <bh at intevation.de>
+
* server/osaas/config.py (read_database_rules): New function to
read the database rules
(read_config_file): Read the database rules and store then into
Modified: trunk/server/osaas/server.py
===================================================================
--- trunk/server/osaas/server.py 2007-08-28 14:07:59 UTC (rev 13)
+++ trunk/server/osaas/server.py 2007-08-28 14:14:28 UTC (rev 14)
@@ -115,7 +115,7 @@
class OSAASServer(ThreadedHTTPServer):
def __init__(self, serveraddress, RequestHandlerClass=OSAASRequestHandler,
- dbhandler=lambda r: None, userdbfile=None,
+ dbbackend=None, userdbfile=None,
**kw):
ThreadedHTTPServer.__init__(self, serveraddress, RequestHandlerClass,
**kw)
@@ -123,6 +123,11 @@
if userdbfile:
self.userdb.read(userdbfile)
logger = logging.getLogger(self.error_logger_name + ".dbpool")
+ self.dbbackend = dbbackend
+ if dbbackend is None:
+ dbhandler = lambda r: None
+ else:
+ dbhandler = self.dbbackend.handle_record
self.dbthreadpool = ThreadPool(1, dbhandler, logger=logger)
self.dbthreadpool.start()
Modified: trunk/server/test/test_osasserver.py
===================================================================
--- trunk/server/test/test_osasserver.py 2007-08-28 14:07:59 UTC (rev 13)
+++ trunk/server/test/test_osasserver.py 2007-08-28 14:14:28 UTC (rev 14)
@@ -107,12 +107,12 @@
]
serversupport.ServerTest.setUp(self)
- def dbhandler(self, req):
+ def handle_record(self, req):
self.dbrequests.append(req)
self.dbrequest_event.set()
def create_server(self, *args, **kw):
- return OSAASServer(dbhandler=self.dbhandler, userdbfile=self.userdbfile,
+ return OSAASServer(dbbackend=self, userdbfile=self.userdbfile,
*args, **kw)
def send_formdata_request(self, formdata, expected_status=200):
More information about the Osaas-commits
mailing list