AttributeError: 'NoneType' object has no attribute 'payload'
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zeitgeist Framework |
Fix Released
|
Undecided
|
Markus Korn |
Bug Description
At revision 1219 of lp:zeitgeist I added a unittest to test the insert_hook feature (by using an extension which is blocking all events) which fails with this error:
markus@thekorn ~/devel/
DEBUG:zeitgeist
INFO:zeitgeist.
EINFO:zeitgeist
.
=======
ERROR: testInsertHook (__main_
-------
Traceback (most recent call last):
File "test/resonance
ids = import_
File "/media/
return engine.
File "test/.
m = map(self.
File "test/.
if event.payload:
AttributeError: 'NoneType' object has no attribute 'payload'
-------
Ran 2 tests in 0.012s
FAILED (errors=1)
1 markus@thekorn ~/devel/
Changed in zeitgeist: | |
milestone: | none → 0.3.1 |
Changed in zeitgeist: | |
status: | Fix Committed → Fix Released |
This bug is very easy to fix, but it leads ton an important question: how do we handle events which are not inserted (because of an error, or because of being blocked).
Keep in mind, in our current design the clients depend on the order of items InsertEvents returns, this allows them to map event->id. So silently ignoring failed/blocked events is not an option. Raising an error is also impossible, because there might be some events which successfully have been inserted.
I' not sure how to solve this, and I think it is not possible without changing the API again. Maybe we could change the signature of InsertEvents to
InsertEvents(in aE events, out au ids, out a{is} errors)
where errors is a dict which has the index of the event in events which failed to insert as key and a string representation (aka traceback) as value.