zeitgeist team mailing list archive
-
zeitgeist team
-
Mailing list archive
-
Message #02618
Re: [Bug 691167] Re: The payload is sometimes mentioned as string and sometimes as array of bytes
How do you intend to blacklist events with specific payloads then ?
On Thu, Dec 16, 2010 at 6:37 PM, Markus Korn <thekorn@xxxxxx> wrote:
> Manish, is this (esp. the last few lines `"dbus.Array([],
> signature=dbus.Signature('y'))"`) something you get somewhere with real
> code (if so, please attach a minimal reproducer) or is it *just* loud
> thinking?
>
> payload is in fact an array of bytes, as defined in the dbus signature.
> You should not care about the weirdness done in zeitgeist, it should
> just do the right thing. It does the right thing because a String in
> python is in first approximation just an array of bytes (I know this
> statement is not 100% true for all python versions, but it is good
> enough for our needs)
>
> There are only two possible reasons where this assumtion would fail:
> * we want to support python 2.x and 3.x at the same time, which is a no-go
> * I'm missing something ;) - please prove me wrong with some code.
>
> --
> You received this bug notification because you are subscribed to The
> Zeitgeist Project.
> 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
>
>
>
--
This is me doing some advertisement for my blog http://seilo.geekyogre.com
--
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