AttributeError: 'NoneType' object has no attribute 'payload'

Bug #495017 reported by Markus Korn on 2009-12-10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zeitgeist Framework
Fix Released
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/zeitgeist/trunk % python test/
DEBUG:zeitgeist.engine:Creating engine 'resonance'
INFO:zeitgeist.engine:Using database: :memory:
EINFO:zeitgeist.engine:Using database: :memory:
ERROR: testInsertHook (__main__.TestExtensionHooks)
Traceback (most recent call last):
  File "test/", line 67, in testInsertHook
    ids = import_events("test/data/five_events.js", self.engine)
  File "/media/devel/zeitgeist/trunk/test/", line 81, in import_events
    return engine.insert_events(events)
  File "test/../_zeitgeist/engine/", line 372, in insert_events
    m = map(self._insert_event, events)
  File "test/../_zeitgeist/engine/", line 389, in _insert_event
    if event.payload:
AttributeError: 'NoneType' object has no attribute 'payload'

Ran 2 tests in 0.012s

FAILED (errors=1)
1 markus@thekorn ~/devel/zeitgeist/trunk %

Markus Korn (thekorn) wrote :

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.

Markus Korn (thekorn) on 2009-12-10
Changed in zeitgeist:
milestone: none → 0.3.1

I opened bug #495017 to discuss the case of errors or blocked events. Let's keep this bug on track :-)

Bleh, I meant bug #495179

Markus Korn (thekorn) wrote :

This is fixed by fixing bug 495179

Changed in zeitgeist:
status: New → Fix Committed
assignee: nobody → Markus Korn (thekorn)
Changed in zeitgeist:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers