Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Change unicode encoding tag to be an atom rather than a list of bytes…

… (aka Erlang string)

This change is incompatible with previous versions so I bumped the version to from 1.0 to 2.0
  • Loading branch information...
commit 61c157486f2ff86da438ab8db101a877e41289d8 1 parent 719d6bc
Samuel Stauffer authored
Showing with 5 additions and 5 deletions.
  1. +2 −2 bert/codec.py
  2. +2 −2 setup.py
  3. +1 −1  tests.py
View
4 bert/codec.py
@@ -46,7 +46,7 @@ def convert_bert(self, item):
if bert_type == "nil":
return None
elif bert_type == "string":
- return item[3].decode(list_to_str(item[2]))
+ return item[3].decode(Atom(item[2]))
elif bert_type == "dict":
return dict((self.convert(k), self.convert(v)) for k, v in item[2])
elif bert_type in ("true", True):
@@ -85,7 +85,7 @@ def convert(self, obj):
elif obj is None:
return (Atom("bert"), Atom("nil"))
elif isinstance(obj, unicode):
- return (Atom("bert"), Atom("string"), str_to_list(self.encoding.upper()), obj.encode(self.encoding))
+ return (Atom("bert"), Atom("string"), Atom(self.encoding.upper()), obj.encode(self.encoding))
elif isinstance(obj, dict):
return (Atom("bert"), Atom("dict"), [(self.convert(k), self.convert(v)) for k, v in obj.items()])
elif isinstance(obj, datetime.datetime):
View
4 setup.py
@@ -2,14 +2,14 @@
from distutils.core import setup
-__version__ = '1.0.0'
+__version__ = '2.0.0'
setup(
name = 'bert',
version = __version__,
description = 'BERT Serialization Library',
author = 'Samuel Stauffer',
- author_email = 'samuel@lefora.com',
+ author_email = 'samuel@descolada.com',
url = 'http://github.com/samuel/python-bert',
packages = ['bert'],
install_requires = ["erlastic"],
View
2  tests.py
@@ -31,7 +31,7 @@ class BERTTestCase(unittest.TestCase):
# nested nil
([None, (None,)], [("bert", "nil"), (("bert", "nil"),)]),
# unicode
- (u"Mitä kuuluu", ('bert', 'string', [ord(x) for x in 'UTF-8'], u"Mitä kuuluu".encode('utf-8'))),
+ (u"Mitä kuuluu", ('bert', 'string', Atom('UTF-8'), u"Mitä kuuluu".encode('utf-8'))),
# dict
({'foo': 'bar'}, ('bert', 'dict', [('foo', 'bar')])),
# empty dict
Please sign in to comment.
Something went wrong with that request. Please try again.