[web2py] Re: how to format JSON data?

2016-06-08 Thread Anthony
Make sure you're doing something like: var roots = {{=XML(json_list)}} where json_list is the output of json.dumps(). And don't put any quotes around the entire JSON string -- in Javascript, it is not a string but an object. Anthony On Wednesday, June 8, 2016 at 10:41:02 PM UTC-4, Alex

[web2py] Re: how to format JSON data?

2016-06-08 Thread Anthony
No need for the separate function (that function does nothing but simply return the same thing we already had). Anyway, the resulting JSON is just a string -- pass it to the view the same way you pass anything to the view -- as one of the items in the dictionary that the controller returns.

[web2py] Re: how to format JSON data?

2016-06-08 Thread Alex Glaros
anyone see anything wrong with this latest output? still getting: *Uncaught SyntaxError: Unexpected token &* is the first quote a problem? "[{\"parentId\": 2, \"key\": 16, \"title\": \"Defense and National Security\"}, {\"parentId\": 2, \"key\": 4, \"title\": \"State\"}, {\"parentId\": 2,

[web2py] Re: how to format JSON data?

2016-06-08 Thread Dave S
On Wednesday, June 8, 2016 at 3:09:11 PM UTC-7, Alex Glaros wrote: > > Anyone have any ideas? > > I cannot get the json formated data to get passed to view. > > Also tried creating separate controller. (Note isolated by itself, > json.dumps(json_list) works to format the data correctly.) >

[web2py] Re: how to format JSON data?

2016-06-08 Thread Alex Glaros
Anyone have any ideas? I cannot get the json formated data to get passed to view. Also tried creating separate controller. (Note isolated by itself, json.dumps(json_list) works to format the data correctly.) def output_json(json_list): import json return json.dumps(json_list) call

[web2py] migrate uwsgi + nginx --> twisted

2016-06-08 Thread Mark Graves
Hey everyone, I am migrating an app from uwsgi + nginx to twisted. I've read the docs and can get it started on my local machine. Now, I'm putting it on a separate box. Does anyone have a service startup script that they would mind sharing? Otherwise, any recommendations for further reading?

[web2py] Re: MySQL connection error after scheduled task completes

2016-06-08 Thread Andre
More information just tried initializing the DAL with pg8000 and things appear to be working. This points to an issue with psycopg2 (or at least the version that PythonAnywhere has installed) On Wednesday, June 8, 2016 at 3:50:42 PM UTC-4, Andre wrote: > > Okay, fair enough. > > Along with

[web2py] Re: MySQL connection error after scheduled task completes

2016-06-08 Thread Andre
Okay, fair enough. Along with the errors I posted earlier (related to Postgres), I also noticed that when I try to access the scheduler_worker table I get the following error: Traceback (most recent call last): File "/home/wdis/web2py/applications/wdis/controllers/appadmin.py", line 252,

[web2py] Save Full Calendar event to Mysql

2016-06-08 Thread Jeff Riley
Hello all. Has anyone figured out how to save a Jquery Full Calendar event to their Mysql database? I know I should use the Ajax function, but I am not seeing how to get the information from the Full Calendar jquery event dialog. -- Resources: - http://web2py.com - http://web2py.com/book

[web2py] Re: MySQL connection error after scheduled task completes

2016-06-08 Thread Niphlod
sqlite is the worst choice for concurrency, which scheduler is quite all about. I'd investigate further on the path of pythonanywhere's postgresql not being viable, mostly because it seems that psycopg2 is a "battery included" library. On Wednesday, June 8, 2016 at 3:55:30 PM UTC+2, Andre

[web2py] Re: how to format JSON data?

2016-06-08 Thread Alex Glaros
how to get the return json.dumps(json_list) output to the view? The view is expecting other vars besides json_list. tried a sub-function: for r in new_roots: json_list.append(dict(title=r.taxonomy_column_name, key=r.id, parentId=2)) def output_json(json_list):

[web2py] Re: how to format JSON data?

