It was a mistake to put that in crud to begin with. It has nothing to
do with crud. That is why I do not like crud very much. Everything it
does that we like can now be done without crud and better.



On Sep 19, 9:56 pm, tomt <[email protected]> wrote:
> Thanks a lot Massimo,
>
> Both forms work correctly.
> I had no idea I could use crud.archive(form) in the stable release
> with anything but crud.  I am now using it successfully on several
> SQLFORM routines.
>
> On Sep 18, 9:57 pm, Massimo Di Pierro <[email protected]>
> wrote:
>
>
>
>
>
>
>
> > ERRATA:
>
> > With stable you can do
>
> > form=SQLFORM(....)
> > if form.accepts(request,session):
> >       crud.archive(form)
>
> > With trunk:
>
> > form=SQLFORM(....)
> > if form.process(onsuccess=auth.archive).accepted: ...
>
> > "onsuccess" not "onaccept"
>
> > On Sep 18, 10:46 pm, tomt <[email protected]> wrote:
>
> > > Massimo,
>
> > > Thanks for the quick update.  I installed trunk... hg 
> > > clonehttps://code.google.com/p/web2py/
> > > and tried the suggested code
>
> > > def editarch2():
> > >     id = request.args(0) or 1
> > >     row=db.things(id)
> > >     form=SQLFORM(db.things,row)
> > >     if form.process(onaccept=auth.archive).accepted:
> > >         response.flash='ok'
> > >     return dict(form=form)
>
> > > And received the following error message:
> > >   File "/home/xa21/web2py/applications/archtst/controllers/
> > > default.py", line 91, in editarch2
> > >     if form.process(onaccept=auth.archive).accepted:
> > >   File "/home/xa21/web2py/gluon/html.py", line 1947, in process
> > >     self.validate(**kwargs)
> > >   File "/home/xa21/web2py/gluon/html.py", line 1898, in validate
> > >     if self.accepts(**kwargs):
> > > TypeError: accepts() got an unexpected keyword argument 'onaccept'
>
> > > Any comments? Thanks -Tom
>
> > > On Sep 18, 8:14 pm, Massimo Di Pierro <[email protected]>
> > > wrote:
>
> > > > Correction..
>
> > > > With stable you can do
>
> > > > form=SQLFORM(....)
> > > > form.accepts(request,session,onaccept=crud.archive)
>
> > > > With trunk crud.archive is an alias for auth.archive (new) and
> > > > form.process(...) is similar to form.accepts(...) but returns the form
> > > > instead of boolean. In other words this (old):
>
> > > > form=SQLFORM(....)
> > > > if form.accepts(request,session,onaccept=crud.archive): ...
>
> > > > and this (new)
>
> > > > form=SQLFORM(....)
> > > > if form.process(onaccept=auth.archive).accepted: ...
>
> > > > are equivalent.
>
> > > > massimo
>
> > > > On Sep 18, 9:11 pm, Massimo Di Pierro <[email protected]>
> > > > wrote:
>
> > > > > You need trunk
>
> > > > > On Sep 18, 8:12 pm, tomt <[email protected]> wrote:
>
> > > > > > Hi,
>
> > > > > > Could you please elaborate on this a bit?
>
> > > > > > Does this capability exist in 1.98.2?  I couldn't find any
> > > > > > documentation on it.  Do I have to write some additional code to 
> > > > > > make
> > > > > > this work?  If I implement your example literally:
>
> > > > > > form=SQLFORM(db.things,row).process(onaccept=auth.archive)
>
> > > > > > The error tells me "AttributeError: 'Auth' object has no attribute
> > > > > > 'archive'"
>
> > > > > > I'd appreciate some pointers.
>
> > > > > > Thanks, - Tom
>
> > > > > > On Sep 13, 9:26 pm, Massimo Di Pierro <[email protected]>
> > > > > > wrote:
>
> > > > > > > I think this calls for a new feature. for today the best I can 
> > > > > > > suggest
> > > > > > > is
>
> > > > > > > form = SQLFORM(...).process(onaccept=auth.archive)
>
> > > > > > > (notice auth.archive and crud.archive are the same but you can 
> > > > > > > archive
> > > > > > > without crud). I hate crud. I want it to die but slowly.
>
> > > > > > > On Sep 13, 5:16 pm, Michele Comitini <[email protected]>
> > > > > > > wrote:
>
> > > > > > > > A question which bothers me a lot lately ;-)
>
> > > > > > > > I know that crud has a nice support forhistorytables inside the 
> > > > > > > > db,
> > > > > > > > but I cannot use crud everywhere.
> > > > > > > > It would be nice if DAL had support for this feature(*)
>
> > > > > > > > I would like to have web2py take care of the task instead of 
> > > > > > > > filling
> > > > > > > > the db with triggers and stored procedures.
>
> > > > > > > > On PostgreSQL I suppose can use the tablelog machinery, but 
> > > > > > > > first I do
> > > > > > > > not even know if it still works on pg 9.x and secondly it is not
> > > > > > > > portable at all...
>
> > > > > > > > Does anyone have suggestions?
>
> > > > > > > > thanks
>
> > > > > > > > mic
>
> > > > > > > > (*)now I expect Massimo showing me how I am ignorant with one 
> > > > > > > > of his
> > > > > > > > great onliners! ;-)

Reply via email to