Re: [web2py] Re: How to convert my view to pdf

2019-05-07 Thread jcrmatos
I have both ways in different apps. To save to a file use like this from xhtml2pdf.pisa import CreatePDF ... # Type is _io.BufferedWriter. with open(pdf_pn, 'wb') as f_out: # type: BinaryIO created_ok = CreatePDF(html, dest=f_out) To show the PDF on the browser use like this from io import

[web2py] Re: How to change the time zone in web2py under PythonAnywhere?

2019-05-07 Thread jcrmatos
I was able to solve it by adding time.tzset() after the os.environ["TZ"] = "Europe/Lisbon" in the wsgi configuration file (it's accessible in the Web tab). terça-feira, 7 de Maio de 2019 às 14:21:07 UTC+1, jcrm...@gmail.com escreveu: > > Hello, > > I was able to change the time zone of the conso

[web2py] Re: Error using auth.signature

2019-05-07 Thread jcrmatos
auth_signature creates these 4 fields: created_on created_by modified_on modified_by You are trying to access a field called dateofcreation which doesn't exist. In default\index replace dateofcreation with created_on. terça-feira, 7 de Maio de 2019 às 15:52:05 UTC+1, Fabio Gubler escreveu: > >

[web2py] How to change the time zone in web2py under PythonAnywhere?

2019-05-07 Thread jcrmatos
Hello, I was able to change the time zone of the consoles to UTC+1 in PythonAnywhere, but the web2py apps are still in UTC. Does anyone know how I can change make the web2py apps comply? I was told to add this os.environ["TZ"] = "Europe/Lisbon" to the start of wsgi adapter (located at /var/www)

[web2py] Re: When using the wizard to create an app it creates a security_key with a UUID. What is the purpose?

2019-05-07 Thread jcrmatos
Ok, thanks. terça-feira, 7 de Maio de 2019 às 04:17:42 UTC+1, Massimo Di Pierro escreveu: > > The wizard is not very well maintained but the uuid is useful. You can use > it for example to encrypt sessions. > > > On Monday, 6 May 2019 10:28:57 UTC-7, jcrm...@gmail.com > wrote: >> >> Hello, >>

[web2py] Re: Web3py

2019-05-06 Thread jcrmatos
My 2c You could call it web2py3 with this logic web2py was web for Python (at the time it was Python 2.x) web2py3 will the web for Python 3. sábado, 20 de Abril de 2019 às 16:32:10 UTC+1, Massimo Di Pierro escreveu: > > web2.py existed before web2py and did not hurt us. > web3py existed before w

[web2py] When using the wizard to create an app it creates a security_key with a UUID. What is the purpose?

2019-05-06 Thread jcrmatos
Hello, When using the wizard to create a new app it creates a settings.security_key with a UUID. What is the purpose of this security key? If I create an app using the Create new app instead of using the Wizard this is not created. Is this normal? Thanks, JM -- Resources: - http://web2py.co

[web2py] Re: I would like to log of all SQL commands web2py sends to SQLite. Is it possible?

2019-05-05 Thread jcrmatos
Just to give you some feedback, I tried adding debug=True to the DAL command and creating a pyDAL logger. Nothing is shown in the logging file. It gets created (so the logging is working) but nothing shows up. Also tried pydal instead of pyDAL as the name of the logger with the same result. do

[web2py] Re: gmail unable to send email

2019-05-05 Thread jcrmatos
I have this in my appconfig.ini and it works. ; smtp address and credentials[smtp] server = smtp.gmail.com:587 sender = my_em...@gmail.com login = my_em...@gmail.com:my_pwd tls= true ssl= true domingo, 5 de Maio de 2019 às 10:26:40 UTC+1, mostwanted escreveu: > > I have been using gmail

[web2py] Re: How to pass a query set string or a string with a select/count to be executed in another controller?

2019-05-04 Thread jcrmatos
I forgot to say on the previous message that if you need I can show you the code. sábado, 4 de Maio de 2019 às 16:19:42 UTC+1, Anthony escreveu: > > In each controller: > > from mymodule import shared_function > rows = shared_function(pass, some, args) > > Not clear why you instead need to use t

[web2py] Re: How to pass a query set string or a string with a select/count to be executed in another controller?

2019-05-04 Thread jcrmatos
Let me explain the scenario. I have several pairs of controllers/views (eg. opt, opt_cat, equip) that each manage a single table because they have different characteristics. And I have several pairs of controllers/views that are shared (eg. single_equip and table_management) and manage several

[web2py] Re: How to convert my view to pdf

2019-05-03 Thread jcrmatos
I use xhtml2pdf. quarta-feira, 14 de Novembro de 2018 às 10:52:36 UTC, mostwanted escreveu: > > I have been researching this topic alot because i am trying to achieve > this, i want to convert my view exactly as it to PDF, i came across some > information on web2py-appreport but I don't underst

[web2py] Re: How to pass a query set string or a string with a select/count to be executed in another controller?

2019-05-03 Thread jcrmatos
That was what I was trying to do. The problem is that the queries that were going to be executed in the destination (shared function) vary according to the requesting controller. The query string passed through the session would solve this, but because the only way to execute it in the destinati

[web2py] Re: Unable to redirect to another page from ondelete

2019-05-03 Thread jcrmatos
Have to use redirect(URL(..), client_side=True) domingo, 10 de Março de 2019 às 14:20:39 UTC, João Matos escreveu: > > Hello, > > I'm unable to redirect to another page from a grid's ondelete. > I have this grid in the index function of a controller > > grid: DIV = SQLFORM.grid( >

[web2py] Re: Checkboxes are shown without space between checkbox and label

2019-05-03 Thread jcrmatos
Found a kludge. # Fix the lack of space between the checkbox and the label. # The ' ' below is not a space but chr(255). rows_lst = [(key, ' ' + value) for key, value in rows_lst] quarta-feira, 20 de Março de 2019 às 09:30:08 UTC, João Matos escreveu: > > Hello, > > When

[web2py] Re: Grid sorting bug when default orderby column type is date

2019-05-03 Thread jcrmatos
It was confirmed to be a bug in web2py and it is now corrected. quinta-feira, 28 de Março de 2019 às 18:41:59 UTC, João Matos escreveu: > > Hello, > > I have this action > > @auth.requires(auth.has_membership(CHECKER_ROLE) or auth.has_membership( > SUPERVISOR_ROLE)) > def list_tags_to_issue(): >

[web2py] Re: How to pass a query set string or a string with a select/count to be executed in another controller?

2019-05-03 Thread jcrmatos
request.args[0] from the destination request. Yes, eval is the only way to solve this, but because it is so dangerous, I dismissed the idea. The original idea was to have a shared function (in another controller) that would be used by several controllers, each with specific queries that would b

[web2py] Re: How to pass a query set string or a string with a select/count to be executed in another controller?

2019-05-02 Thread jcrmatos
Can't do that. As I told you the query has to be executed on the destination. quinta-feira, 2 de Maio de 2019 às 01:01:01 UTC+1, Dave S escreveu: > > > > On Wednesday, May 1, 2019 at 2:47:53 PM UTC-7, jcrm...@gmail.com wrote: >> >> Yes, I read it.. >> >> If you try to save it on a session var (to

[web2py] Re: How to pass a query set string or a string with a select/count to be executed in another controller?

2019-05-01 Thread jcrmatos
Yes, I read it.. If you try to save it on a session var (to pass between requests) it will return a pickling error (or not), depending on the query. I tried to save this db.equipment.sn_counter_id == request.args[0] and it returns a pickling error. Probably because of request.args[0]. quarta-f

[web2py] Re: How to pass a query set string or a string with a select/count to be executed in another controller?

2019-05-01 Thread jcrmatos
What do you mean? I don't want to serialize the query. And I want the query to only be executed on the desalination controller. quarta-feira, 1 de Maio de 2019 às 22:00:27 UTC+1, Dave S escreveu: > > > > On Wednesday, May 1, 2019 at 1:53:25 PM UTC-7, jcrm...@gmail.com wrote: >> >> Got the answer

[web2py] Re: How to pass a query set string or a string with a select/count to be executed in another controller?

2019-05-01 Thread jcrmatos
Got the answer in the Telegram chat. Using eval. It's a dangerous solution but works. quarta-feira, 1 de Maio de 2019 às 10:07:45 UTC+1, jcrm...@gmail.com escreveu: > > Hello, > > How to pass a query set string or a string with a select/count to be > executed in another controller? > > On one c

[web2py] How to pass a query set string or a string with a select/count to be executed in another controller?

2019-05-01 Thread jcrmatos
Hello, How to pass a query set string or a string with a select/count to be executed in another controller? On one controller I create one of these 4 examples: session.checks = [ 'db(db.equipment.sn_counter_id == request.args[0]).count()', T('Cannot be deleted while assigned to a

[web2py] Strange AttributeError on grid edit

2019-04-30 Thread jcrmatos
Hello, I have this grid: grid = SQLFORM.grid( query, create=create, csv=False, deletable=deletable, details=False, editable=editable, # Disable delete checkbox in edit form. editargs=dict(deletable=False), field_id=db.equi

[web2py] Re: Grid search and clear buttons don't restore request.args. Where can I correct that?

2019-04-30 Thread jcrmatos
Found the solution. I have to add args=request.args[:1], to the child grid. terça-feira, 30 de Abril de 2019 às 00:37:24 UTC+1, Anthony escreveu: > > What do you mean by master-child pages? Are you using smartgrid? Can you > show some code? > > On Monday, April 29, 2019 at 6:15:30 PM UTC-4, jcrm

[web2py] Re: Grid search and clear buttons don't restore request.args. Where can I correct that?

2019-04-30 Thread jcrmatos
Just noticed now that both search and clear search buttons URLs also remove the search=1 var, but maintain the sid var. Strange isn't it? terça-feira, 30 de Abril de 2019 às 00:37:24 UTC+1, Anthony escreveu: > > What do you mean by master-child pages? Are you using smartgrid? Can you > show som

[web2py] Re: Grid search and clear buttons don't restore request.args. Where can I correct that?

2019-04-30 Thread jcrmatos
I have a master page (in this case an equipment's grid) where I have links to child tables. The URL for the equipment's page is http: //jmatos-p:8000/equipment?search=1&sid=d4b3d39a-b6bc-4c41-af05-d2e9bf7ea195 In this page the search and clear search buttons work fine and show the correct URLs,

[web2py] Re: Grid search collects all records from all fields on each request. Isn't this bad for performance?

2019-04-30 Thread jcrmatos
Ok, thanks Anthony. terça-feira, 30 de Abril de 2019 às 00:34:10 UTC+1, Anthony escreveu: > > On Monday, April 29, 2019 at 6:22:26 PM UTC-4, jcrm...@gmail.com > wrote: >> >> Grid search collects all records from all fields on each request. Isn't >> this bad for performance? >> > > Are you refer

[web2py] Re: Grid sorting sorts by id (in case of a FK) instead of shown value (eg. name). Is this normal?

2019-04-29 Thread jcrmatos
So the only way to correct it is the way I used. Thanks Anthony. segunda-feira, 29 de Abril de 2019 às 23:56:18 UTC+1, Anthony escreveu: > > Yes. It shows the values from the foreign table via "recursive selects" > (i.e., a separate query for each displayed row after the initial set of > records

[web2py] Grid sorting sorts by id (in case of a FK) instead of shown value (eg. name). Is this normal?

2019-04-29 Thread jcrmatos
Grid sorting sorts by id (in case of a FK) instead of shown value (eg. name). Is this normal? The only way I found to correct this behavior was to change the grid's table to a query, where in this query I include all the foreign fields (eg. name) directly and remove al the foreign keys. Is this

[web2py] Grid search collects all records from all fields on each request. Isn't this bad for performance?

2019-04-29 Thread jcrmatos
Grid search collects all records from all fields on each request. Isn't this bad for performance? Isn't it possible to change this behavior to only load the records when the user selects a specific field to do the search? -- Resources: - http://web2py.com - http://web2py.com/book (Documentatio

[web2py] Grid search and clear buttons don't restore request.args. Where can I correct that?

2019-04-29 Thread jcrmatos
Grid search and clear buttons don't restore request.args. Where can I correct that? If using master-child pages, the master grid search works fine (because there are no request.args), but the child grid (which has request.args, from the master record) doesn't because the search and clear but

[web2py] Re: How to build onvalidation routine for unique within location

2019-04-26 Thread jcrmatos
Replace you model with this db.define_table('brix_test', Field('site', 'reference site', requires=IS_IN_DB(db, 'site', '%(siteNumber)s - %(name)s', zero='..')), Field('mixer_tech', 'reference mixerTech', requires=I

[web2py] Re: datepicker preserve selecred date after postback

2019-04-26 Thread jcrmatos
I don't know much js, but where is the submit/save button/function? sexta-feira, 26 de Abril de 2019 às 11:19:19 UTC+1, Andrea Fae' escreveu: > > Thank you for your answer, but I do not understand the code you wrote... > the 2 fields are only filtering fields, no a db field. > > The filtering fie