In which file? A web2py file?
On Thursday, 30 August 2012 16:51:52 UTC-5, Jim S wrote:
>
> Sorry, I had a debug line in db.py. The actual offending line there is
> 726.
>
> -Jim
>
> On Thursday, August 30, 2012 4:44:40 PM UTC-5, Jim S wrote:
>>
>> Hi – sorry if this gets there multiple times, but I’ve posted twice in
>> the past 6 hours and it hasn’t shown up yet:
>>
>>
>>
>> I’m getting the following:
>>
>>
>>
>> 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", line 88, in
>> <module>
>>
>> auth.define_tables() # creates all needed
>> tables
>>
>> File "C:\dev\web2py\gluon\tools.py", line 1501, in define_tables
>>
>> fake_migrate=fake_migrate))
>>
>> File "C:\dev\web2py\gluon\dal.py", line 7051, in define_table
>>
>> table = self.lazy_define_table(tablename,*fields,**args)
>>
>> File "C:\dev\web2py\gluon\dal.py", line 7082, in lazy_define_table
>>
>> polymodel=polymodel)
>>
>> File "C:\dev\web2py\gluon\dal.py", line 727, in create_table
>>
>> on_delete_action=field.ondelete)
>>
>> KeyError: 'index_name`'
>>
>>
>>
>> Offending line of my code is:
>>
>> 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.asdfasdf.com:587',
>> '@asdfasd.com')))
>>
>> auth.settings.login_methods.append((email_auth('mail.asdfasdf.com', '@
>> sadfs.com')))
>>
>>
>>
>> mail.settings.server = 'mail.asdfjl.com' # your SMTP server
>>
>> mail.settings.sender = '[email protected] <javascript:>' # your
>> email
>>
>> mail.settings.login = 'asdf:alkdsjl' # your credentials or None
>>
>>
>>
>> auth.settings.hmac_key = 'sha512:9d8d83af-6548-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()
>>
>>
>>
>>
>>
>> Anyone with any idea why this is happening? Seems to be when it is
>> processing the auth_membership table. Happens on existing or new (empty,
>> no tables) database. Will create auth_user and auth_group on clean db
>> before it fails.
>>
>>
>>
>> -Jim
>>
>>
>>
>
--