[web2py] Re: link to a grid
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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] link to a grid
The error message is simple, you don't have a controller function named static in you default controller file... Richard On Thu, May 10, 2018 at 6:59 AM, 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) > > > 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 web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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.
[web2py] Error in mysql connection
Hi all, I am facing some issue to connect to the database with password including '@' symbol. without including '@' symbol in the password, it works. Is this a bug or am I missing something mysql://root:pass@123@localhost/csautomation It workes for following string: mysql://root:pass123@localhost/csautomation Traceback Failure to connect, tried 5 times: Traceback (most recent call last): File "C:\Users\Admin\PycharmProjects\MainApp\web2py\gluon\packages\dal\pydal\base.py", line 454, in __init__ self._adapter = adapter(**kwargs) File "C:\Users\Admin\PycharmProjects\MainApp\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 40, in __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) File "C:\Users\Admin\PycharmProjects\MainApp\web2py\gluon\packages\dal\pydal\adapters\base.py", line 368, in __init__ super(SQLAdapter, self).__init__(*args, **kwargs) File "C:\Users\Admin\PycharmProjects\MainApp\web2py\gluon\packages\dal\pydal\adapters\base.py", line 52, in __init__ self.reconnect() File "C:\Users\Admin\PycharmProjects\MainApp\web2py\gluon\packages\dal\pydal\connection.py", line 172, in reconnect self.connection = self.connector() File "C:\Users\Admin\PycharmProjects\MainApp\web2py\gluon\packages\dal\pydal\adapters\mysql.py", line 52, in connector return self.driver.connect(**self.driver_args) File "C:\Users\Admin\PycharmProjects\MainApp\web2py\gluon\contrib\pymysql\__init__.py", line 90, in Connect return Connection(*args, **kwargs) File "C:\Users\Admin\PycharmProjects\MainApp\web2py\gluon\contrib\pymysql\connections.py", line 688, in __init__ self.connect() File "C:\Users\Admin\PycharmProjects\MainApp\web2py\gluon\contrib\pymysql\connections.py", line 937, in connect raise exc OperationalError: (2003, "Can't connect to MySQL server on '123@localhost' ([Errno 11003] getaddrinfo failed)") -- 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.
[web2py] link to a grid
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) 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.