Ha, as soon as I pasted this snippet I realized that and was looking to modify. When developing I was working off the trunk and having this problem. For some reason I thought maybe after deploying to linux and using a stable version the problem would go away.
Then I deployed to a linux machine using version 2.0.8. I hit the salt problem and removed it. Other than that, the code is the same, I promise! :) And my problem persisted. On Saturday, September 8, 2012 1:54:37 PM UTC-4, Niphlod wrote: > > raising a little hand here... 2.0.8 and salt=True in auth are > incompatible. > Someone here is: > - posting the wrong code > - use the wrong web2py version > - telling lies :P > > @Joel: jokes apart, can you please verify ? > > On Saturday, September 8, 2012 7:48:14 PM UTC+2, Massimo Di Pierro wrote: >> >> Supposed to work any update_record but let me give it a try. >> >> On Saturday, 8 September 2012 12:39:20 UTC-5, Joel Carrier wrote: >>> >>> At first I thought it was related to running on a windows machine using >>> the development server. >>> Then I deployed to a linux machine using the setup-web2py-ubuntu.sh >>> script >>> >>> Yes, the version is: Version 2.0.8 (2012-09-07 03:47:51) stable >>> >>> db.py: >>> >>> # -*- coding: utf-8 -*- >>> if 0: >>> from gluon.sql import * >>> from gluon.validators import * >>> from gluon import T >>> >>> >>> from gluon import current >>> >>> >>> db = SQLDB('mysql://'+settings.sql_user+':'+settings.sql_password+'@'+ >>> settings.db_host+'/'+settings.db_name,migrate=settings.migrate,pool_size >>> =10) >>> >>> >>> response.generic_patterns = ['*'] #if request.is_local else [] >>> >>> >>> current.db = db >>> current.T = T >>> >>> >>> from gluon.tools import Auth, Crud, Service, PluginManager, prettydate >>> auth = Auth(db, hmac_key=settings.hmac_key, salt=True) >>> crud, service, plugins = Crud(db), Service(), PluginManager() >>> >>> >>> current.auth = auth >>> >>> >>> auth.settings.registration_requires_verification = True >>> auth.settings.registration_requires_approval = False >>> auth.settings.reset_password_requires_verification = True >>> >>> >>> db._common_fields.append(auth.signature) >>> >>> >>> db.define_table('auth_user', >>> Field('id','id'), >>> Field('first_name', type='string', >>> label=T('First Name')), >>> Field('last_name', type='string', >>> label=T('Last Name')), >>> Field('email', type='string', >>> label=T('Email')), >>> Field('password', type='password', >>> readable=False, >>> label=T('Password')), >>> Field('date_of_birth', type='date', >>> label=T('Date of Birth')), >>> Field('birth_country','integer'), >>> Field('birth_city'), >>> Field('registration_key',default='', >>> writable=False,readable=False), >>> Field('reset_password_key',default='', >>> writable=False,readable=False), >>> Field('registration_id',default='', >>> writable=False,readable=False), >>> format='[%(id)s] %(first_name)s %(last_name)s', >>> ) >>> >>> >>> db.auth_user.first_name.requires = IS_UPPER() >>> db.auth_user.last_name.requires = IS_UPPER() >>> db.auth_user.password.requires = CRYPT(key=auth.settings.hmac_key) >>> db.auth_user.registration_id.requires = IS_NOT_IN_DB(db, db.auth_user. >>> registration_id) >>> db.auth_user.email.requires = ( >>> IS_EMAIL(error_message=auth.messages.invalid_email), >>> IS_NOT_IN_DB(db, db.auth_user.email), >>> IS_UPPER() >>> ) >>> >>> >>> and in models directory i also have a z.py >>> >>> auth.enable_record_versioning(db) >>> >>> Do I have to update my entities using SQLForms only? Or is it suppose >>> to work with any .update_record()? >>> >>> Thanks for your help! >>> >>> >>> On Saturday, September 8, 2012 10:23:05 AM UTC-4, Massimo Di Pierro >>> wrote: >>>> >>>> I am trying to reproduce the problem but I cannot. Are you running >>>> 2.0.8? >>>> >>>> On Saturday, 8 September 2012 07:34:19 UTC-5, Joel Carrier wrote: >>>>> >>>>> I want to maintain an audit history of all my objects. >>>>> >>>>> So near the beginning of my model definition I have >>>>> >>>>> db._common_fields.append(auth.signature) >>>>> >>>>> and at the very end I have >>>>> >>>>> auth.enable_record_versioning(db) >>>>> >>>>> The problem I am having is that when I pull up all the records >>>>> representing the history of an object, the modified_by and modified_on >>>>> fields do not reflect the time and user that performed the change. In >>>>> fact, they appear to be stuck on whoever was logged in when I last >>>>> restart >>>>> the web2py server and the time at which I restarted it. (Maybe it's the >>>>> first person to perform an edit and the time they do it at since last >>>>> restart.) >>>>> >>>>> Anyway, is there something obvious I am missing here? >>>>> >>>> --