[Bug 75204] [next] remove TpAsv from public API

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Feb 24 03:47:32 PST 2014


https://bugs.freedesktop.org/show_bug.cgi?id=75204

--- Comment #9 from Simon McVittie <simon.mcvittie at collabora.co.uk> ---
review- for TpAW:

> + v = g_variant_lookup_value (account_params, param,
> + G_VARIANT_TYPE_VARIANT);

The docs say:

"""
In the event that dictionary has the type a{sv}, the expected_type string
specifies what type of value is expected to be inside of the variant. If the
value inside the variant has a different type then NULL is returned.
"""

so I would expect that call to be this pseudocode:

    v_ = account_params[param]
    if v_.signature == 'v':
        v = v_
    else:
        v = NULL

and it seems that is in fact the case:

>>> from gi.repository import GLib
>>> asv = GLib.Variant.parse(GLib.VariantType.new('a{sv}'), '@a{sv} { "hello": <"world">, "nested": <<42>> }', None, None)
>>> print asv.lookup_value('hello', GLib.VariantType.new('v'))
None
>>> print asv.lookup_value('nested', GLib.VariantType.new('v'))
<42>

So I think you're going to have to use GVariantDict, or iteration.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the telepathy-bugs mailing list