Make pokedex.db work on Python 3, I think.

This commit is contained in:
Lynn "Zhorken" Vaughan 2014-05-31 17:16:19 -04:00
parent 4e56c036c1
commit 8ade3c1b39
3 changed files with 7 additions and 5 deletions

View File

@ -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)

View File

@ -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

View File

@ -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):