title: Web2py : SQLFORM.grid : Making 2 columns unique
body: <p>Here is my database definition:</p>
  
  <pre><code>db.define_table('emsAlertTokens',
  
  Field('emsrelease','string',default=session.releasefield,writable=False,label=T('Release')),
              Field('emsmachine','string',default=session.machinefield,writable=False,label=T('Machine')),
              Field('emsstartdate','datetime',default=request.now,label=T('Start Date')),
              Field('emsenddate','datetime',IS_NOT_EMPTY(error_message='Please specify the End Date.'), label=T('End Date')),
              Field('errorgrepfile','upload',requires=IS_NOT_EMPTY(error_message='Please upload a valid error tokens file'),custom_store=ems_file, custom_retrieve=ems_retrieve, autodelete=True, uploadfield=True, uploadfs=None, label=T('Error Tokens')),
              Field('tokenname','string',requires=IS_NOT_EMPTY('What would you call your token file?'),label=T('Token File Name')))
  </code></pre>
  
  <p>As you can notice the emsmachine and emsrelease fields are from a session. My requirement is to make the combination of this 2 values to be unique.</p>
  
  <p>I tried with below validator but its not working.</p>
  
  <pre><code>db.emsAlertTokens.emsrelease.requires = IS_NOT_IN_DB(db(db.emsAlertTokens.emsmachine == session.machinefield), 'emsAlertTokens.emsrelease', error_message='EMS token file already exist for this release.')
  </code></pre>
  
  <p>Even this doesnot work:</p>
  
  <pre><code>db.emsAlertTokens.emsrelease.requires = IS_NOT_IN_DB(db(db.emsAlertTokens.emsmachine == request.vars.emsmachine), 'emsAlertTokens.emsrelease', error_message='EMS token file already exist for this release.')
  </code></pre>
  
  <p>Kindly help me on this.</p>