Thank you! It works, but i cannot understnd how and why. Could you explain? How is grid interested in request.args(if i don't use it as such, but copy args[0] in ufie and pass that to grid)?
Il giorno lunedì 18 gennaio 2016 02:10:32 UTC+1, Massimo Di Pierro ha scritto: > > should eb > > def vistaSIMFDB(): > ufile=request.args(0) > > #ufile='SIMFDB_2016011509341800.csv' > #form=legacy_db(legacy_db.SIMFDB.filename==ufile).select() > form = SQLFORM.grid(legacy_db.SIMFDB.filename==ufile, csv=True, > args=request.args[:1] ) > return dict(form=form) > > > you have to tell the grid which args to exclude. > > On Sunday, 17 January 2016 14:25:49 UTC-6, goome wrote: >> >> this is making me mad(i think i am missing somethng obvious, bt i don't >> know what): >> This work: >> def vistaSIMFDB(): >> ufile=request.args[0] >> #ufile='SIMFDB_2016011509341800.csv' >> form=legacy_db(legacy_db.SIMFDB.filename==ufile).select() >> #form = SQLFORM.grid(legacy_db.SIMFDB.filename==ufile, csv=True ) >> return dict(form=form) >> >> >> This , which use SQLFORM.grid, but no request.args, also work: >> def vistaSIMFDB(): >> #ufile=request.args[0] >> ufile='SIMFDB_2016011509341800.csv' >> #form=legacy_db(legacy_db.SIMFDB.filename==ufile).select() >> form = SQLFORM.grid(legacy_db.SIMFDB.filename==ufile, csv=True ) >> return dict(form=form) >> >> >> This (sqlform.grid with a parameter got from request.args) not: >> i am redirect to >> http://127.0.0.1:8000/PROVE/vistaSIMFDB?_signature=c3d5a81a14fa239430285e2444c0f0fb568aba2d >> : >> >> Ticket ID >> >> 127.0.0.1.2016-01-17.21-21-32.80e5e27e-d857-4431-9876-a44d3c169182 >> <type 'exceptions.IndexError'> list index out of range Version web2py™ >> Version >> 2.10.4-stable+timestamp.2015.04.26.15.11.54 Python Python 2.7.6: >> /usr/bin/python (prefix: /usr) Traceback >> >> 1. >> 2. >> 3. >> 4. >> 5. >> 6. >> 7. >> 8. >> 9. >> 10. >> >> Traceback (most recent call last): >> File "/home/marcello/CODE/MIEI/WEB2.10/gluon/restricted.py", line 227, in >> restricted >> exec ccode in environment >> File >> "/home/marcello/CODE/MIEI/WEB2.10/applications/PROVE/controllers/default.py" >> <http://127.0.0.1:8000/admin/edit/PROVE/controllers/default.py>, line 1559, >> in <module> >> File "/home/marcello/CODE/MIEI/WEB2.10/gluon/globals.py", line 393, in >> <lambda> >> self._caller = lambda f: f() >> File >> "/home/marcello/CODE/MIEI/WEB2.10/applications/PROVE/controllers/default.py" >> <http://127.0.0.1:8000/admin/edit/PROVE/controllers/default.py>, line 1522, >> in vistaSIMFDB >> ufile=request.args[0] >> IndexError: list index out of range >> >> Error snapshot [image: help] >> <http://127.0.0.1:8000/admin/default/ticket/PROVE/127.0.0.1.2016-01-17.21-21-32.80e5e27e-d857-4431-9876-a44d3c169182#> >> >> >> <type 'exceptions.IndexError'>(list index out of range) >> >> inspect attributes >> Frames >> >> - >> >> *File /home/marcello/CODE/MIEI/WEB2.10/gluon/restricted.py in >> restricted at line 227* code arguments variables >> - >> >> *File >> >> /home/marcello/CODE/MIEI/WEB2.10/applications/PROVE/controllers/default.py >> in <module> at line 1559* code arguments variables >> - >> >> *File /home/marcello/CODE/MIEI/WEB2.10/gluon/globals.py in <lambda> >> at line 393* code arguments variables >> - >> >> *File >> >> /home/marcello/CODE/MIEI/WEB2.10/applications/PROVE/controllers/default.py >> in vistaSIMFDB at line 1522* code arguments variables >> Function argument list >> >> () >> Code listing >> >> 1517. >> 1518. >> 1519. >> 1520. >> 1521. >> 1522. >> >> 1523. >> 1524. >> 1525. >> 1526. >> >> form=legacy_db(legacy_db.STK.filename==ufile).select() >> return dict(form=form) >> >> >> def vistaSIMFDB(): >> ufile=request.args[0] >> >> #ufile='SIMFDB_2016011509341800.csv' >> #form=legacy_db(legacy_db.SIMFDB.filename==ufile).select() >> form = SQLFORM.grid(legacy_db.SIMFDB.filename==ufile, csv=True ) >> return dict(form=form) >> >> Variables global request <Storage {'_vars': None, 'function': >> 'vistaSIMFD...marcello/CODE/MIEI/WEB2.10/applications/PROVE/'}> >> request.args [] ufile undefined >> >> >> so that the problem seems to be with grid and request.args togheter, >> which seems quite bizarre, also becouse the ticket point to fails in >> request.args, while grid is called after >> >> >> Il giorno domenica 17 gennaio 2016 19:49:37 UTC+1, Anthony ha scritto: >>> >>> Is that all you have in routes, because your URL excludes the >>> controller, which would also be implemented via the routes? >>> >>> Also, when you get that error, is the exact URL in the address bar of >>> the browser >>> http://127.0.0.1:8000/PROVE/dettaglio_aggiornamenti/SPE/SPE_2016011518051300.csv >>> >>> <http://www.google.com/url?q=http%3A%2F%2F127.0.0.1%3A8000%2FPROVE%2Fdettaglio_aggiornamenti%2FSPE%2FSPE_2016011518051300.csv&sa=D&sntz=1&usg=AFQjCNFhQTgpGs53IZXyE2EC-KQWNkEvuw> >>> ? >>> >>> On Sunday, January 17, 2016 at 11:24:04 AM UTC-5, goome wrote: >>>> >>>> i have route_in that about this app has : >>>> ('/PROVE','/PROVE/default/index') >>>> >>>> Il giorno domenica 17 gennaio 2016 14:06:51 UTC+1, Niphlod ha scritto: >>>>> >>>>> are you using routes.py ? >>>>> >>>>> On Sunday, January 17, 2016 at 11:12:16 AM UTC+1, goome wrote: >>>>>> >>>>>> i have this url : >>>>>> http://127.0.0.1:8000/PROVE/dettaglio_aggiornamenti/SPE/SPE_2016011518051300.csv >>>>>> >>>>>> <http://www.google.com/url?q=http%3A%2F%2F127.0.0.1%3A8000%2FPROVE%2Fdettaglio_aggiornamenti%2FSPE%2FSPE_2016011518051300.csv&sa=D&sntz=1&usg=AFQjCNFhQTgpGs53IZXyE2EC-KQWNkEvuw> >>>>>> >>>>>> generated by: >>>>>> >>>>>> href="{{=URL(r=request,f='dettaglio_aggiornamenti',args=['SPE',ultimoFileSpe])}} >>>>>> i believed that >>>>>> request.args[0] == 'SPE' >>>>>> and >>>>>> request.args[1]== 'SPE_2016011518051300.csv' >>>>>> >>>>>> but i got : >>>>>> """ >>>>>> <type 'exceptions.IndexError'> list index out of range >>>>>> >>>>>> >>>>>> Function argument list >>>>>> >>>>>> () >>>>>> Code listing >>>>>> >>>>>> 1520. >>>>>> 1521. >>>>>> 1522. >>>>>> 1523. >>>>>> 1524. >>>>>> 1525. >>>>>> >>>>>> 1526. >>>>>> 1527. >>>>>> 1528. >>>>>> 1529. >>>>>> >>>>>> records=legacy_db(legacy_db.SFIMDB.filename==ufile).select() >>>>>> return dict(records=records) >>>>>> >>>>>> >>>>>> def dettaglio_aggiornamenti(): >>>>>> tab = request.args[0] >>>>>> >>>>>> b=request.args[1] >>>>>> >>>>>> >>>>>> >>>>>> Variables global request <Storage {'_vars': None, 'function': >>>>>> 'dettaglio_...marcello/CODE/MIEI/WEB2.10/applications/PROVE/'}> >>>>>> request.args [] tab undefined >>>>>> >>>>>> >>>>>> """ >>>>>> >>>>>> Why request.args turns to be undefined >>>>>> >>>>>> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.