Traceback (most recent call last):
  File "C:\dev\web2py\gluon\restricted.py", line 209, in restricted
    exec ccode in environment
  File "C:/dev/web2py/applications/infocenter/models/db.py" 
<http://127.0.0.1:8000/admin/default/edit/infocenter/models/db.py>, line 88, in 
<module>
    auth.define_tables()                           # creates all needed tables
  File "C:\dev\web2py\gluon\tools.py", line 1497, in define_tables
    fake_migrate=fake_migrate))
  File "C:\dev\web2py\gluon\dal.py", line 7041, in define_table
    table = self.lazy_define_table(tablename,*fields,**args)
  File "C:\dev\web2py\gluon\dal.py", line 7072, in lazy_define_table
    polymodel=polymodel)
  File "C:\dev\web2py\gluon\dal.py", line 719, in create_table
    on_delete_action=field.ondelete)
KeyError: 'index_name`'


...received on auth.define_tables()

code up to that point:

from gluon.custom_import import track_changes
track_changes()

import icUtil
import infoCenterUtil
import logging
from dateutil.relativedelta import *
from dateutil.parser import *
import datetime
import os
from plugin_suggest_widget import suggest_widget

log = logging.getLogger('InfoCenter')
if len(log.handlers) == 0:
log = icUtil.getLog(loggerName='InfoCenter', level='INFO', echo=True)

if infoCenterUtil.migrate():
db = DAL(infoCenterUtil.getDalString(), bigint_id=True)
else:
db = DAL(infoCenterUtil.getDalString(), migrate=False, 
migrate_enabled=False, bigint_id=True)

# 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 []

#print request.env.path_info

#########################################################################
## Here is sample code if you need for
## - email capabilities
## - authentication (registration, login, logout, ... )
## - authorization (role based authorization)
## - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
## - crud actions
## (more options discussed in gluon/tools.py)
#########################################################################

from gluon.tools import Mail, Auth, Crud, Service, PluginManager, prettydate

mail = Mail() # mailer
auth = Auth(db) # authentication/authorization
crud = Crud(db) # for CRUD helpers using auth
service = Service() # for json, xml, jsonrpc, xmlrpc, amfrpc
plugins = PluginManager()

from gluon.contrib.login_methods.email_auth import email_auth
#auth.settings.login_methods.append((email_auth('smtp.gmzxcvail.com:587', 
'@gzxcvvsmail.com')))
auth.settings.login_methods.append((email_auth('mail.qzxcvf.com:8025', 
'@qzxclf.com')))

mail.settings.server = 'mail.qdsfasd.com' # your SMTP server
mail.settings.sender = 'sdf...@lkjsd.com' # your email
mail.settings.login = 'username:password' # your credentials or None

auth.settings.hmac_key = 'sha512:9d8d83af-4567-410b-9cf5-e01a163b498d' # 
before define_tables()

auth_user = db.define_table(
auth.settings.table_user_name,
Field('first_name', length=128, default='', required=True),
Field('last_name', length=128, default='', required=True),
Field('email', length=128, unique=True, required=True),
Field('password', 'password', length=512,
readable=True, writable=True, label='Password'),
Field('registration_key', length=512,
writable=False, readable=False, default=''),
Field('reset_password_key', length=512,
writable=False, readable=False, default=''),
Field('registration_id', length=512,
writable=False, readable=False, default=''),
Field('brillLogon', length=10, default='', label='Brill Logon'),
Field('technician', 'boolean', default=False),
Field('dispatcher', 'boolean', default=False),
Field('lastFirst', compute=lambda u: '%s, %s' % (u['last_name'], 
u['first_name']), label='Name'),
Field('firstLast', compute=lambda u: '%s %s' % (u['first_name'], 
u['last_name']), label='Name'),
format='%(last_name)s, %(first_name)s')

auth_user.first_name.requires = 
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
auth_user.last_name.requires = 
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
auth_user.password.requires = [CRYPT()]
auth_user.email.requires = 
[IS_EMAIL(error_message=auth.messages.invalid_email),
IS_NOT_IN_DB(db, auth_user.email), 
IS_NOT_EMPTY(error_message=auth.messages.is_empty)]
auth_user.id.readable = False
auth_user._plural = 'Users'

auth.settings.table_user = auth_user

auth.define_tables() # creates all needed tables

...any ideas?

-- 



Reply via email to