Re: [web2py] Re: Moving away from define_table

2012-05-11 Thread Johann Spies
On 10 May 2012 22:10, Anthony abasta...@gmail.com wrote: You can turn off migrations globally for the entire db connection via DAL(..., migrate_enabled=False). Anthony p.s., Even people with a programming background find the DAL useful. :-) I agree. It is useful, but also limiting: e.g.

Re: [web2py] Load data from sqlite file?

2012-05-11 Thread Johann Spies
On 11 May 2012 01:38, Dave davidramsayreinh...@gmail.com wrote: Any examples or suggestions on how to load data from a user-uploaded .sqlite database? I will have the database structure of the uploaded files ahead of time (they are being generated by a mobile app), so I need a way to

Re: [web2py] Need a little help in code review (a function eating up all memory)

2012-05-11 Thread szimszon
The problem is not that if I call the controller function if consumes memory. My problem is that there is something that still reference something after the execution is finished so the consumed memory never get released / reused... 2012. május 10., csütörtök 23:27:32 UTC+2 időpontban

Re: [web2py] Need a little help in code review (a function eating up all memory)

2012-05-11 Thread szimszon
OK. Finally I have it :) It was only the amount of memory it was consumed each time. I tried it with a smaller but a significant number of records and finally I figured out that there is a limit and after that memory consumption is ok. I had only reach that count of browser request :-D Sorry

Re: [web2py] Need a little help in code review (a function eating up all memory)

2012-05-11 Thread szimszon
I had only to reach that count of browser request :-D

[web2py] Changing the controller on the fly

2012-05-11 Thread Michael Toomim
I need to be able to dispatch to a different controller based on a database lookup. So a user will go to a url (say '/dispatch'), and we'll look up in the database some information on that user, choose a new controller and function, and call that controller and function with its view. I've

[web2py] Re: Changing the controller on the fly

2012-05-11 Thread simon
You can do: def dispatch(): controller,function = ... load these from the database ... redirect(URL(c=controller, f=function, vars=request.vars, args=request.args)) On Friday, 11 May 2012 10:17:19 UTC+1, Michael Toomim wrote: I need to be able to dispatch to a different

[web2py] Re: Load data from sqlite file?

2012-05-11 Thread simon
http://web2py.com/books/default/chapter/29/6#Legacy-databases-and-keyed-tables On Friday, 11 May 2012 00:38:41 UTC+1, Dave wrote: Any examples or suggestions on how to load data from a user-uploaded .sqlite database? I will have the database structure of the uploaded files ahead of time

[web2py] Re: MongoDB Adapter error in select

2012-05-11 Thread Francisco Costa
Thanks Massimo. Please let me know if you need more help in debugging it On Friday, May 11, 2012 12:40:35 AM UTC+1, Massimo Di Pierro wrote: Now I understand better where all these problems come from. I shall fix it tonight. On Thursday, 10 May 2012 18:02:24 UTC-5, Francisco Costa wrote:

[web2py] No error_message displayed when using IS_LIST_OF(IS_ALPHANUMERIC()) validator

2012-05-11 Thread François Delpierre
Hi, I have no error message when I wrongly fill a list with spaces / special characters. However the validator works, as I need to respect it to update the record. db.define_table('parameter', Field('allowed_users', type='list:string'), ) db.parameter.allowed_users.requires =

[web2py] Re: SQLFORM.smartgrid : error when setting fields to be displayed as a fields dictionary.

2012-05-11 Thread François Delpierre
Sorry Massimo, I didn't found any Bug Reporting Tool on the web2py web site or on the presentation message of this list. Where can I report the bug ? Thanks, Le jeudi 10 mai 2012 02:08:31 UTC+2, François Delpierre a écrit : Hi, When I try to select the fields to be displayed as follow :

[web2py] [Fixed] SQLFORM.smartgrid : error when setting fields to be displayed as a fields dictionary.

