OK - I reverted to auth.settings.extra_fields and expanded the code shown
below. The same error is persisting.
db.py
# -*- coding: utf-8 -*-
#########################################################################
## This scaffolding model makes your app work on Google App Engine too
## File is released under public domain and you can use without limitations
#########################################################################
## if SSL/HTTPS is properly configured and you want all HTTP requests to
## be redirected to HTTPS, uncomment the line below:
# request.requires_https()
## app configuration made easy. Look inside private/appconfig.ini
from gluon.contrib.appconfig import AppConfig
## import current for current.db = db line
from gluon import current
## once in production, remove reload=True to gain full speed
myconf = AppConfig(reload=True)
if not request.env.web2py_runtime_gae:
## if NOT running on Google App Engine use SQLite or other DB
db = DAL(myconf.take('db.uri'), pool_size=myconf.take('db.pool_size',
cast=int), check_reserved=['all'], migrate=True)
else:
## connect to Google BigTable (optional 'google:datastore://namespace')
db = DAL('google:datastore+ndb')
## store sessions and tickets there
session.connect(request, response, db=db)
## or store session in Memcache, Redis, etc.
## from gluon.contrib.memdb import MEMDB
## from google.appengine.api.memcache import Client
## session.connect(request, response, db = MEMDB(Client()))
## define current.db for module usage
current.db = db
## by default give a view/generic.extension to all actions from localhost
## none otherwise. a pattern can be 'controller/function.extension'
response.generic_patterns = ['*'] if request.is_local else []
## choose a style for forms
response.formstyle = myconf.take('forms.formstyle') # or
'bootstrap3_stacked' or 'bootstrap2' or other
response.form_label_separator = myconf.take('forms.separator')
from gluon.tools import Auth, Service, PluginManager
auth = Auth(db)
service = Service()
plugins = PluginManager()
auth.settings.extra_fields['auth_user']= [
Field('company'),
]
## create all tables needed by auth if not custom tables
auth.define_tables(username=False, signature=False)
## configure email
mail = auth.settings.mailer
mail.settings.server = 'logging' if request.is_local else 'smtp.gmail.com'
mail.settings.sender = '[email protected]'
mail.settings.login = '[email protected]:password'
## configure auth policy
auth.settings.registration_requires_verification = True
auth.settings.registration_requires_approval = True
auth.settings.reset_password_requires_verification = True
On Monday, June 13, 2016 at 7:53:45 PM UTC-4, Dave S wrote:
>
>
>
> On Monday, June 13, 2016 at 1:57:38 PM UTC-7, Marty Jones wrote:
>>
>> Hi -
>>
>> I created a custom auth_user table with a new field ('company') and am
>> having trouble accessing it in my controller:
>>
>
>
> The book recommends using auth.settings.extra_fields
> <URL:
> http://web2py.com/books/default/chapter/29/09/access-control#Customizing-Auth
> >
> unless you really have to define a custom table.
>
> In either case, the customization goes somewhere between the "auth =
> Auth(db)" and "auth.define_tables()".
>
> You may need to show us more code.
>
> /dps
>
>
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.