Skip to content

Commit

Permalink
version schema changed
Browse files Browse the repository at this point in the history
  • Loading branch information
bubenkoff committed Mar 6, 2014
1 parent 3510d25 commit f98727e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Changelog
=========


0.1
---
1.0.0
-----

* Initial public release
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def run_tests(self):
name='traduki',
description='SQLAlchemy internationalisation',
long_description='\n'.join(long_description),
version='0.1',
version='1.0.0',
author='Paylogic International',
author_email='[email protected]',
license='MIT',
Expand Down
9 changes: 9 additions & 0 deletions tests/test_i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,12 @@ def test_i18n_field(query, model, session):

assert model.title.get_dict() == {'en': 'En Title', 'pt': 'Pt Title'}
assert model.title.get_text() == 'En Title'


def test_class_custom_table(languages):
"""Test initialization with custom table."""
Base = declarative_base()

traduki.initialize(Base, languages, lambda: 'en', lambda: {}, attributes={'__tablename__': 'custom_table'})

assert traduki.sqla.Translation.__tablename__ == 'custom_table'
6 changes: 3 additions & 3 deletions traduki/sqla.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_dict(self):

def get_text(self, code=None, chain=None):
"""Get the text for specified language code.
Delegates to :py:func:`traduki.helpers.get_text_from_dict`, with all the given arguments and
Delegates to :py:func:`LocalizedString.get_text_from_dict`, with all the given arguments and
a dictionary, representing this :py:class:`Translation`.
The dictionary is created using :py:func:`get_dict`.
Expand Down Expand Up @@ -106,7 +106,7 @@ def _do_compare(self, op, other, escape):
Looking into the the next language if the given language is not filled in.
"""
related = self.property.mapper.class_
cols = [getattr(related, lang) for lang in helpers.get_ordered_languages() if hasattr(related, lang)]
cols = [getattr(related, lang) for lang in helpers.ordered_languages() if hasattr(related, lang)]
return self.has(op(func.coalesce(*cols), other, escape=escape))


Expand Down Expand Up @@ -137,7 +137,7 @@ def set(state, value, oldvalue, initiator):
if oldvalue is None:
return Translation(**value_dict)
else:
for lang in helpers.get_ordered_languages():
for lang in helpers.ordered_languages():
setattr(oldvalue, lang, value_dict.get(lang))

return oldvalue
Expand Down

0 comments on commit f98727e

Please sign in to comment.