diff --git a/pokedex/db/markdown.py b/pokedex/db/markdown.py index f6c10a3..c8e3d8d 100644 --- a/pokedex/db/markdown.py +++ b/pokedex/db/markdown.py @@ -165,7 +165,7 @@ class PokedexLinkPattern(markdown.inlinepatterns.Pattern): Handles matches using factory """ - regex = ur'(?x) \[ ([^]]*) \] \{ ([-a-z0-9]+) : ([-a-z0-9 ]+) \}' + regex = u'(?x) \\[ ([^]]*) \\] \\{ ([-a-z0-9]+) : ([-a-z0-9 ]+) \\}' def __init__(self, factory, session, string_language=None, game_language=None): markdown.inlinepatterns.Pattern.__init__(self, self.regex) diff --git a/pokedex/db/multilang.py b/pokedex/db/multilang.py index 1ef29cf..128ff5d 100644 --- a/pokedex/db/multilang.py +++ b/pokedex/db/multilang.py @@ -136,7 +136,7 @@ def create_translation_table(_table_name, foreign_class, relation_name, # Add ye columns # Column objects have a _creation_order attribute in ascending order; use # this to get the (unordered) kwargs sorted correctly - kwitems = kwargs.items() + kwitems = list(kwargs.items()) kwitems.sort(key=lambda kv: kv[1]._creation_order) for name, column in kwitems: column.name = name diff --git a/pokedex/db/tables.py b/pokedex/db/tables.py index 85d45c8..f09a920 100644 --- a/pokedex/db/tables.py +++ b/pokedex/db/tables.py @@ -56,7 +56,7 @@ class TableSuperclass(object): if not pk_constraint: return u"<%s object at %x>" % (typename, id(self)) - pk = u', '.join(unicode(getattr(self, column.name)) + pk = u', '.join(u'{0}'.format(getattr(self, column.name)) for column in pk_constraint.columns) try: return u"<%s object (%s): %s>" % (typename, pk, self.identifier) @@ -64,10 +64,12 @@ class TableSuperclass(object): return u"<%s object (%s)>" % (typename, pk) def __str__(self): - return unicode(self).encode('utf8') + return str(self.__unicode__().encode('ASCII', 'replace') + .decode('ASCII')) def __repr__(self): - return unicode(self).encode('utf8') + return str(self.__unicode__().encode('ASCII', 'replace') + .decode('ASCII')) mapped_classes = [] class TableMetaclass(DeclarativeMeta):