[storm] RuntimeError with Storm(twisted integration)
Daniel Yang
daniel.yang.zhenyu at gmail.com
Fri Jul 17 08:14:39 BST 2009
Hi team,
I am doing some experiments on Storm(twisted integration) and Nevow to see
how they can work together.
I went across a RuntimeError when I kept refreshing a page. It said:
------------------------------------------------log--------------------------------------------------------------
2009-07-17 14:58:42+0800 [-] [Failure instance: Traceback: <type
'exceptions.RuntimeError'>: Resolving lazy values with the Twisted wrapper
is not possible right now! Please refetch your object using
store.get/store.find
--- <exception caught here> ---
/Library/Python/2.5/site-packages/Twisted-8.2.0_r27097-py2.5-macosx-10.5-i386.egg/twisted/internet/defer.py:323:_runCallbacks
/Users/Daniel/Documents/workspace/NovaWeb/src/web/FromLocation.py:47:cb_all
/Library/Python/2.5/site-packages/storm-0.14-py2.5-macosx-10.5-i386.egg/storm/properties.py:60:__get__
/Library/Python/2.5/site-packages/storm-0.14-py2.5-macosx-10.5-i386.egg/storm/variables.py:178:get
/Library/Python/2.5/site-packages/storm-0.14-py2.5-macosx-10.5-i386.egg/storm/event.py:53:emit
/Library/Python/2.5/site-packages/storm-0.14-py2.5-macosx-10.5-i386.egg/storm/twisted/store.py:238:_resolve_lazy_value
]
------------------------------------------------log--------------------------------------------------------------
(latest storm and Nevow, Twisted.Python 2.5.1, Osx 10.5.7)
I am using StorePool to manage connections:
------------------------------------------------code--------------------------------------------------------------
from storm.databases.sqlite import SQLite
from storm.uri import URI
from storm.twisted.store import StorePool
database = SQLite(URI(*'sqlite:///test.db'*))
pool = StorePool(database, 5, 10)
pool.start()
------------------------------------------------code--------------------------------------------------------------
On this page, I have 2 renders to access database(sqlite) with storm(People
list and Shop list):
------------------------------------------------code--------------------------------------------------------------
def *render_PeopleList*(*self*, ctx, data):
pat = inevow.IQ(ctx).patternGenerator(*'PeopleItem'*)
def *cb_find*(results, s):
results.config(offset=0, limit=10)
return results.all().addCallback(cb_all, s)
def *cb_all*(items, s):
#recycle the store.
pool.put(s)
ps = []
for item in items:
p = pat()
p.fillSlots(*'nickname'*, item.nickname)
ps.append(p)
return ctx.tag[ ps ]
def *cb_get*(s):
return s.find(People).addBoth(cb_find, s)
return pool.get().addCallback(cb_get).addErrback(lambda error:
log.msg(error))
------------------------------------------------code--------------------------------------------------------------
and shop render is pretty much like this.
In file "storm/twisted/store.py:238", I notice the _resolve_lazy_value
function does nothing but raising an error.
Do anyone have any idea of what is the problem?
Thanks.
--
-----------------------------------------------
Yours
Faithfully
Daniel Yang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/storm/attachments/20090717/53393d63/attachment.htm
More information about the storm
mailing list