OnroerendErfgoed / skosprovider_rdf

Skosprovider implementation backed by RDF
http://skosprovider-rdf.readthedocs.org
MIT License
2 stars 4 forks source link

byte litteral support for python 3 #12

Closed JDeVos closed 9 years ago

JDeVos commented 9 years ago

string literals and byte literals are treated indifferently in py2.x but not in py3.x ex: str('abc'.encode('utf8')) = 'abc' in py2.x and "b'abc'" in py3.x.

When creating labels, the RDFProvider uses this at https://github.com/OnroerendErfgoed/skosprovider_rdf/blob/master/skosprovider_rdf/providers.py#L143 and therefore produces labels with prefixed strings (ex: b'brief')

BartSaelen commented 9 years ago

I think it's better to use the text_ method from pyramid compat (http://docs.pylonsproject.org/projects/pyramid//en/latest/api/compat.html) or local util like https://github.com/OnroerendErfgoed/oeauth/blob/master/oeauth/compat.py

str('abc'.encode('utf8'))

should be

text_('abc', encoding='utf8')