zeitgeist team mailing list archive
-
zeitgeist team
-
Mailing list archive
-
Message #02623
[Bug 691167] Re: The payload is sometimes mentioned as string and sometimes as array of bytes
Okidoki, thanks for the example - what we are doing in
_zeitgeist.engine.datamodel.Event.get_plain() for payloads is indeed
wrong.
Let me clearify the purpose of this method, get_plain() is designed to
change Event(template) objects in a way that they are dumpable by the
pickle module. And we are using pickle to store blacklists in the
filesystem for later use.
But: do we really want to support blacklists based on payload? Please
remember, payload can be random (binary)data, what's the point of
filtering events based on a binary blob?
So rather than fixing the way this method handles the payload field, I
propose we should not allow payload in blacklists at all.
--
You received this bug notification because you are a member of Zeitgeist
Framework Team, which is subscribed to Zeitgeist Framework.
https://bugs.launchpad.net/bugs/691167
Title:
The payload is sometimes mentioned as string and sometimes as array of bytes
Status in Zeitgeist Framework:
New
Bug description:
In the event serialization format, the third array is array of bytes or ay as dbus signature.
When an event enters an extension, it looks like
Event([dbus.Array([u'', u'1292500628312', u'', u'', u'application://foo.desktop'], signature=dbus.Signature('s')), [Subject([u'', u'', u'', u'', u'', u'', u''])], dbus.Array([], signature=dbus.Signature('y'))])
which implies that payload is array of bytes
Now look at _zeitgeist/engine/datamodel.py at line 58
where you get the line
>> popo.append(str(ev[2]))
Really so when you do str() on dbus.Array([], signature=dbus.Signature('y'))
you get "dbus.Array([], signature=dbus.Signature('y'))" instead of the contents of bytes converted to string
Now when you call Event.get_plain on
Event([dbus.Array([u'', u'1292500628312', u'', u'', u'application://foo.desktop'], signature=dbus.Signature('s')), [Subject([u'', u'', u'', u'', u'', u'', u''])], dbus.Array([], signature=dbus.Signature('y'))])
you get
[[u'', u'1292500628312', u'', u'', u'application://foo.desktop'], [[u'', u'', u'', u'', u'', u'', u'']], "dbus.Array([], signature=dbus.Signature('y'))"]
Now what you expect
References