Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Allow for unicode strings as node property values in _safe_string() #64

Closed
mhermans opened this Issue · 1 comment

2 participants

@mhermans

Thanks for the quick fix on issue #63, it is working as expected. I noticed however another minor issue with _safe_string().

If i'm correct it expects uft8-encoded strings, coercing them to unicode. Passing in unicode strings (i.e. unicode strings for node property values), results in an encoding error. Is it possible to do small check first, and let unicode pass? E.g.:

def _safe_string(self, s):
    if isinstance(s, unicode):
        return s
    if isinstance(s, basestring):
        return unicode(s.decode("utf-8"))
    else:
        # We avoid convert non-string values
        return s
@versae
Owner

Are you sure about this? Please, could you send a small test for this. What I understand is the lib doesn't allow to do do things like:

    node = gdb.nodes.create()
    node[u"property"] = u"value"

I think that is covered with tests, but maybe I'm not understanding you properly.

@versae versae closed this in 7088386
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.