Thank you for those suggestions I miss them out when they been posted...  [?]


Jonhy


2010/6/10 mdipierro <[email protected]>

> errata.
>
> form=crud.update(db.table,onaccept=crud.archive)
>
> info is here:
>
>
> http://web2py.com/examples/static/epydoc/web2py.gluon.tools.Crud-class.html#archive
>
> On Jun 9, 11:58 pm, mdipierro <[email protected]> wrote:
> > Mind that you can also do
> >
> > form=crud.update(db.table,onaccept=auth.archive)
> >
> > It will create a secret table (which can be exposed) will all
> > revisions for the edited records. Look into examples in the docstring
> > or in the web based shell type
> >
> > help(auth.archive)
> >
> > On Jun 9, 11:53 pm, Christopher Steel <[email protected]> wrote:
> >
> > > Hi Jean Guy,
> >
> > > Are you talking about record auditing???
> >
> > > You could do that with something like this:
> >
> > > # This sets a variable for user_id which is used frequently
> > > # it must be set after db.py or in db.py but after auth tables have
> > > been defined
> > > # and before the table referring to it.
> >
> > > user_id = auth.user.id if auth.user else 0
> >
> > > db.define_table('application',
> > >     Field('title'),
> > >     Field('body', 'text'),
> > >     Field('created_on', 'datetime', default=request.now),
> > >     Field('created_by', db.auth_user, default=user_id))
> >
> > > db.application.title.requires = [IS_NOT_EMPTY(), IS_NOT_IN_DB(db,
> > > 'application.title')]
> > > db.application.body.requires = IS_NOT_EMPTY()
> > > db.application.created_by.readable = False
> > > db.application.created_by.writable = False
> > > db.application.created_on.readable = False
> > > db.application.created_on.writable = False
> >
> > > If you are allowing editing you could copy the original record and
> > > create a new one.
> >
> > > web2pyslices has a nice example.
> >
> > > Cheers,
> >
> > > Chris
> >
> > > On Jun 8, 6:29 pm, Jean Guy <[email protected]> wrote:
> >
> > > > Could it be a good practice to implement electronic signature of the
> > > > database records like this :
> >
> > > > db.define_table('atable',
> > > >     SQLField('var1'),
> > > >     SQLField('var2',default=db(db.auth_user.id
> > > > ==auth.user_id).select(db.auth_user.initials).first().initials))
> >
> > > > It needs that the user be authentified otherwise the app won't work,
> but as
> > > > long as the user as to be authentified for doing accessing the
> database, it
> > > > should be ok...
> >
> > > > What do you think?
> >
> > > > My goal is to have each records signed (stamped with users initials
> > > > actually) at the database level.
> >
> > > > Thanks.
> >
> > > > Jonhy
>

<<330.gif>>

Reply via email to