[web2py] Re: response.js after redirect

2017-06-29 Thread Filipe Reis
Ohh nice thinking, I forgot that I could do such thing :) Anyways I asked this in other thread but do you know something about this? How to use signature with web2py_component? (I changed web2py_ajax_page to web2py_component since I saw that this calls the ajax_page) So when a request is done

[web2py] Re: JSON field with MySQL database

2017-06-29 Thread Anthony
On Thursday, June 29, 2017 at 12:49:16 PM UTC-4, narcissus wrote: > > Thanks for your answer. > Option 1) In my case I cannot change fields into the original database. > Option 2) and 3) can you provide implementation examples for my specific > case > I'm not familiar with how MySQL JSON fields

[web2py] Re: response.js after redirect

2017-06-29 Thread Anthony
You don't need to do it that way. Just import json -- see https://groups.google.com/d/msg/web2py/9WnoALNHxTI/54cTUgHNBgAJ. Anthony On Thursday, June 29, 2017 at 12:36:42 PM UTC-4, Filipe Reis wrote: > > Got it all working now. It was a problem with using response.json to parse > the flash

[web2py] Re: Advice needed on complex SQL operation

2017-06-29 Thread Karoly Kantor
Thank you, that looks helpful, I will start along these lines. I have some questions, though: 1. Will this work if more than one fields are set to "group"? 2. What's up with count, does it ever make sense to have more than one field set to "count", and if yes, what would be the difference

Re: [web2py] Re: web2py.component equivalent for =LOAD

2017-06-29 Thread Filipe Reis
By any chance did you understand how to use signature with web2py_component? So when a request is done to the page it only shows if was triggered the that call only. This is what I think that @auth.requires_signature() doe -- Resources: - http://web2py.com - http://web2py.com/book

Re: [web2py] Re: web2py.component equivalent for =LOAD

2017-06-29 Thread Filipe Reis
By any chance did you understand how to use signature with web2py_component? So when a request is done to the page it only shows if was triggered the that call only. This is what I think that @auth.requires_signature() does. -- Resources: - http://web2py.com - http://web2py.com/book

[web2py] Re: JSON field with MySQL database

2017-06-29 Thread narcissus
Thanks for your answer. Option 1) In my case I cannot change fields into the original database. Option 2) and 3) can you provide implementation examples for my specific case Option 4) I think I'll do it Il giorno giovedì 29 giugno 2017 15:23:37 UTC+2, Anthony ha scritto: > > In most databases

[web2py] Re: response.js after redirect

