mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Put column descriptions where they belong
The Column class accepts a 'doc' argument. Use it. And while we're at it, make them all unicode strings. Performed by the following sed script: s/info=dict(description=u\?\("[^"]*"\))/doc=u\1/ s/info=dict(description=u\?\('[^']*'\))/doc=u\1/ s/\(\s*\)info=dict(description=u\?\("[^"]*"\), /\1doc=u\2,\n\1info=dict(/ s/\(\s*\)info=dict(description=u\?\('[^']*'\), /\1doc=u\2,\n\1info=dict(/ /info=dict(description=u\?\('[^']*'\),$/ { s//doc=u\1,/ n s/^\s*/&info=dict(/ }
This commit is contained in:
parent
181ae0fe19
commit
6f5abb9540
4 changed files with 646 additions and 514 deletions
|
@ -126,10 +126,10 @@ def create_translation_table(_table_name, foreign_class, relation_name,
|
|||
table = Table(_table_name, foreign_class.__table__.metadata,
|
||||
Column(foreign_key_name, Integer, ForeignKey(foreign_class.id),
|
||||
primary_key=True, nullable=False,
|
||||
info=dict(description="ID of the %s these texts relate to" % foreign_class.__singlename__)),
|
||||
doc=u"ID of the %s these texts relate to" % foreign_class.__singlename__),
|
||||
Column('local_language_id', Integer, ForeignKey(language_class.id),
|
||||
primary_key=True, nullable=False,
|
||||
info=dict(description="Language these texts are in")),
|
||||
doc=u"Language these texts are in"),
|
||||
)
|
||||
Translations.__table__ = table
|
||||
|
||||
|
|
1147
pokedex/db/tables.py
1147
pokedex/db/tables.py
File diff suppressed because it is too large
Load diff
|
@ -183,7 +183,7 @@ def generate_columns(cls, remaining_attrs):
|
|||
else:
|
||||
yield column_header(c, name) + ':'
|
||||
yield u''
|
||||
yield u' ' + unicode(c.info['description'])
|
||||
yield u' ' + unicode(c.__doc__)
|
||||
yield u''
|
||||
|
||||
@with_header(u'Internationalized strings')
|
||||
|
@ -198,7 +198,7 @@ def generate_strings(cls, remaining_attrs):
|
|||
yield column_header(c, cls.__name__,
|
||||
translation_class.__table__.name)
|
||||
yield u''
|
||||
yield u' ' + unicode(c.info['description'])
|
||||
yield u' ' + unicode(c.__doc__)
|
||||
yield u''
|
||||
|
||||
@with_header(u'Relationships')
|
||||
|
@ -243,9 +243,6 @@ def generate_associationproxies(cls, remaining_attrs):
|
|||
yield u'%s.\ **%s**:' % (cls.__name__, attr_name)
|
||||
yield '``{prop.remote_attr.key}`` of ``self.{prop.local_attr.key}``'.format(
|
||||
prop=prop)
|
||||
'''if 'description' in info:
|
||||
yield u''
|
||||
yield u' ' + unicode(info['description'])'''
|
||||
yield u''
|
||||
remaining_attrs.remove(attr_name)
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ def test_texts(cls):
|
|||
if column.name == 'name' and format != 'plaintext':
|
||||
raise AssertionError('%s: non-plaintext name' % column)
|
||||
# No mention of English in the description
|
||||
assert 'English' not in column.info['description'], column
|
||||
assert u'English' not in column.__doc__, column
|
||||
# If there's more than one text column in a translation table,
|
||||
# they have to be nullable, to support missing translations
|
||||
if hasattr(cls, 'local_language') and len(text_columns) > 1:
|
||||
|
|
Loading…
Reference in a new issue