The signature of the URL function is URL(a, c, f). If you pass only two
arguments, it assumes they are c and f, and if you pass only one, it
assumes it is f. You passed only 'static/Etichette', so it assumes that is
the function and therefore uses the current application and controller. It
should instead be:
URL('static', 'Etichette', args=[row.etichetta])
'static' is a special value for the controller.
Anthony
On Thursday, May 10, 2018 at 6:59:45 AM UTC-4, Andrea Fae' wrote:
>
> Hello I have a grid with certain fields.
> In a filed there is a name of a pdf file that I have in the folder
> "static/Etichette". I have a lot of pdf file in this folder and I'd like,
> when I click this link, to open the related file...
>
> This is the grid
> grid = SQLFORM.grid(db.socio, links = [lambda row: A('Etichetta',
> _href=URL('static/Etichette', args=[row.etichetta]))], details=False,
> create=False, editable=False, deletable=False, maxtextlength=40)
>
> or
>
> grid = SQLFORM.grid(db.socio, links = [lambda row: A('Etichetta',
> _href=URL("static/Etichette/%s" % row.etichetta))], details=False,
> create=False, editable=False, deletable=False, maxtextlength=40)
>
>
> This is the table
>
> db.define_table('socio',
> Field('codice', type='integer', requires=[IS_NOT_EMPTY()]),
> Field('cognome', requires=[IS_NOT_EMPTY()]),
> Field('nome', requires=[IS_NOT_EMPTY()]),
> Field('intestazione', requires=[IS_NOT_EMPTY()]),
> Field('dnascita', requires=[IS_NOT_EMPTY()]),
> Field('indirizzo', requires=[IS_NOT_EMPTY()]),
> Field('cap', requires=[IS_NOT_EMPTY()]),
> Field('comune', requires=[IS_NOT_EMPTY()]),
> Field('provincia', requires=[IS_NOT_EMPTY()]),
> Field('telefono', requires=[IS_NOT_EMPTY()]),
> Field('codfisc', requires=[IS_NOT_EMPTY()]),
> Field('etichetta'),
>
> auth.signature,singular="Socio",plural="Soci",migrate='socio.table',
> format='%(intestazione)s')
>
> How can I do?
>
> I have this error
> invalid function (default/static)
>
> Yes...I know that there is something wrong but I don't know in this moment
> what...
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.