2017-06-29 Thread Filipe Reis
Got it all working now. It was a problem with using response.json to parse the flash message. To future reference this is how it is: var w2p_flash = {{=XML(response.flash) if response.flash else 'null'}}; if (w2p_flash) { var w2p_flash = jQuery.parseJSON(JSON.stringify(w2p_flash));

[web2py] Re: response.js after redirect

2017-06-29 Thread Filipe Reis
Yeah that did it, however still getting the same issue: Resource interpreted as Document but transferred with MIME type application/json. This is for sure happening when using the session.flash with a dict. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Re: response.js after redirect

2017-06-29 Thread Anthony
Try wrapping it in XML(): var w2p_flash = {{=XML(response.json(response.flash)) if response.flash else 'null'}}; Anthony On Thursday, June 29, 2017 at 11:25:20 AM UTC-4, Filipe Reis wrote: > > Was looking better it seems that this is a problem with how response.flash > passes the value. > >

[web2py] Re: Totally app-internal routing

2017-06-29 Thread Anthony
You need to have at least a basic routes.py in the root /web2py folder, but for application specific routing, you can also put a routes.py file in the application folder (i.e., in /web2py/applications/myapp/). If you are using the pattern-based rewrite system, you'll need to use routes_app in

[web2py] Re: response.js after redirect

2017-06-29 Thread Filipe Reis
Was looking better it seems that this is a problem with how response.flash passes the value. var w2p_flash = {message: New client inserted into database., options: {theme: lime, heading: Success}}; This is how the flash is passed to the view, is there any way to get it right with " instead

[web2py] Re: Violating unique constraint in Field doesn't go to standard 500 page

2017-06-29 Thread Anthony
Have you specified routes_onerror? If so, what does that code look like? It looks like your error handler itself may be generating an error. Anthony On Thursday, June 29, 2017 at 9:42:42 AM UTC-4, Chris wrote: > > Hello! > > I'm running 2.14.6-stable+timestamp.2016.05.10.00.21.47 and have hit

[web2py] Re: response.js after redirect

2017-06-29 Thread Anthony
You can instead put that code in the view of the controller. If you need it across multiple actions, just create a separate view template for it and use {{include ...}} to include it wherever needed. Anthony On Thursday, June 29, 2017 at 9:25:00 AM UTC-4, Filipe Reis wrote: > > Thanks for your

[web2py] SQLFORM.grid with selectable checkboxes that export CSV files on submit

2017-06-29 Thread 'Matthew J Watts' via web2py-users
Hi all I'm trying to modify an SQLFORM.grid so it has selectable check boxes, which allow the user to download selected queries as CSV files once the submit button has been clicked. Can anyone help me with this? Thanks in advance Matt -- Resources: - http://web2py.com -

Re: [web2py] Re: Broken pipe with mysql

2017-06-29 Thread Richard Vézina
Hello Alexia, This is a pretty old thread : https://groups.google.com/d/msg/web2py/Iu36WNoWkX4/bgIob2R6UjsJ I suggest you to open another one... And tell us more on the issue you experiment, we don't have enough informaiton (traceback, setup, web2py version, os, etc) to help. Since 2011 web2py

Re: [web2py] Violating Unique constraint in field doesn't go to standard 500 page

2017-06-29 Thread Richard Vézina
Which web2py version? Which database/adapter?? But I think for unique=True you shouldn't have this error at least if you had also implement a validator IS_NOT_IN_DB()... unique=True tell the database to implement unique constrain, but you have to tell the front end (IS_NOT_IN_DB()) too... I use

[web2py] Violating Unique constraint in field doesn't go to standard 500 page

2017-06-29 Thread Chris
Hello! I'm running 2.14.6-stable+timestamp.2016.05.10.00.21.47 and have hit this issue: If I have a Field where unique=True, inserting a row with a duplicate Field value triggers the constraint, as expected. However, the error does not lead to a page linking to a ticket, but instead to a

[web2py] Re: response.js after redirect

2017-06-29 Thread Filipe Reis
Thanks for your time, this seems to be a solution to exactly what I want however when I try to implement it I get this error: Resource interpreted as Document but transferred with MIME type application/json Should this be a problem because I am including the web2py javascript also? It needs to

[web2py] Re: JSON field with MySQL database

2017-06-29 Thread Anthony
In most databases (including MySQL), the DAL simply stores JSON in a text field and converts to and from Python objects when writing/reading the data. The Postgres adapter makes use of the Postgres native JSON field type, but the MySQL adapter does not yet do so. Some options might be to

Re: [web2py] Re: function lazy_user at ...

2017-06-29 Thread António Ramos
Solved again... Thank you 2017-06-29 14:03 GMT+01:00 Anthony : > if not *record["created_by"]()* in ret: >> ret.append(*record["created_by"]()*) >> >> > That's different from the code you showed earlier. Probably you should > just do something like this: > >

[web2py] JSON field with MySQL database

2017-06-29 Thread narcissus
Hi, I've created a database model containing a field of type json to access a pre-existent MySQL database (created with mysql server version > 5.7.11) containing the same field of type json into the same table. I cannot understand why the json data stored into the database are read always as

Re: [web2py] Re: function lazy_user at ...

2017-06-29 Thread Anthony
> > if not *record["created_by"]()* in ret: > ret.append(*record["created_by"]()*) > > That's different from the code you showed earlier. Probably you should just do something like this: created_by = record['created_by'] created_by = created_by() if callable(created_by) else

[web2py] Re: response.js after redirect

2017-06-29 Thread Anthony
Are you using this notification plugin for all flash messages on your site? If so, why not just incorporate it into the layout and use response.flash (and session.flash) as usual? In the layout, you could have something like: $.notific8('{{=response.flash}}'); If you need to pass in options

Re: [web2py] Re: function lazy_user at ...

2017-06-29 Thread António Ramos
Aparently not solved... *function lazy_user at 0x2d82a28* disappears but the field authors does not update anymore if i go to admin to save a record i get this error if not record["created_by"]() in ret: TypeError: 'int' object is not callable this is my new code def get_userIds(rule):

[web2py] Re: Advice needed on complex SQL operation

2017-06-29 Thread tim . nyborg
Below is something similar I've been playing with. The interface is utter garbage, but it shows the general idea. A form that allows you to select fields and aggregation per field: Manage a list of queries fields, adding in the field or its .sum() or .count() method as necessary. Where

[web2py] response.js after redirect

2017-06-29 Thread Filipe Reis
Hello, I was wondering if someone could help me in figuring this out. I have a view that when the user click on a button opens a modal with a insertion form. I'm calling it by doing this way: web2py_ajax_page("GET", url, "", target); url - being the url like /house/create target - being the

Re: [web2py] Re: function lazy_user at ...

2017-06-29 Thread António Ramos
Solved. Thank you again Anthony 2017-06-28 19:21 GMT+01:00 Anthony : > In auth.signature, the "created_by" field has a "default" attribute, which > is a function (called "lazy_user") that returns auth.user_id. At the point > at which the value of the compute field is