*models/db.py*
from gluon.dal import InDBMigrator
db = DAL(configuration.get(configuration_env + '_' + 'db.uri'), 
 pool_size = configuration.get(configuration_env + '_' + 'db.pool_size'), 
 migrate_enabled = configuration.get(configuration_env + '_' + 
'db.migrate_enabled'), 
 migrate = configuration.get(configuration_env + '_' + 'db.migrate'), 
 fake_migrate = configuration.get(configuration_env + '_' + 
'db.fake_migrate'), 
 fake_migrate_all = configuration.get(configuration_env + '_' + 
'db.fake_migrate_all'), 
 adapter_args = dict(migrator = InDBMigrator), 
 check_reserved = ['all'], 
 ignore_field_case = True, 
 entity_quoting = False, 
 lazy_tables = True
 )

*private/appconfig.ini*
[dev_db]
uri              = sqlite://test.sqlite
pool_size        = 10 ; ignored for sqlite
migrate_enabled  = true
migrate          = true
fake_migrate     = false
fake_migrate_all = false

*models/db_schema_0_auth.py*
... cutted ...
auth.define_tables(username = True, signature = True, migrate = 'test_')
custom_auth_table = db[auth.settings.table_user_name]
custom_auth_table._format = '%(first_name)s %(last_name)s'
... cutted ...

*result when access web2py app*
2.17.2-stable+timestamp.2018.10.06.18.54.02
(Running on Rocket 1.2.6, Python 3.7.2)

Traceback (most recent call last):
  File "/Users/sugizo/learn/web2py/gluon/restricted.py", line 219, in 
restricted
    exec(ccode, environment)
  File 
"/Users/sugizo/learn/web2py/applications/test/models/db_schema_0_auth.py", 
line 9, in <module>
    custom_auth_table = db[auth.settings.table_user_name]
  File "/Users/sugizo/learn/web2py/gluon/packages/dal/pydal/base.py", line 
666, in __getitem__
    return self.__getattr__(str(key))
  File "/Users/sugizo/learn/web2py/gluon/packages/dal/pydal/base.py", line 
672, in __getattr__
    return self.lazy_define_table(tablename, *fields, **kwargs)
  File "/Users/sugizo/learn/web2py/gluon/packages/dal/pydal/base.py", line 
624, in lazy_define_table
    polymodel=polymodel)
  File 
"/Users/sugizo/learn/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 798, in create_table
    return self.migrator.create_table(*args, **kwargs)
  File "/Users/sugizo/learn/web2py/gluon/packages/dal/pydal/migrator.py", 
line 296, in create_table
    sql_fields_old = pickle.load(tfile)
TypeError: a bytes-like object is required, not 'str'

same code test in python 2.7.15 running well

thx n 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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to