mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Make pokedex.db work on Python 3, I think.
This commit is contained in:
parent
4e56c036c1
commit
8ade3c1b39
3 changed files with 7 additions and 5 deletions
|
@ -165,7 +165,7 @@ class PokedexLinkPattern(markdown.inlinepatterns.Pattern):
|
||||||
|
|
||||||
Handles matches using factory
|
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):
|
def __init__(self, factory, session, string_language=None, game_language=None):
|
||||||
markdown.inlinepatterns.Pattern.__init__(self, self.regex)
|
markdown.inlinepatterns.Pattern.__init__(self, self.regex)
|
||||||
|
|
|
@ -136,7 +136,7 @@ def create_translation_table(_table_name, foreign_class, relation_name,
|
||||||
# Add ye columns
|
# Add ye columns
|
||||||
# Column objects have a _creation_order attribute in ascending order; use
|
# Column objects have a _creation_order attribute in ascending order; use
|
||||||
# this to get the (unordered) kwargs sorted correctly
|
# this to get the (unordered) kwargs sorted correctly
|
||||||
kwitems = kwargs.items()
|
kwitems = list(kwargs.items())
|
||||||
kwitems.sort(key=lambda kv: kv[1]._creation_order)
|
kwitems.sort(key=lambda kv: kv[1]._creation_order)
|
||||||
for name, column in kwitems:
|
for name, column in kwitems:
|
||||||
column.name = name
|
column.name = name
|
||||||
|
|
|
@ -56,7 +56,7 @@ class TableSuperclass(object):
|
||||||
if not pk_constraint:
|
if not pk_constraint:
|
||||||
return u"<%s object at %x>" % (typename, id(self))
|
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)
|
for column in pk_constraint.columns)
|
||||||
try:
|
try:
|
||||||
return u"<%s object (%s): %s>" % (typename, pk, self.identifier)
|
return u"<%s object (%s): %s>" % (typename, pk, self.identifier)
|
||||||
|
@ -64,10 +64,12 @@ class TableSuperclass(object):
|
||||||
return u"<%s object (%s)>" % (typename, pk)
|
return u"<%s object (%s)>" % (typename, pk)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return unicode(self).encode('utf8')
|
return str(self.__unicode__().encode('ASCII', 'replace')
|
||||||
|
.decode('ASCII'))
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return unicode(self).encode('utf8')
|
return str(self.__unicode__().encode('ASCII', 'replace')
|
||||||
|
.decode('ASCII'))
|
||||||
|
|
||||||
mapped_classes = []
|
mapped_classes = []
|
||||||
class TableMetaclass(DeclarativeMeta):
|
class TableMetaclass(DeclarativeMeta):
|
||||||
|
|
Loading…
Reference in a new issue