2016-06-08 Thread Anthony
Why not: json_list.append(dict(title=r.taxonomy_column_name, key=...)) ... return json.dumps(json_list) Anthony On Wednesday, June 8, 2016 at 12:28:27 PM UTC-4, Alex Glaros wrote: > > so would code look like this? want to know if I'm going in the right > general direction... > >

[web2py] Re: how to format JSON data?

2016-06-08 Thread Alex Glaros
does this output look right? am still getting javaScript error: Uncaught SyntaxError: Unexpected token & ["{\"title\": \"Defense and National Security\", \"key\":16, \"parentId\":2, \"folder\": false, \"lazy\": true},", "{\"title\": \"State\", \"key\":4, \"parentId\":2, \"folder\": false,

[web2py] Re: how to format JSON data?

2016-06-08 Thread Alex Glaros
so would code look like this? want to know if I'm going in the right general direction... json_list = [] for r in new_roots: json_list.append('{"title": ' + '"' + r.taxonomy_column_name + '"' + ', "key":' ...etc...}') Also, thanks for catching the id error --

[web2py] Re: SELECT without duplicates for a specific field

2016-06-08 Thread Anthony
You could do a simple groupby if you don't care which record is retained. Anthony On Wednesday, June 8, 2016 at 10:10:33 AM UTC-4, Gael

[web2py] SELECT without duplicates for a specific field

2016-06-08 Thread Gael Princivalle
Hello. Is there a way to select some rows without duplicates for a specific field ? MODEL: db.define_table('products'): Field('code', type='string'), Field('category_code', type='integer')) ROWS: code / category_code A1125 / 3 C2214 / 2 D235 / 3 Z886 / 1 I would like to make a select

[web2py] Re: MySQL connection error after scheduled task completes

2016-06-08 Thread Andre
I was not able to get the scheduler to work with Postgres so I tried using SQLite and it seems to work! So moving forward I'll try using two databases: SQLite for the scheduler and MySQL for everything else. As a side note, I'm not quite sure why Postgres did not work. I tried clearing out

[web2py] Re: how to format JSON data?

2016-06-08 Thread Anthony
On Wednesday, June 8, 2016 at 4:00:48 AM UTC-4, Alex Glaros wrote: > > I cannot make JSON data correctly. (The result of below has duplicate data > with the word > result = dict() > for r in new_roots: >result[r] = '{"title": ' + '"' + r.taxonomy_column_name + '"' + ', > "key":' +

[web2py] Re: The built-in web2py wiki error

2016-06-08 Thread Mirek Zvolský
now merged in trunk Dne úterý 7. června 2016 15:03:42 UTC+2 Mirek Zvolský napsal(a): > > It really looks like this is broken with some new commit. > > In 2.14.5 I have - gluon/tools.py 6476-6478 > gid = group.id if group else db.auth_group.insert( >

[web2py] Re: bug web2py ticket json

2016-06-08 Thread Alessio Varalta
Ok I make in these days On Saturday, 4 June 2016 17:47:34 UTC+2, Massimo Di Pierro wrote: > > Can you please open a ticket and provide a minimal example of a controller > to reproduce? > > > On Monday, 30 May 2016 04:15:41 UTC-5, Alessio Varalta wrote: >> >> Hi, I notice a big problem with the

[web2py] how to format JSON data?

2016-06-08 Thread Alex Glaros
I cannot make JSON data correctly. (The result of below has duplicate data with the word : '{"title": "Battlespace Networks", "key":18, "parentId":2, "folder": false, "lazy": true},', : '{"title": "Municipality", "key":26, "parentId":2, "folder": false, "lazy": true},', : '{"title": "Service

Re: [web2py] Re: multi component form loaded in the same page

2016-06-08 Thread Manuele Pesenti
Il 07/06/16 22:25, Niphlod ha scritto: > for future lurkers of threads, posting the code, or even better a > minimal app, it's not something Anthony (or the occasional helper) > asks for his own amusement...that simple requirement forces your brain > to reevaluate all the steps, in a clean