*models/db_schema_1_address.py* from web3py import Field from .db import * def on_define_address(table): table.field0.label = T('Field 0') db.define_table('address', Field('field0'), on_define = on_define_address, migrate = 'address.table')
*test 1* *url* = http://localhost:8000/_dashboard/dbadmin?app=test&dbname=db&tablename=address *result* = { "__class__": "lazyT", "kwargs": {}, "text": "Field 0", "translator": { "__class__": "method" } } *expected result *= Field 0 no error occured but the result is not expected *test 2* must set migrate = 'address.table' if not an error occured Traceback (most recent call last): File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 614, in import_apps module = importlib.machinery.SourceFileLoader(module_name, init). load_module() File "<frozen importlib._bootstrap_external>", line 407, in _check_name_wrapper File "<frozen importlib._bootstrap_external>", line 907, in load_module File "<frozen importlib._bootstrap_external>", line 732, in load_module File "<frozen importlib._bootstrap>", line 265, in _load_module_shim File "<frozen importlib._bootstrap>", line 696, in _load File "<frozen importlib._bootstrap>", line 677, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 728, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/Users/sugizo/learn/python/web3py/apps/test/__init__.py", line 1, in <module> from .models.db_schema_1_address import * File "/Users/sugizo/learn/python/web3py/apps/test/models/db_schema_1_address.py", line 10, in <module> on_define = on_define_address) File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/base.py" , line 592, in define_table table = self.lazy_define_table(tablename, *fields, **kwargs) File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/base.py" , line 626, in lazy_define_table polymodel=polymodel) File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/adapters/base.py" , line 798, in create_table return self.migrator.create_table(*args, **kwargs) File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/migrator.py" , line 281, in create_table self.adapter.create_sequence_and_triggers(query, table) File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/adapters/base.py" , line 881, in create_sequence_and_triggers self.execute(query) File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/adapters/__init__.py" , line 67, in wrap return f(*args, **kwargs) File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/adapters/base.py" , line 413, in execute rv = self.cursor.execute(command, *args[1:], **kwargs) sqlite3.OperationalError: table "address" already exists *test 3* translations/en.json can't be blank, min contents {}, if not an error occured *e.g.* echo {} > translations/en.json # work touch translations/en.json # not work Traceback (most recent call last): File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 614, in import_apps module = importlib.machinery.SourceFileLoader(module_name, init). load_module() File "<frozen importlib._bootstrap_external>", line 407, in _check_name_wrapper File "<frozen importlib._bootstrap_external>", line 907, in load_module File "<frozen importlib._bootstrap_external>", line 732, in load_module File "<frozen importlib._bootstrap>", line 265, in _load_module_shim File "<frozen importlib._bootstrap>", line 696, in _load File "<frozen importlib._bootstrap>", line 677, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 728, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/Users/sugizo/learn/python/web3py/apps/test/__init__.py", line 1, in <module> from .models.db_schema_1_address import * File "/Users/sugizo/learn/python/web3py/apps/test/models/db_schema_1_address.py", line 3, in <module> from .db import * File "/Users/sugizo/learn/python/web3py/apps/test/models/db.py", line 6, in <module> T = Translator(settings.T_FOLDER) File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pluralize/__init__.py" , line 60, in __init__ self.load(folder) File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pluralize/__init__.py" , line 68, in load self.languages[filename[:-5].lower()] = json.load(fp) File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/json/__init__.py", line 296, in load parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw ) File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/json/__init__.py", line 348, in loads return _default_decoder.decode(s) File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/a5a019e8-adb5-4b30-b3f0-4291cab9c26f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.