## We prepend f_ to fieldnames for disambiguitydb._common_fields.append(auth.signature) ## adds signature fields to all tables
db.define_table('work_log', Field('f_jacket_no', type='string', label=T('Jacket Number')), Field('f_job_title_format_no', type='string', label=T('Job Title & Format Number')), Field('f_assoc_no', type='string', label=T('Associated Information')), Field('f_status_destination', type='string', label=T('Status & Destination')), Field('f_probe', type='boolean', label=T('Peps')), Field('created_on', type='date', default=request.now, label=T('Date Out')), format='%(f_job_title_format_no)s', migrate=settings.migrate)
db.work_log._plural = T('Work Log')db.work_log._singular = T('Work Entry')db.work_log.f_jacket_no.requires = IS_MATCH('\d{3}-\d{3}', strict=True, error_message='Please use 000-000 format for Jacket No. (including leading 0)')db.work_log.f_job_title_format_no.requires = requires=IS_IN_SET(['Public Law: 6580', 'W&M Hearing: 5011', 'VA Hearing: 5011', 'State Disburse: 9334', 'Leg Calendar: 7800', 'Leg Branch Appro: 3700', 'Final Calendar: 7800', '112th Congress: 7800', 'CFR: 8091 (Indicate title & vol. num. at Assoc. Info.)', 'Other (Indicate at Assoc. Info.)'])db.work_log.f_status_destination.requires = requires=IS_IN_SET(['1st Try: PR', 'OK to Print: TE', 'CX\'s: PR', 'AA\'s: PR', 'Converted: TP'])db.work_log.created_on.represent = lambda value, x: value.strftime('%m/%d/%Y')db.work_log.created_on.writable = False
## after defining tables, uncomment below to enable auditingauth.enable_record_versioning(db)
def contactSearch(self): # Build a simple form userId = auth.user_id form = FORM('', LABEL('Name:', _for='asset_name'), INPUT(_name='asset_name',_value=userId, _id='web2py_asset_name'), INPUT(_type='submit',_value=T('Search')), INPUT(_type='submit',_value=T('Clear'), _onclick="jQuery('#asset_name').val('');"), _method="GET",_action='self', _id='contactSearch') return form
@auth.requires_login()def work_log_manage(): is_owner = (lambda row: row.created_by == auth.user_id) if auth.user else False db.work_log.id.readable=False # Since we do not want to expose the id field on the grid db.work_log.created_by.readable=True # Show owner of record db.work_log_archive.id.readable=False # Since we do not want to expose the id field on the grid links = [lambda row: A('View Post',_href=URL("default","work_log_archive.current_record",args=[row.id]))] orderby = ['created_on'] searchForms = dict(work_log=contactSearch, work_log_archive=None) grid = SQLFORM.smartgrid(db.work_log, linked_tables = ['work_log_archive'], editable= dict(work_log=is_owner, work_log_archive=False), deletable= dict(work_log=is_owner, work_log_archive=False), user_signature=True, details=False, search_widget=searchForms, showbuttontext=True, links_in_grid=False, links=links, paginate=30, maxtextlengths={'work_log.f_job_title_format_no':60}, orderby=orderby) return dict(grid=grid)
Version
web2py™ Version 2.9.5-stable+timestamp.2014.03.16.02.35.39
Python Python 2.7.3: /usr/bin/python (prefix: /usr)
Traceback
Traceback (most recent call last):
File "/home/www-data/web2py/gluon/restricted.py", line 220, in restricted
exec ccode in environment
File "/home/www-data/web2py/applications/worklog/controllers/default.py", line 104, in <module>
File "/home/www-data/web2py/gluon/globals.py", line 385, in <lambda>
self._caller = lambda f: f()
File "/home/www-data/web2py/gluon/tools.py", line 3287, in f
return action(*a, **b)
File "/home/www-data/web2py/applications/worklog/controllers/default.py", line 101, in work_log_manage
grid = SQLFORM.smartgrid(db.work_log, linked_tables = ['work_log_archive'], editable= dict(work_log=is_owner, work_log_archive=False), deletable= dict(work_log=is_owner, work_log_archive=False), user_signature=True, details=False, search_widget=searchForms, showbuttontext=True, links_in_grid=False, links=links, paginate=30, maxtextlengths={'work_log.f_job_title_format_no':60}, orderby=orderby)
File "/home/www-data/web2py/gluon/sqlhtml.py", line 2800, in smartgrid
user_signature=user_signature, **kwargs)
File "/home/www-data/web2py/gluon/sqlhtml.py", line 2267, in grid
form = search_widget and search_widget(sfields, url()) or ''
TypeError: contactSearch() takes exactly 1 argument (2 given)
Error snapshot help
<type 'exceptions.TypeError'>(contactSearch() takes exactly 1 argument (2 given))
def contactSearch(self, url):
...
return form