Author: dmeyer
Date: Thu Jun 28 18:38:41 2007
New Revision: 2741
Modified:
trunk/WIP/beacon2/src/server/server.py
Log:
server can handle queries if async return
Modified: trunk/WIP/beacon2/src/server/server.py
==============================================================================
--- trunk/WIP/beacon2/src/server/server.py (original)
+++ trunk/WIP/beacon2/src/server/server.py Thu Jun 28 18:38:41 2007
@@ -269,6 +269,9 @@
directory = os.path.realpath(directory)
data = self._db.query(filename = directory)
+ if isinstance(data, kaa.notifier.InProgress):
+ yield data
+ data = data()
items = []
for i in data._beacon_tree():
if i._beacon_id:
@@ -284,6 +287,7 @@
@kaa.rpc.expose('monitor.add')
+ @kaa.notifier.yield_execution()
def monitor_add(self, client_id, request_id, query):
"""
Create a monitor object to monitor a query for a client.
@@ -291,7 +295,11 @@
log.info('add monitor %s', query)
if query and 'parent' in query:
type, id = query['parent']
- query['parent'] = self._db.query(type=type, id=id)[0]
+ result = self._db.query(type=type, id=id)[0]
+ if isinstance(result, kaa.notifier.InProgress):
+ yield result
+ result = result()
+ query['parent'] = result
for id, client, monitors in self._clients:
if id == client_id:
@@ -340,6 +348,9 @@
"""
self._db.commit()
data = self._db.query(filename=filename)
+ if isinstance(data, kaa.notifier.InProgress):
+ yield data
+ data = data()
items = []
for i in data._beacon_tree():
if i._beacon_id:
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog