How can something that seems so simple, be so hard?
I can't seem to get a SINGLE field from the database from DAL:
First is the Error Message (Or on of the many types - but the latest one), then the code
What AM I doing wrong here ?
Als always, thanks ...
Error Message:
Error ticket for "Mec"
Ticket ID
10.13.69.144.2018-12-06.07-32-29.8fda8fd6-fe14-47f4-b508-14ce2346465e
<type 'exceptions.TypeError'> 'NoneType' object has no attribute '__getitem__'
Version
| web2py™ |
Version 2.17.2-stable+timestamp.2018.10.06.18.54.02 |
| Python |
Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr) |
Traceback
Error snapshot
<type 'exceptions.TypeError'>('NoneType' object has no attribute '__getitem__')
-------------------- Code Here --------------------------------------------------
Ok - Code for controller/default.py
def company_login():
company.company_name,orderby=db.company.company_name) form = SQLFORM.factory(
Field('username', label = 'User Name', requires=IS_NOT_EMPTY()),
Field('password', 'password', label = "Password",requires=IS_NOT_EMPTY()),
Field('Company', label = 'Court ID',
requires=IS_IN_DB(db,db.company.company_number,'%(company_name)s')),
submit_button=' Login ',
)
if form.process().accepted:
response.flash = 'form accepted'
elif form.errors:
response.flash = T('form has errors')
session.company = request.vars['Company']
Company_ID = request.vars['Company']
DbRows = db(db.company.company_number==Company_ID).select(db.company.company_name).first()
session.company_name = DbRows['company_name']
return dict(form=form)
Thanks again ...
Ben Duncan
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division