2012-05-11 Thread François Delpierre
Le jeudi 10 mai 2012 02:08:31 UTC+2, François Delpierre a écrit : Hi, When I try to select the fields to be displayed as follow : form = SQLFORM.smartgrid( db.t_xlsfile, fields=dict( t_xlsfile=[ db.t_xlsfile.f_xlsfile,

[web2py] Re: problem related to GAE server

2012-05-11 Thread Prakhar Srivastava
I don't i can say this problem but in GAE it accept only .png file and other expect .jpg i don't get the perfect solution. On Thursday, 10 May 2012 11:33:17 UTC+5:30, Prakhar Srivastava wrote: what is the max image size we can upload through the img tag ? Because my application is working

[web2py] Re: GAE

2012-05-11 Thread Prakhar Srivastava
I can't say this problem solve but in GAE it accept only .png file and other expect .jpg i don't get the perfect solution. On Thursday, 10 May 2012 12:06:08 UTC+5:30, Prakhar Srivastava wrote: when i upload my application this waring come up 2012-05-09 23:02:24.992

[web2py] Re: Changing the controller on the fly

2012-05-11 Thread Anthony
Or to avoid a redirect, you can change the function and controller in a model file: db = DAL(...) if request.function == 'dispatch': request.controller, request.function = [fetch from db] response.view = '%s/%s.%s' % (request.controller, request.function,request .extension)

[web2py] Re: [Fixed] SQLFORM.smartgrid : error when setting fields to be displayed as a fields dictionary.

2012-05-11 Thread Niphlod
here http://code.google.com/p/web2py/issues/list Il giorno venerdì 11 maggio 2012 13:32:21 UTC+2, François Delpierre ha scritto: Le jeudi 10 mai 2012 02:08:31 UTC+2, François Delpierre a écrit : Hi, When I try to select the fields to be displayed as follow : form =

[web2py] To uuid or not?

2012-05-11 Thread Johann Spies
I developed my original app to use uuid-crossreferences in stead of the normal 'id'-field. The reason was that I wanted it to be consistent when I move the database to another computer. Now I am rewriting the app to make it more efficient and to make the code cleaner - applying some new features

[web2py] colorific

2012-05-11 Thread Massimo Di Pierro
This may be useful to automate css creation form logo images: http://99designs.com/tech-blog/blog/2012/05/11/color-analysis/

[web2py] Re: No error_message displayed when using IS_LIST_OF(IS_ALPHANUMERIC()) validator

2012-05-11 Thread Anthony
Yes, this is a known issue when applying IS_LIST_OF to list: type fields. Previously, you could not even use the IS_LIST_OF validator with list: fields -- we added support for that case but did not work out the displaying of errors on the form (which is a bit tricky given how the list: widget

Re: [web2py] Re: Nginx-uwsgi problem.

2012-05-11 Thread Richard Vézina
Bruce, Are you building dict with query for represent or other use? Recently I solve speed problem I had by caching dict building query. I never thought that building a dictionary could be that expensive in term of cpu load. Richard On Thu, May 10, 2012 at 5:13 PM, Bruce Wade

Re: [web2py] Re: Nginx-uwsgi problem.

2012-05-11 Thread Bruce Wade
Maybe in some places of the code but not everywhere. The problem is when there is a large load all 3 servers get very slow on every page. I think it is the DB layer as we have 90 tables in one database 45 in another. I am also using connection pooling which I think is causing problems. Because the

[web2py] web2py - form to pass input to matplotlib

2012-05-11 Thread Massimo Di Stefano
Hi All, i'm tring to learn web2py, thanks for the wonderful book and for the really nice tutorial! i'm a bit 'stuck' on how to perform a simple task (i guess it is simple) because of my ignorance. .. i'm bring to update dynamic a graph-chart (generated with matplotlib) using a form to pass

[web2py] denormalizing a list:reference -- need a bit of help

2012-05-11 Thread weheh
db.define_table('entity', Field('name'), format='%(name)s') auth_user_table = db.define_table( auth.settings.table_user_name, ... Field('entity', 'list:reference db.entity', requires=IS_IN_DB(db, 'entity.id','%(name)s', multiple=True), ... ) Later, I want to get a list

[web2py] Re: denormalizing a list:reference -- need a bit of help

2012-05-11 Thread Niphlod
If you need to fetch all entities knowing the user in advance there is a ultra-simple way to fetch entities in a single query Actually I don't think anyone will come up with a solution involving more than 1 additional query to the one required for selecting the user. user =

[web2py] Re: MongoDB Adapter error in select

2012-05-11 Thread Francisco Costa
the latest DAL produces this error users = mongo(mongo.user.age==18).select() File /opt/web2py/gluon/dal.py, line 8004, in select return adapter.select(self.query,fields,attributes) File /opt/web2py/gluon/dal.py, line 4528, in select colnames = [fix(column) for column in

Re: [web2py] Crontab generator

2012-05-11 Thread Richard Vézina
Pretty cool! Richard On Fri, May 11, 2012 at 12:05 PM, Bruno Rocha rochacbr...@gmail.com wrote: Useful application: http://corntab.com/pages/crontab-gui -- Bruno Rocha [http://rochacbruno.com.br]

[web2py] Re: Looking for a way to combine auto-complete with adding a non-existing item.

2012-05-11 Thread Anthony
Are you trying to auto-complete a reference field, and you want to be able to add new records to the referenced table? The built-in autocomplete widget doesn't handle that out of the box, but upon submission, you could check the request variables, and if the submitted value doesn't belong to

[web2py] Self-submitting Form and using dict update method

2012-05-11 Thread BENC
I am brand new to web2py and relatively new to python and I'm stuck, mainly on a python issue. My goal is to have a self-submitting form that allows a user to re-submit the same simple form any number of times, capture the inputs each time and display a list of the values entered, with the

[web2py] class 'sqlite3.ProgrammingError' Cannot operate on a closed database.

2012-05-11 Thread Yarin
Here is my complete model code for a sqlite logging handler. This works the first time the program is run, and after that I get an error: class 'sqlite3.ProgrammingError' Cannot operate on a closed database. *model mylogging.py:* import logging import logging.handlers class

[web2py] Re: jqgrid assistance

2012-05-11 Thread Larry Wapnitsky
got it working by using the wizard to create a new version of my app. On Thursday, May 10, 2012 4:16:00 PM UTC-4, Larry Wapnitsky wrote: the whole plugin_wiki thing is really starting to get my goat. Now I'm getting errors trying to delete my test wiki page: class

[web2py] Re: jqgrid assistance

2012-05-11 Thread Larry Wapnitsky
nix that. the updated version in plugin_wiki is still giving me grief. the standard version you can install from the wizard (jqgrid) works except for individual column sizing. On Friday, May 11, 2012 3:42:04 PM UTC-4, Larry Wapnitsky wrote: got it working by using the wizard to create a new

[web2py] Re: MongoDB Adapter error in select

2012-05-11 Thread Massimo Di Pierro
One more try please. On Friday, 11 May 2012 06:04:52 UTC-5, Francisco Costa wrote: Thanks Massimo. Please let me know if you need more help in debugging it On Friday, May 11, 2012 12:40:35 AM UTC+1, Massimo Di Pierro wrote: Now I understand better where all these problems come from. I shall

Re: [web2py] Crontab generator

2012-05-11 Thread Massimo Di Pierro
This is just JS. We can integrate it in admin. We use crontab syntax. On Friday, 11 May 2012 11:28:56 UTC-5, Richard wrote: Pretty cool! Richard On Fri, May 11, 2012 at 12:05 PM, Bruno Rocha rochacbr...@gmail.comwrote: Useful application: http://corntab.com/pages/crontab-gui -- Bruno

[web2py] Re: class 'sqlite3.ProgrammingError' Cannot operate on a closed database.

2012-05-11 Thread Massimo Di Pierro
Is this one or two files? If the model is passing db to the logger then the db is closed when the first request responds. The logger must make its own connection to the db and commit On Friday, 11 May 2012 14:28:22 UTC-5, Yarin wrote: Here is my complete model code for a sqlite logging

[web2py] Re: jqgrid assistance

2012-05-11 Thread Larry Wapnitsky
Screenshot of the issue herehttp://www.zimagez.com/zimage/screenshot-05112012-041826pm.php : http://www.zimagez.com/full/85e6a64dc62ed33f329a618ec91320d41abfadb28052b4b86924c0fb25bf0a9d45207eef74a4ebe8b70e615d5809904e0acef0c8ca77eb20.php On Friday, May 11, 2012 4:08:01 PM UTC-4, Larry

[web2py] cookbook component upload recipe

2012-05-11 Thread monotasker
I'm trying to use the recipe on p. 142 of the web2py cookbook (Uploading files using a LOADed component) and I'm wondering if there's an error in the replacement web2py_trap_form function. Line 4 of the replacement provides an 'if' condition with no statements following (no { } at all). Is

[web2py] Re: class 'sqlite3.ProgrammingError' Cannot operate on a closed database.

2012-05-11 Thread Yarin
Massimo- see revised - this is one model file and now I'm defining the db in the constructor, but I get the Cannot operate on a closed database error immediately. import logging import logging.handlers class AppHandler(logging.Handler): # Inherit from logging.Handler def __init__(self):

Re: [web2py] Re: Nginx-uwsgi problem.

2012-05-11 Thread Michele Comitini
2012/5/11 Bruce Wade bruce.w...@gmail.com: Maybe in some places of the code but not everywhere. The problem is when there is a large load all 3 servers get very slow on every page. I think it is the DB layer as we have 90 tables in one database 45 in another. I am also using connection pooling

Re: [web2py] Re: Nginx-uwsgi problem.

2012-05-11 Thread Michele Comitini
Connections = (pool_size) * (number of web2py processes) So if you have 10 threads  and pool_size = 4 1 * 4 = 4 connections If you have 10 processes (each with 6 threads): 10 * 4 = 40 connections As you can see the number of processes is not a term of the computation. You must count the

[web2py] Re: jqgrid assistance

2012-05-11 Thread Massimo Di Pierro
This is supposed to be `` name: jqgrid table: ips col_width: 80 width: 700 height: 300 ``:widget On Thursday, 10 May 2012 15:11:32 UTC-5, Larry Wapnitsky wrote: Even this fails on a wiki page: `` name: jqgrid table: db.ips col_width: 80 width: 700 height: 300 ``:widget Traceback

[web2py] Re: jqgrid assistance

2012-05-11 Thread Massimo Di Pierro
What do you get if you call this yourself? Anyway, I do not see the signature. Are you logged in? jqgrid in plugin_wiki requires login if I remember it right. On Thursday, 10 May 2012 15:02:27 UTC-5, Larry Wapnitsky wrote: Also just found this via the dev tools:: Request URL:

Re: [web2py] Re: jqgrid assistance

2012-05-11 Thread Larry Wapnitsky
I'll try that, but even adjusting, this (in the controller) does not work: wl2 = plugin_wiki.widget('jqgrid', db.ips, fieldname=b_or_w, fieldvalue=w, fields=[id, ipaddress, attacknotes]) nor does: wl2 = plugin_wiki.widget('jqgrid', ips, fieldname=b_or_w, fieldvalue=w, fields=[id, ipaddress,

[web2py] Re: class 'sqlite3.ProgrammingError' Cannot operate on a closed database.

2012-05-11 Thread Massimo Di Pierro
After self.log_db.log.insert(**args) you need self.log_db.commit() every http request, the models, are executed, DAL(...) connects you to the db (or recycles a connection from the pool), then when the action is done, it automatically commits or rollsback, then web2py closes the connection.

[web2py] Table/grid with checkboxes for selecting records?

2012-05-11 Thread Brian M
How can I create a table/grid with a checkbox in front of each row so that multiple records can be selected for update/delete? Something like your standard webmail inbox - check off a series of messages and then you can do something with them. I've got a version working with SQLFORM.factory

[web2py] storing more than 1 millions uploaded files

2012-05-11 Thread Sebastian E. Ovide
Hi All, I need to sore a lot of file... up to few millions. Just wondering if that can be done with web2py out of the box without the need of adding extra code for storing them in a sub folders tree structure I've read that web2py can organize the files uploaded in folders. I've created a

Re: [web2py] Table/grid with checkboxes for selecting records?

2012-05-11 Thread Bruno Rocha
A working example on plugin BadMin https://github.com/rochacbruno/badmin On Fri, May 11, 2012 at 7:13 PM, Brian M bmere...@gmail.com wrote: How can I create a table/grid with a checkbox in front of each row so that multiple records can be selected for update/delete? Something like your

[web2py] Re: Load data from sqlite file?

2012-05-11 Thread Brian M
So the user is going to be uploading a .sqlite file which you want to connect to with the DAL and import? You should be able to create a new DAL connection within a controller function or probably better yet a module instead of in a model file (which would have been run too early in the

[web2py] Re: Self-submitting Form and using dict update method

2012-05-11 Thread Anthony
if form.accepts(request,session): session.no_filters = session.no_filters+1 try: session.filter_list.update(request.vars) except NameError: session.filter_list = request.vars except AttributeError: session.filter_list =

[web2py] Remembering selections for form submission

2012-05-11 Thread Neil
I'm creating a form with drop down boxes like this: SELECT(*options, _name='q%d' % (q_num), requires=IS_IN_SET(['1', '2', '3', '4', '5'], error_message=Oops, looks like you missed this one.) When options looks like this: options = ['0', '1', '2', '3', '4', '5'] everything is fine. In

[web2py] Re: Remembering selections for form submission

2012-05-11 Thread Massimo Di Pierro
You need name = 'q%d' % (q_num) SELECT(,value=request.vars.name or '0',...) Only SQLFORM remembers the state. primitive tags like SELECT, INPUT, TEXTAREA that do not know state. you must pass state. On Friday, 11 May 2012 15:52:21 UTC-5, Neil wrote: I'm creating a form with drop down

Re: [web2py] Re: jqgrid assistance

2012-05-11 Thread Massimo Di Pierro
The second argument is the name of the table, not the table. wl2 = plugin_wiki.widget('jqgrid', 'ips', fieldname=b_or_w, fieldvalue=w, fields=[id, ipaddress, attacknotes]) On Friday, 11 May 2012 17:07:02 UTC-5, Larry Wapnitsky wrote: I'll try that, but even adjusting, this (in the controller)

[web2py] Re: storing more than 1 millions uploaded files

2012-05-11 Thread Massimo Di Pierro
yes. Field('name','upload',uploadseparate=True) Mind that you have to use this from the beginning when there is nothing in uploads, else you will not be able to download previously uploaded files. On Friday, 11 May 2012 17:19:07 UTC-5, sebastian wrote: Hi All, I need to sore a lot of

[web2py] Re: storing more than 1 millions uploaded files

2012-05-11 Thread Anthony
On Friday, May 11, 2012 7:25:21 PM UTC-4, Massimo Di Pierro wrote: yes. Field('name','upload',uploadseparate=True) He's aware of that but seems to think that one level of sub-folders won't be enough (he's expecting millions of files, so still more than 1000 files per sub-folder, even with

Re: [web2py] Re: jqgrid assistance

2012-05-11 Thread Larry Wapnitsky
better, but still no data showing up. On Fri, May 11, 2012 at 7:23 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: The second argument is the name of the table, not the table. wl2 = plugin_wiki.widget('jqgrid', 'ips', fieldname=b_or_w, fieldvalue=w, fields=[id, ipaddress,

Re: [web2py] Table/grid with checkboxes for selecting records?

2012-05-11 Thread Brian M
Thanks Bruno! So it looks like building the form myself in HTML is probably the way to go then. Would be nice to be able to have web2py do the form validation, but I'll survive. I'm thinking that I might be able to mix and match - use form.custom to start the form and show some widgets for

[web2py] Re: storing more than 1 millions uploaded files

2012-05-11 Thread Massimo Di Pierro
Oops. Sorry. I read it in a hurry. I would not use the file system for something like this. Anyway, upload separate creates up to 1296 subfolder per table.field. This number can be increased. On Friday, 11 May 2012 18:33:22 UTC-5, Anthony wrote: On Friday, May 11, 2012 7:25:21 PM UTC-4,

Re: [web2py] Table/grid with checkboxes for selecting records?

2012-05-11 Thread Brian M
WhooHoo! Keeping the same SQLFORM in the controller and then just using form.custom (see http://web2py.com/books/default/chapter/29/7?search=form.custom) for my non-checkbox elements and then simply building the desired grid with check boxes myself in the HTML works beautifully. Just have to

[web2py] Tagging View

2012-05-11 Thread Rod Watkins
I have a question I have not been able to answer for myself. In the web2py cookbook, there is this suggested model for handling tags: db.define_table('data', Field('value')) db.define_table('tag', Field('record_id', db.data), Field('name')) I like that. But I have struggled with the correct

[web2py] Re: Tagging View

2012-05-11 Thread Massimo Di Pierro
That is done here: https://github.com/mdipierro/w2cms Look into the action tags() On Friday, 11 May 2012 21:06:43 UTC-5, Rod Watkins wrote: I have a question I have not been able to answer for myself. In the web2py cookbook, there is this suggested model for handling tags:

[web2py] Integrating error pages in web2py on app engine

2012-05-11 Thread Sushant Taneja
Hi All, I have two static custom errors pages for all 4XX and 5XX error codes. I want to integrate them with my web2py application which needs to be deployed on app engine. I tried playing around with routes.py as well as routers.py but still couldn't fix the same. Can anyone please tell me

[web2py] Re: Integrating error pages in web2py on app engine

2012-05-11 Thread Anthony
There's no such thing as routers.py -- if using the parameter-based rewrite system, you still use routes.py. Anyway, did you try adding routes_onerror to routes.py: http://web2py.com/books/default/chapter/29/4#Routes-on-error? Note, you have to restart the app for routes changes to take effect.

[web2py] Re: Integrating error pages in web2py on app engine

2012-05-11 Thread Sushant Taneja
Yes I did configure the routes_onerror in routes.py But whenever I entered the URL of the page which does not exist, it would still return me *invalid request.* On Saturday, May 12, 2012 8:40:35 AM UTC+5:30, Anthony wrote: There's no such thing as routers.py -- if using the parameter-based

[web2py] Re: Changing the controller on the fly

2012-05-11 Thread Michael Toomim
This is working great! It's exactly what I needed, and makes my code much simpler. Thank you very much! I love it! On Friday, May 11, 2012 5:03:51 AM UTC-7, Anthony wrote: Or to avoid a redirect, you can change the function and controller in a model file: db = DAL(...) if

[web2py] Is there a way to use an Alias for a COUNT() field

2012-05-11 Thread Franklin Freitas
Having the following def by_country(): count = db.procesados.idpublicacion.count() rows = db().select(db.procesados.pais, count, groupby=db.procesados.pais) return rows.json() It generates the JSON: [{pais: , COUNT(procesados.idpublicacion): 236}, {pais: AE,

[web2py] Re: Is there a way to use an Alias for a COUNT() field

2012-05-11 Thread Massimo Di Pierro
No, but you can do for row in rows: row['count'] = row[count] On Friday, 11 May 2012 23:44:57 UTC-5, Franklin Freitas wrote: Having the following def by_country(): count = db.procesados.idpublicacion.count() rows = db().select(db.procesados.pais, count,

[web2py] Re: Tagging View

2012-05-11 Thread Rod Watkins
Wow, very cool. One question. In the cms app, a page (with an id) already exists so the ajax post to the addtag action can add the tag to the page. In my case the create version of the form will not have an entity with an id yet since it does not exist in the db. Am I wrong to think than that

[web2py] Re: Is there a way to use an Alias for a COUNT() field

2012-05-11 Thread Franklin Freitas
If I use what you recommend then what would be the best way to generate the JSON output Thanks Massimo On Saturday, May 12, 2012 12:29:09 AM UTC-4:30, Massimo Di Pierro wrote: No, but you can do for row in rows: row['count'] = row[count] On Friday, 11 May 2012 23:44:57 UTC-5,