[web2py] disk cache problem
http://code.google.com/p/web2py/issues/detail?id=1791thanks=1791ts=1385453629 I have an app with lot of disk cache usage in selects after 2.7 - don't know exactly the exact version :( - I got a lot of trouble with it, sometimes the app just wait and if I try disk. Or if I make a cache.disk.flush() I got this: Ticket ID 192.168.7.29.2013-11-18.14-42-35.394acb31-76b9-4204-8695-c5f9ee84a87a class '_bsddb.DBNotFoundError' (-30988, 'DB_NOTFOUND: No matching key/data pair found') Version web2py™ Version 2.7.4-stable+timestamp.2013.11.03.22.45.08 Traceback Traceback (most recent call last): File /usr/local/share/web2py/gluon/restricted.py, line 217, in restricted exec ccode in environment File applications/eszkoz/compiled/controllers.bevetel.szamla.py, line 1090, in module File /usr/local/share/web2py/gluon/globals.py, line 372, in lambda self._caller = lambda f: f() File /usr/local/share/web2py/gluon/tools.py, line 3240, in f return action(*a, **b) File applications/eszkoz/compiled/controllers.bevetel.szamla.py, line 415, in szamla File /usr/local/share/web2py/gluon/tools.py, line 3948, in create **attributes File /usr/local/share/web2py/gluon/tools.py, line 3899, in update callback(onaccept, form, table._tablename) File /usr/local/share/web2py/gluon/tools.py, line 76, in callback [action(form) for action in actions] File /usr/local/share/web2py/gluon/tools.py, line 3240, in f return action(*a, **b) File applications/eszkoz/compiled/controllers.bevetel.szamla.py, line 65, in send_mail_to_penzugy File applications/eszkoz/compiled/controllers.bevetel.szamla.py, line 52, in flush_cache File /usr/local/share/web2py/gluon/cache.py, line 336, in clear storage.clear() File /usr/lib/python2.6/UserDict.py, line 124, in clear del self[key] File /usr/lib/python2.6/shelve.py, line 136, in __delitem__ del self.dict[key] File /usr/lib/python2.6/bsddb/__init__.py, line 285, in __delitem__ _DeadlockWrap(wrapF) # del self.db[key] File /usr/lib/python2.6/bsddb/dbutils.py, line 68, in DeadlockWrap return function(*_args, **_kwargs) File /usr/lib/python2.6/bsddb/__init__.py, line 284, in wrapF del self.db[key] DBNotFoundError: (-30988, 'DB_NOTFOUND: No matching key/data pair found') In file: /usr/local/share/web2py/applications/eszkoz/compiled/controllers.bevetel.szamla.pyc code object module at 0xfbc8b068, file applications/eszkoz/compiled/controllers.bevetel.szamla.py, line 1 I need to manually del the content of the cache dir. The very some app is running good with 2.6.4. I use apache frontend with wsgi in both case. -- 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/groups/opt_out.
[web2py] Crypto()
Dear all, I'm a little bit lost with Crypto method. I need authentication from a mobile app towards web2py. If I'm not in wrong, web2py now uses sha512 as default to crypt auth user password. From my iOS app I'm sending the password encrypted with the same Hash Algorithm sha512, because I don't want to send the password clear through the net From web2py console I can do: b='sha512$$83d97b71499bee6b9d42dee9d3a6e5d00ecc8c891346d25d1909b3aac9abaa0ad4864fe4eacf159cd3f4a0ad764178d014ac378dfffc5e4023f6dbcfb0992648' where b is exactly my mobile password string that I'm sending to web2py trough Json b 'sha512$$83d97b71499bee6b9d42dee9d3a6e5d00ecc8c891346d25d1909b3aac9abaa0ad4864fe4eacf159cd3f4a0ad764178d014ac378dfffc5e4023f6dbcfb0992648' a= CRYPT(digest_alg='sha512',salt=False)('pippo')[0] now ,if I do a==b, it returns True The problem is that I'm not able to compare auth.user password with my mobile password! Both are encrypted, with the same algorithm, but auth.login_bare(user,psw) returns alway false because it wants clear-password The solution to me appears that I have to compare the two encrypted password, but may be on the wrong way. Help please... Marco -- 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/groups/opt_out.
[web2py] calling controller from view to retrieve data
Hello I menage to call my function that is in my default.py controler from my view but I cannot retrieve data that this function is suppose to retrieve function is called on button click to load some text from database into ACE editor this is some of my code in controler.py def load_last(): PgSQL = db_conn() cur = PgSQL.cursor() sql_read = SELECT file_text FROM datoteke WHERE id = (SELECT max(id) FROM datoteke) cur.execute(sql_read) ver = cur.fetchone()[0] print ver return dict(data = ver) in my editor.html view my java script code that should get data from def load_last functions is function load_last() { var editor = ace.edit(editor); editor.setValue(); $.ajax({ url: {{=URL('default', 'load_last')}}, data: {}, //*WHAT DO I WRITE HERE* success: function(){ console.log(neki je ratal); }, dataType: 'html' }); } I am really stuck here In addidtion another question. What would you recommend, a user writes some text in my ace editor that is saved in a database. Text is varified for errors with engine on server and if there is an error user has to be prompted to correct them, only after that he can save data. What would be the best way to do that. Also user can read file from database to update an existing file. any recomendations please help thank you -- 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/groups/opt_out.
Re: [web2py] Re: Web2py DAL slows down the server response when faced with multiple concurrent requests
I am sorry if I failed to put it clearly or I am asking something absurd. I am not sure why are you relating it to the Mysql server. I am summarizing my observations below. *Context:* I am testing using ab. The HTTP request does not make any database query. Number of Daemon processes: 10 Max Number of Mysql connections allowed: 1000 DAL pool size: 100 *Case 1:* Number of Tables in db.py: ~100 (all with migrate=False) No. of concurrent requests: 1 Time taken per request: 900 ms *Case 2:* Number of Tables in db.py: ~100 (all with migrate=False) No. of concurrent requests: 25 Time taken per request: 4440 ms *Case 3:* Number of Tables in db.py: =2 (all with migrate=False) No. of concurrent requests: 25 Time taken per request: 1075 ms In case 2, extra time gets consumed in loading the models in main.py web2py file. Logs for case 2: 16217 function calls (16199 primitive calls) in 1.558 seconds Ordered by: internal time, call count List reduced from 188 to 50 due to restriction 50 ncalls tottime percall cumtime percall filename:lineno(function) 17100.3420.0000.5300.000 /home/www-data/lambda/gluon/dal.py:8247(__getitem__) 140.1880.0130.1880.013 /usr/lib/python2.7/dist-packages/MySQLdb/cursors.py:97(nextset) 1830.1520.0010.1520.001 /usr/lib/python2.7/threading.py:146(acquire) 3660.1310.0000.1320.000 /usr/lib/python2.7/genericpath.py:38(isdir) 1020.1070.0010.2410.002 /home/www-data/lambda/gluon/dal.py:8025(__init__) 5950.1020.0000.5560.001 /home/www-data/lambda/gluon/dal.py:9100(__init__) 22420.0860.0000.1000.000 /home/www-data/lambda/gluon/dal.py:8317(__setattr__) 5960.0550.0000.0550.000 /home/www-data/lambda/gluon/dal.py:5060(cleanup) 3790.0520.0000.0520.000 /usr/lib/python2.7/posixpath.py:68(join) 30.0480.0160.0480.016 /usr/lib/python2.7/dist-packages/MySQLdb/cursors.py:277(_do_query) 1010.0380.0000.6810.007 /home/www-data/lambda/gluon/dal.py:7658(lazy_define_table) 1010.0360.0000.0730.001 /home/www-data/lambda/gluon/dal.py:8198(_create_references) 5200.0350.0000.2140.000 /home/www-data/lambda/gluon/dal.py:6620(sqlhtml_validators) 1010.0350.0000.7170.007 /home/www-data/lambda/gluon/dal.py:7628(define_table) 10.0290.0291.3691.369 /home/www-data/lambda/applications/chat/compiled/models/db.py:1(module) 1580.0240.0000.0240.000 /home/www-data/lambda/gluon/validators.py:2564(__init__) 13840.0150.0000.1380.000 /home/www-data/lambda/gluon/dal.py:8339(__iter__) 1020.0140.0000.0140.000 /home/www-data/lambda/gluon/dal.py:457(pluralize) 6950.0130.0000.0130.000 /home/www-data/lambda/gluon/dal.py:8288(__setitem__) 4140.0130.0000.0130.000 /home/www-data/lambda/gluon/dal.py:7762(__getattr__) 890.0120.0000.0140.000 /home/www-data/lambda/gluon/validators.py:450(__init__) 60.0050.0010.0050.001 /usr/lib/python2.7/socket.py:223(meth) Logs for case 3: 14877 function calls (14855 primitive calls) in 0.117 seconds Ordered by: internal time, call count List reduced from 220 to 50 due to restriction 50 ncalls tottime percall cumtime percall filename:lineno(function) 80.0250.0030.0250.003 /home/www-data/lambda/gluon/restricted.py:190(compile2) 1020.0170.0000.0310.000 /home/www-data/lambda/gluon/dal.py:8025(__init__) 5960.0120.0000.0150.000 /home/www-data/lambda/gluon/dal.py:9100(__init__) 17260.0060.0000.0060.000 /home/www-data/lambda/gluon/dal.py:8247(__getitem__) 22420.0050.0000.0070.000 /home/www-data/lambda/gluon/dal.py:8317(__setattr__) 5200.0050.0000.0150.000 /home/www-data/lambda/gluon/dal.py:6620(sqlhtml_validators) 1010.0040.0000.0630.001 /home/www-data/lambda/gluon/dal.py:7658(lazy_define_table) 13920.0040.0000.0070.000 /home/www-data/lambda/gluon/dal.py:8339(__iter__) 10.0030.0030.0910.091 /home/www-data/lambda/applications/chat/models/db.py:1(module) 1010.0030.0000.0660.001 /home/www-data/lambda/gluon/dal.py:7628(define_table) 6950.0030.0000.0030.000 /home/www-data/lambda/gluon/dal.py:8288(__setitem__) 1010.0030.0000.0070.000 /home/www-data/lambda/gluon/dal.py:8198(_create_references) 5960.0020.0000.0020.000 /home/www-data/lambda/gluon/dal.py:5060(cleanup) 1510.0020.0000.0020.000 /home/www-data/lambda/gluon/custom_import.py:37(custom_importer) 890.0020.0000.0030.000
Re: [web2py] Re: Web2py DAL slows down the server response when faced with multiple concurrent requests
On Tue, Nov 26, 2013 at 2:44 AM, Anthony abasta...@gmail.com wrote: So, is time for 25 concurrent requests significantly greater than 25*[time for a single request]? No, time for 25 concurrent requests is smaller than 25*[time for a single request]. Avg. time taken per request is 4 to 5 times though. They should be processed in parallel not sequentially, right? Ideally, I would expect time for 25 concurrent requests ~= 1*[time for a single request]. Thanks, Saurabh On Monday, November 25, 2013 12:55:06 PM UTC-5, Saurabh Kumar wrote: Apparently not. Following are the logs when doing single request will all 100 tables defined. 14877 function calls (14855 primitive calls) in 0.117 seconds Ordered by: internal time, call count List reduced from 220 to 50 due to restriction 50 ncalls tottime percall cumtime percall filename:lineno(function) 80.0250.0030.0250.003 /home/www-data/lambda/gluon/ restricted.py:190(compile2) 1020.0170.0000.0310.000 /home/www-data/lambda/gluon/ dal.py:8025(__init__) 5960.0120.0000.0150.000 /home/www-data/lambda/gluon/ dal.py:9100(__init__) 17260.0060.0000.0060.000 /home/www-data/lambda/gluon/ dal.py:8247(__getitem__) 22420.0050.0000.0070.000 /home/www-data/lambda/gluon/ dal.py:8317(__setattr__) 5200.0050.0000.0150.000 /home/www-data/lambda/gluon/ dal.py:6620(sqlhtml_validators) 1010.0040.0000.0630.001 /home/www-data/lambda/gluon/ dal.py:7658(lazy_define_table) 13920.0040.0000.0070.000 /home/www-data/lambda/gluon/ dal.py:8339(__iter__) 10.0030.0030.0910.091 /home/www-data/lambda/ applications/chat/models/db.py:1(module) 1010.0030.0000.0660.001 /home/www-data/lambda/gluon/ dal.py:7628(define_table) 6950.0030.0000.0030.000 /home/www-data/lambda/gluon/ dal.py:8288(__setitem__) 1010.0030.0000.0070.000 /home/www-data/lambda/gluon/ dal.py:8198(_create_references) 5960.0020.0000.0020.000 /home/www-data/lambda/gluon/ dal.py:5060(cleanup) 1510.0020.0000.0020.000 /home/www-data/lambda/gluon/ custom_import.py:37(custom_importer) 890.0020.0000.0030.000 /home/www-data/lambda/gluon/ validators.py:450(__init__) 1020.0020.0000.0020.000 /home/www-data/lambda/gluon/ dal.py:457(pluralize) 1810.0010.0000.0040.000 /home/www-data/lambda/gluon/ languages.py:867(translate) 1600.0010.0000.0070.000 /home/www-data/lambda/gluon/ validators.py:77(translate) 820.0010.0000.0040.000 /home/www-data/lambda/gluon/ validators.py:689(__init__) 1840.0010.0000.0010.000 /home/www-data/lambda/gluon/ languages.py:338(__init__) 1810.0010.0000.0050.000 /home/www-data/lambda/gluon/ languages.py:367(__str__) Also if you see closely, there might be some slow down due to locking. Look at the following line taken from the log I had posted earlier. 16217 function calls (16199 primitive calls) in 1.558 seconds Ordered by: internal time, call count List reduced from 188 to 50 due to restriction 50 ncalls tottime percall cumtime percall filename:lineno(function) 17100.3420.0000.5300.000 /home/www-data/lambda/gluon/ dal.py:8247(__getitem__) 140.1880.0130.1880.013 /usr/lib/python2.7/dist- packages/MySQLdb/cursors.py:97(nextset) 1830.1520.0010.1520.001 /usr/lib/python2.7/threading.py:146(acquire) 3660.1310.0000.1320.000 /usr/lib/python2.7/ genericpath.py:38(isdir) 1020.1070.0010.2410.002 /home/www-data/lambda/gluon/ dal.py:8025(__init__) 5950.1020.0000.5560.001 /home/www-data/lambda/gluon/ dal.py:9100(__init__) 22420.0860.0000.1000.000 /home/www-data/lambda/gluon/ dal.py:8317(__setattr__) 5960.0550.0000.0550.000 /home/www-data/lambda/gluon/ dal.py:5060(cleanup) 3790.0520.0000.0520.000 /usr/lib/python2.7/posixpath.py:68(join) 30.0480.0160.0480.016 /usr/lib/python2.7/dist- packages/MySQLdb/cursors.py:277(_do_query) 1010.0380.0000.6810.007 /home/www-data/lambda/gluon/ dal.py:7658(lazy_define_table) 1010.0360.0000.0730.001 /home/www-data/lambda/gluon/ dal.py:8198(_create_references) 5200.0350.0000.2140.000 /home/www-data/lambda/gluon/ dal.py:6620(sqlhtml_validators) 1010.0350.0000.7170.007 /home/www-data/lambda/gluon/ dal.py:7628(define_table) 10.0290.0291.3691.369 /home/www-data/lambda/
Re: [web2py] Re: Web2py DAL slows down the server response when faced with multiple concurrent requests
*Case 1:* Number of Tables in db.py: ~100 (all with migrate=False) No. of concurrent requests: 1 Time taken per request: 900 ms *Case 2:* Number of Tables in db.py: ~100 (all with migrate=False) No. of concurrent requests: 25 Time taken per request: 4440 ms For apples to apples comparison, you should look at the (mean, across all concurrent requests) value. In case #2, that is only 177.6 ms. With multiple concurrent requests, of course each request is going to take longer to complete from start to finish (each thread is sharing system resources, so can't run as fast as when only a single thread is processing a request). However, because the requests are being processed in parallel, you have to divide the overall average time per request by the concurrency level to get the true time spent on each request (i.e., if 50 requests take an average of 4.4 seconds per request processed 25 at a time, then the true time spent on each request is 4.4 seconds / 25 = 177.6 ms). This is the number that should be compared to the single request case. Alternatively, you can just compare the total test time in both cases (assuming you ran the same number of total requests in each case). Anthony -- 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/groups/opt_out.
Re: [web2py] Re: Web2py DAL slows down the server response when faced with multiple concurrent requests
On Tue, Nov 26, 2013 at 2:44 AM, Anthony abas...@gmail.com javascript:wrote: So, is time for 25 concurrent requests significantly greater than 25*[time for a single request]? No, time for 25 concurrent requests is smaller than 25*[time for a single request]. Avg. time taken per request is 4 to 5 times though. They should be processed in parallel not sequentially, right? Ideally, I would expect time for 25 concurrent requests ~= 1*[time for a single request]. No, that's not how concurrency works. When you process 25 requests simultaneously, the computer doesn't suddenly gain 25x it's normal computing power. Each request is handled in a separate thread, but all of those threads still have to share the same computing resources. So, each request will take longer to process than it would in the single request case. It doesn't look like concurrency is slowing things down for you. The problem is that you have 100 table definitions. Even with migrations turned off, table definitions take some time, so you should avoid having so many in each request. At a minimum, you should set lazy_tables=True. That will postpone much of the table definition code until each table is actually referenced in the code (so tables that are never referenced within a given request will not get fully defined). In addition, you can use conditional models to execute only some of the models on each request (i.e., those needed for the particular controller/function being called) and/or define models in modules and import where needed. Anthony -- 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/groups/opt_out.
[web2py] Re: Update while iterating over fields
On Tuesday, November 26, 2013 2:51:17 AM UTC-5, Yohai Bar Sinai wrote: Combining Anthony's and Massimo's answers, the correct code is db(query).update(**{'x'+str(i):db.X['x'+str(i)]+10}) 'x' + str(i) is certainly simpler, but technically should be equivalent to what you had (i.e., db.X['x' + str(i)].name). Anthony -- 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/groups/opt_out.
Re: [web2py] Re: Web2py DAL slows down the server response when faced with multiple concurrent requests
On Tue, Nov 26, 2013 at 7:27 PM, Anthony abasta...@gmail.com wrote: *Case 1:* Number of Tables in db.py: ~100 (all with migrate=False) No. of concurrent requests: 1 Time taken per request: 900 ms *Case 2:* Number of Tables in db.py: ~100 (all with migrate=False) No. of concurrent requests: 25 Time taken per request: 4440 ms For apples to apples comparison, you should look at the (mean, across all concurrent requests) value. In case #2, that is only 177.6 ms. With multiple concurrent requests, of course each request is going to take longer to complete from start to finish (each thread is sharing system resources, so can't run as fast as when only a single thread is processing a request). However, because the requests are being processed in parallel, you have to divide the overall average time per request by the concurrency level to get the true time spent on each request (i.e., if 50 requests take an average of 4.4 seconds per request processed 25 at a time, then the true time spent on each request is 4.4 seconds / 25 = 177.6 ms). This is the number that should be compared to the single request case. Alternatively, you can just compare the total test time in both cases (assuming you ran the same number of total requests in each case). I am still unclear. Have a look at the longest response time which is 5.8 s as compared to 1 s. This would mean that as soon as the website is faced with 25 odd users, the response time goes up six times, which is certainly not a good thing. I am sure CPU/memory/Bandwidth are not bottleneck here. Comparing total time taken in both the cases wont be a fair comparison. One of them is doing things concurrently and other one sequentially. If both were expected to be the same, then why do things in parallel in the first place? I understand that expected time for 25 concurrent requests ~= 1*[time for a single request] is wrong because of sharing of resources. But it should be considerably less than 25*[time for a single request]. And as 25 is a very small number I'd expect it to be close to 1*[time for a single request]. The CPU time taken in processing a light request should be close to zero and it should not be a bottleneck while processing 25 such requests in parallel. If CPU is turning out to be the bottleneck here, there must be something wrong in what are are doing. A lot of table definitions is one such things. And, just curious, why is table definition expensive in the first place if migrate is set to False and these is no need for database interaction while defining tables. Regarding the optimization of table definitions suggestion, yes it definitely makes sense and answers my doubts. I will do the needful and post how it turns out. Anthony -- 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 a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/rH1C7iXMPNA/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- 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/groups/opt_out.
Re: [web2py] Re: Web2py DAL slows down the server response when faced with multiple concurrent requests
How may cores do you have? Are all the cores being used when you run the tests? What webserver are you testing against? Keep in mind that one core can only process one instruction (machine code, not python instruction) at a time. Ricardo On Tue, Nov 26, 2013 at 2:32 PM, Saurabh Kumar saurabh.ca...@gmail.comwrote: On Tue, Nov 26, 2013 at 7:27 PM, Anthony abasta...@gmail.com wrote: *Case 1:* Number of Tables in db.py: ~100 (all with migrate=False) No. of concurrent requests: 1 Time taken per request: 900 ms *Case 2:* Number of Tables in db.py: ~100 (all with migrate=False) No. of concurrent requests: 25 Time taken per request: 4440 ms For apples to apples comparison, you should look at the (mean, across all concurrent requests) value. In case #2, that is only 177.6 ms. With multiple concurrent requests, of course each request is going to take longer to complete from start to finish (each thread is sharing system resources, so can't run as fast as when only a single thread is processing a request). However, because the requests are being processed in parallel, you have to divide the overall average time per request by the concurrency level to get the true time spent on each request (i.e., if 50 requests take an average of 4.4 seconds per request processed 25 at a time, then the true time spent on each request is 4.4 seconds / 25 = 177.6 ms). This is the number that should be compared to the single request case. Alternatively, you can just compare the total test time in both cases (assuming you ran the same number of total requests in each case). I am still unclear. Have a look at the longest response time which is 5.8 s as compared to 1 s. This would mean that as soon as the website is faced with 25 odd users, the response time goes up six times, which is certainly not a good thing. I am sure CPU/memory/Bandwidth are not bottleneck here. Comparing total time taken in both the cases wont be a fair comparison. One of them is doing things concurrently and other one sequentially. If both were expected to be the same, then why do things in parallel in the first place? I understand that expected time for 25 concurrent requests ~= 1*[time for a single request] is wrong because of sharing of resources. But it should be considerably less than 25*[time for a single request]. And as 25 is a very small number I'd expect it to be close to 1*[time for a single request]. The CPU time taken in processing a light request should be close to zero and it should not be a bottleneck while processing 25 such requests in parallel. If CPU is turning out to be the bottleneck here, there must be something wrong in what are are doing. A lot of table definitions is one such things. And, just curious, why is table definition expensive in the first place if migrate is set to False and these is no need for database interaction while defining tables. Regarding the optimization of table definitions suggestion, yes it definitely makes sense and answers my doubts. I will do the needful and post how it turns out. Anthony -- 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 a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/rH1C7iXMPNA/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- 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/groups/opt_out. -- 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/groups/opt_out.
Re: [web2py] Re: Web2py DAL slows down the server response when faced with multiple concurrent requests
On Tue, Nov 26, 2013 at 8:42 PM, Ricardo Pedroso rmdpedr...@gmail.comwrote: How may cores do you have? Are all the cores being used when you run the tests? What webserver are you testing against? I have 4 cores, 16 GB RAM running Apache. But I think, this is irrelevant. Apache easily serves 1000 static file requests (which are not processed through web2y) with 100 concurrent connections on the same machine, with the largest response time being 133 ms. Concurrency Level: 100 Time taken for tests: 0.884 seconds Complete requests: 1000 Failed requests:0 Write errors: 0 Total transferred: 54234000 bytes HTML transferred: 53846000 bytes Requests per second:1130.96 [#/sec] (mean) Time per request: 88.421 [ms] (mean) Time per request: 0.884 [ms] (mean, across all concurrent requests) Transfer rate: 59898.81 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect:3 19 6.5 19 34 Processing:36 67 16.4 64 117 Waiting: 11 25 8.4 23 64 Total: 40 86 17.2 84 133 Percentage of the requests served within a certain time (ms) 50% 84 66% 94 75% 98 80%101 90%107 95%115 98%125 99%128 100%133 (longest request) Keep in mind that one core can only process one instruction (machine code, not python instruction) at a time. Ricardo On Tue, Nov 26, 2013 at 2:32 PM, Saurabh Kumar saurabh.ca...@gmail.comwrote: On Tue, Nov 26, 2013 at 7:27 PM, Anthony abasta...@gmail.com wrote: *Case 1:* Number of Tables in db.py: ~100 (all with migrate=False) No. of concurrent requests: 1 Time taken per request: 900 ms *Case 2:* Number of Tables in db.py: ~100 (all with migrate=False) No. of concurrent requests: 25 Time taken per request: 4440 ms For apples to apples comparison, you should look at the (mean, across all concurrent requests) value. In case #2, that is only 177.6 ms. With multiple concurrent requests, of course each request is going to take longer to complete from start to finish (each thread is sharing system resources, so can't run as fast as when only a single thread is processing a request). However, because the requests are being processed in parallel, you have to divide the overall average time per request by the concurrency level to get the true time spent on each request (i.e., if 50 requests take an average of 4.4 seconds per request processed 25 at a time, then the true time spent on each request is 4.4 seconds / 25 = 177.6 ms). This is the number that should be compared to the single request case. Alternatively, you can just compare the total test time in both cases (assuming you ran the same number of total requests in each case). I am still unclear. Have a look at the longest response time which is 5.8 s as compared to 1 s. This would mean that as soon as the website is faced with 25 odd users, the response time goes up six times, which is certainly not a good thing. I am sure CPU/memory/Bandwidth are not bottleneck here. Comparing total time taken in both the cases wont be a fair comparison. One of them is doing things concurrently and other one sequentially. If both were expected to be the same, then why do things in parallel in the first place? I understand that expected time for 25 concurrent requests ~= 1*[time for a single request] is wrong because of sharing of resources. But it should be considerably less than 25*[time for a single request]. And as 25 is a very small number I'd expect it to be close to 1*[time for a single request]. The CPU time taken in processing a light request should be close to zero and it should not be a bottleneck while processing 25 such requests in parallel. If CPU is turning out to be the bottleneck here, there must be something wrong in what are are doing. A lot of table definitions is one such things. And, just curious, why is table definition expensive in the first place if migrate is set to False and these is no need for database interaction while defining tables. Regarding the optimization of table definitions suggestion, yes it definitely makes sense and answers my doubts. I will do the needful and post how it turns out. Anthony -- 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 a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/rH1C7iXMPNA/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book
Re: [web2py] Re: Web2py DAL slows down the server response when faced with multiple concurrent requests
Are you comparing how long it takes to do 25 requests done in parallel to how long it takes to do 25 requests serially, or are you comparing how long it takes to do 25 request in parallel to how long it takes to do 1 request all by itself? You seem to be making the latter comparison and expecting the machine to be able to do 25 requests just as fast as it can do a single request. Instead, trying comparing: ab -n 50 -c 1 [url] with ab -n 50 -c 25 [url] and observe the *total time* taken for the entire 50 requests in each case. Regarding table definitions, yes, they do take up non-trivial amounts of CPU time. When you define a table, it calls the gluon.dal.Table.__init__ method -- check it out. Anthony On Tuesday, November 26, 2013 9:32:37 AM UTC-5, Saurabh Kumar wrote: On Tue, Nov 26, 2013 at 7:27 PM, Anthony abas...@gmail.com javascript:wrote: *Case 1:* Number of Tables in db.py: ~100 (all with migrate=False) No. of concurrent requests: 1 Time taken per request: 900 ms *Case 2:* Number of Tables in db.py: ~100 (all with migrate=False) No. of concurrent requests: 25 Time taken per request: 4440 ms For apples to apples comparison, you should look at the (mean, across all concurrent requests) value. In case #2, that is only 177.6 ms. With multiple concurrent requests, of course each request is going to take longer to complete from start to finish (each thread is sharing system resources, so can't run as fast as when only a single thread is processing a request). However, because the requests are being processed in parallel, you have to divide the overall average time per request by the concurrency level to get the true time spent on each request (i.e., if 50 requests take an average of 4.4 seconds per request processed 25 at a time, then the true time spent on each request is 4.4 seconds / 25 = 177.6 ms). This is the number that should be compared to the single request case. Alternatively, you can just compare the total test time in both cases (assuming you ran the same number of total requests in each case). I am still unclear. Have a look at the longest response time which is 5.8 s as compared to 1 s. This would mean that as soon as the website is faced with 25 odd users, the response time goes up six times, which is certainly not a good thing. I am sure CPU/memory/Bandwidth are not bottleneck here. Comparing total time taken in both the cases wont be a fair comparison. One of them is doing things concurrently and other one sequentially. If both were expected to be the same, then why do things in parallel in the first place? I understand that expected time for 25 concurrent requests ~= 1*[time for a single request] is wrong because of sharing of resources. But it should be considerably less than 25*[time for a single request]. And as 25 is a very small number I'd expect it to be close to 1*[time for a single request]. The CPU time taken in processing a light request should be close to zero and it should not be a bottleneck while processing 25 such requests in parallel. If CPU is turning out to be the bottleneck here, there must be something wrong in what are are doing. A lot of table definitions is one such things. And, just curious, why is table definition expensive in the first place if migrate is set to False and these is no need for database interaction while defining tables. Regarding the optimization of table definitions suggestion, yes it definitely makes sense and answers my doubts. I will do the needful and post how it turns out. Anthony -- Resources: - http://web2py.comhttp://www.google.com/url?q=http%3A%2F%2Fweb2py.comsa=Dsntz=1usg=AFQjCNE7x6wflFTAQ11b-FhtMwFfvltXeg - http://web2py.com/bookhttp://www.google.com/url?q=http%3A%2F%2Fweb2py.com%2Fbooksa=Dsntz=1usg=AFQjCNFAv433a0RL4nfaYxTbZ4cHi4Q78A(Documentation) - http://github.com/web2py/web2pyhttp://www.google.com/url?q=http%3A%2F%2Fgithub.com%2Fweb2py%2Fweb2pysa=Dsntz=1usg=AFQjCNHSwgWBkjuiIoo30014e8BB_iCDag(Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/rH1C7iXMPNA/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- 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
Re: [web2py] Crypto()
On 26 Nov 2013, at 2:05 AM, Mchurch mchurc...@gmail.com wrote: Dear all, I'm a little bit lost with Crypto method. I need authentication from a mobile app towards web2py. If I'm not in wrong, web2py now uses sha512 as default to crypt auth user password. From my iOS app I'm sending the password encrypted with the same Hash Algorithm sha512, because I don't want to send the password clear through the net From web2py console I can do: b='sha512$$83d97b71499bee6b9d42dee9d3a6e5d00ecc8c891346d25d1909b3aac9abaa0ad4864fe4eacf159cd3f4a0ad764178d014ac378dfffc5e4023f6dbcfb0992648' where b is exactly my mobile password string that I'm sending to web2py trough Json b 'sha512$$83d97b71499bee6b9d42dee9d3a6e5d00ecc8c891346d25d1909b3aac9abaa0ad4864fe4eacf159cd3f4a0ad764178d014ac378dfffc5e4023f6dbcfb0992648' a= CRYPT(digest_alg='sha512',salt=False)('pippo')[0] now ,if I do a==b, it returns True The problem is that I'm not able to compare auth.user password with my mobile password! Both are encrypted, with the same algorithm, but auth.login_bare(user,psw) returns alway false because it wants clear-password The solution to me appears that I have to compare the two encrypted password, but may be on the wrong way. Help please... Briefly: you don't want to do that. Why? In the scheme you propose, the hash effective becomes the password, and is stored as-if unhashed in the database, to be compared directly with what comes in over the wire. So if your database is compromised, the attacker can log into any account simply by presenting the password (hash) stored in the database. Compare that to the usual method, where the user transmits the password: the point of the hash is that the password cannot be reverse-engineered from the hash (if it's a good password!). Protecting the password in flight is easy enough: use https. -- 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/groups/opt_out.
Re: [web2py] Re: Web2py DAL slows down the server response when faced with multiple concurrent requests
Here is the output of the two commands and one with -n 500 -c 100. I think as you say the problem is with table definition code, which I am trying to sort out. If you have any other suggestions regarding the same (speeding up and concurrency) please let me know. I am really thankful to all of you for helping me out :) I have one more question. Is it possible to lazy load only some tables in place of all of them? Currently what I found out is that, lazy_tables=True argument could be passed in the DAL constructor. Is these a simple way to say that load these tables immediately and the rest of them lazily? On Tue, Nov 26, 2013 at 9:00 PM, Anthony abasta...@gmail.com wrote: Are you comparing how long it takes to do 25 requests done in parallel to how long it takes to do 25 requests serially, or are you comparing how long it takes to do 25 request in parallel to how long it takes to do 1 request all by itself? You seem to be making the latter comparison and expecting the machine to be able to do 25 requests just as fast as it can do a single request. Instead, trying comparing: ab -n 50 -c 1 [url] Concurrency Level: 1 Time taken for tests: 5.791 seconds Complete requests: 50 Failed requests:0 Write errors: 0 Total transferred: 558150 bytes HTML transferred: 531500 bytes Requests per second:8.63 [#/sec] (mean) Time per request: 115.813 [ms] (mean) Time per request: 115.813 [ms] (mean, across all concurrent requests) Transfer rate: 94.13 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect:11 0.2 1 2 Processing:79 115 90.7 86 629 Waiting: 79 114 90.8 86 629 Total: 80 116 90.7 87 631 Percentage of the requests served within a certain time (ms) 50% 87 66% 90 75% 95 80% 98 90%218 95%240 98%631 99%631 100%631 (longest request) with ab -n 50 -c 25 [url] Concurrency Level: 25 Time taken for tests: 3.461 seconds Complete requests: 50 Failed requests:0 Write errors: 0 Total transferred: 558150 bytes HTML transferred: 531500 bytes Requests per second:14.45 [#/sec] (mean) Time per request: 1730.347 [ms] (mean) Time per request: 69.214 [ms] (mean, across all concurrent requests) Transfer rate: 157.50 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect:12 0.5 1 3 Processing: 392 1214 599.6 10932531 Waiting: 392 1214 599.6 10932531 Total:393 1216 599.6 10952533 WARNING: The median and mean for the initial connection time are not within a normal deviation These results are probably not that reliable. Percentage of the requests served within a certain time (ms) 50% 1095 66% 1520 75% 1650 80% 1762 90% 2118 95% 2203 98% 2533 99% 2533 100% 2533 (longest request) ab -n 500 -c 100 [url] Concurrency Level: 100 Time taken for tests: 29.829 seconds Complete requests: 500 Failed requests:1 (Connect: 0, Receive: 0, Length: 1, Exceptions: 0) Write errors: 0 Total transferred: 5581331 bytes HTML transferred: 5314831 bytes Requests per second:16.76 [#/sec] (mean) Time per request: 5965.761 [ms] (mean) Time per request: 59.658 [ms] (mean, across all concurrent requests) Transfer rate: 182.73 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect:12 1.8 1 9 Processing: 379 5392 2761.9 5080 14603 Waiting: 379 5391 2761.6 5080 14603 Total:387 5394 2761.1 5081 14605 Percentage of the requests served within a certain time (ms) 50% 5081 66% 6040 75% 6914 80% 7500 90% 9714 95% 10752 98% 11747 99% 12821 100% 14605 (longest request) and observe the *total time* taken for the entire 50 requests in each case. Regarding table definitions, yes, they do take up non-trivial amounts of CPU time. When you define a table, it calls the gluon.dal.Table.__init__ method -- check it out. Checking. Anthony On Tuesday, November 26, 2013 9:32:37 AM UTC-5, Saurabh Kumar wrote: On Tue, Nov 26, 2013 at 7:27 PM, Anthony abas...@gmail.com wrote: *Case 1:* Number of Tables in db.py: ~100 (all with migrate=False) No. of concurrent requests: 1 Time taken per request: 900 ms *Case 2:* Number of Tables in db.py: ~100 (all with migrate=False) No. of concurrent requests: 25 Time taken per request: 4440 ms For apples to apples comparison, you should look at the (mean, across all concurrent requests) value. In case #2, that is only 177.6 ms. With multiple concurrent requests, of course each request is going to take longer to complete from start to finish (each thread is sharing system
Re: [web2py] calling controller from view to retrieve data
On 26 Nov 2013, at 4:33 AM, Yebach vid.og...@gmail.com wrote: I menage to call my function that is in my default.py controler from my view but I cannot retrieve data that this function is suppose to retrieve function is called on button click to load some text from database into ACE editor this is some of my code in controler.py def load_last(): PgSQL = db_conn() cur = PgSQL.cursor() sql_read = SELECT file_text FROM datoteke WHERE id = (SELECT max(id) FROM datoteke) cur.execute(sql_read) ver = cur.fetchone()[0] print ver return dict(data = ver) in my editor.html view my java script code that should get data from def load_last functions is function load_last() { var editor = ace.edit(editor); editor.setValue(); $.ajax({ url: {{=URL('default', 'load_last')}}, data: {}, //WHAT DO I WRITE HERE success: function(){ console.log(neki je ratal); }, dataType: 'html' }); } I am really stuck here Put the common code in your model, or in a module. -- 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/groups/opt_out.
[web2py] Re: Unable to create Auth tables
It works! Thanks a lot Anthony! On Monday, November 25, 2013 9:34:18 PM UTC-5, Anthony wrote: web2py thinks it already created those tables (you dropped them outside of web2py, so it doesn't know they're gone). Try removing the associate *.table files in the /databases folder (they store the migration information for each table). Anthony On Monday, November 25, 2013 9:22:58 PM UTC-5, Julien Courteau wrote: (a) I did: drop table auth tables; auth tables == [auth_user, auth_group, etc...] in a sqlite3 shell; (b) I refresh my index page: web2py execute the auth.define_table() silently but no tables had been created (sql.log contains no create table). I tried to figure out what's happening without success. It did the same if I create a fresh new app. I use web2py 2.5.1. Any clues? How Could I do to figure out the problem? Thanks. -- 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/groups/opt_out.
Re: [web2py] Crypto()
Now I get the point! Thank you very much Jonathan. Marco Sent from my iPad On 26/nov/2013, at 16:41, Jonathan Lundell jlund...@pobox.com wrote: On 26 Nov 2013, at 2:05 AM, Mchurch mchurc...@gmail.com wrote: Dear all, I'm a little bit lost with Crypto method. I need authentication from a mobile app towards web2py. If I'm not in wrong, web2py now uses sha512 as default to crypt auth user password. From my iOS app I'm sending the password encrypted with the same Hash Algorithm sha512, because I don't want to send the password clear through the net From web2py console I can do: b='sha512$$83d97b71499bee6b9d42dee9d3a6e5d00ecc8c891346d25d1909b3aac9abaa0ad4864fe4eacf159cd3f4a0ad764178d014ac378dfffc5e4023f6dbcfb0992648' where b is exactly my mobile password string that I'm sending to web2py trough Json b 'sha512$$83d97b71499bee6b9d42dee9d3a6e5d00ecc8c891346d25d1909b3aac9abaa0ad4864fe4eacf159cd3f4a0ad764178d014ac378dfffc5e4023f6dbcfb0992648' a= CRYPT(digest_alg='sha512',salt=False)('pippo')[0] now ,if I do a==b, it returns True The problem is that I'm not able to compare auth.user password with my mobile password! Both are encrypted, with the same algorithm, but auth.login_bare(user,psw) returns alway false because it wants clear-password The solution to me appears that I have to compare the two encrypted password, but may be on the wrong way. Help please... Briefly: you don't want to do that. Why? In the scheme you propose, the hash effective becomes the password, and is stored as-if unhashed in the database, to be compared directly with what comes in over the wire. So if your database is compromised, the attacker can log into any account simply by presenting the password (hash) stored in the database. Compare that to the usual method, where the user transmits the password: the point of the hash is that the password cannot be reverse-engineered from the hash (if it's a good password!). Protecting the password in flight is easy enough: use https. -- 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 a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/tgIBbxzUBSA/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- 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/groups/opt_out.
Re: [web2py] Re: Web2py DAL slows down the server response when faced with multiple concurrent requests
ab -n 50 -c 1 [url] Concurrency Level: 1 Time taken for tests: 5.791 seconds Time per request: 115.813 [ms] (mean) Time per request: 115.813 [ms] (mean, across all concurrent requests) ab -n 50 -c 25 [url] Concurrency Level: 25 Time taken for tests: 3.461 seconds Time per request: 1730.347 [ms] (mean) Time per request: 69.214 [ms] (mean, across all concurrent requests) In both cases above, 50 requests were completed. In the case of concurrency=25, however, the 50 requests were completed faster (i.e., 3.46 seconds vs. 5.79 seconds in the serial case). So, with concurrent requests, the time per request dropped from 115ms to 69ms. Did you expect it to drop all the way down to 4.6ms (i.e., 115/25)? Anthony -- 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/groups/opt_out.
Re: [web2py] Re: Web2py DAL slows down the server response when faced with multiple concurrent requests
On Tue, Nov 26, 2013 at 9:32 PM, Anthony abasta...@gmail.com wrote: ab -n 50 -c 1 [url] Concurrency Level: 1 Time taken for tests: 5.791 seconds Time per request: 115.813 [ms] (mean) Time per request: 115.813 [ms] (mean, across all concurrent requests) ab -n 50 -c 25 [url] Concurrency Level: 25 Time taken for tests: 3.461 seconds Time per request: 1730.347 [ms] (mean) Time per request: 69.214 [ms] (mean, across all concurrent requests) In both cases above, 50 requests were completed. In the case of concurrency=25, however, the 50 requests were completed faster (i.e., 3.46 seconds vs. 5.79 seconds in the serial case). So, with concurrent requests, the time per request dropped from 115ms to 69ms. Did you expect it to drop all the way down to 4.6ms (i.e., 115/25)? No, not all the way down to 4.6 ms certainly, but to some intermediate small value. Look at this while serving static files: Serving 500 files with different concurrency. Concurrency Level: 1 Time taken for tests: 0.288 seconds Complete requests: 50 Failed requests:0 Write errors: 0 Total transferred: 2711700 bytes HTML transferred: 2692300 bytes Requests per second:173.85 [#/sec] (mean) Time per request: 5.752 [ms] (mean) Time per request: 5.752 [ms] (mean, across all concurrent requests) Transfer rate: 9207.35 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect:11 0.2 1 2 Processing: 45 1.0 4 8 Waiting:12 1.1 2 6 Total: 56 1.0 5 10 WARNING: The median and mean for the processing time are not within a normal deviation These results are probably not that reliable. Percentage of the requests served within a certain time (ms) 50% 5 66% 6 75% 6 80% 6 90% 7 95% 8 98% 10 99% 10 100% 10 (longest request) and Concurrency Level: 25 Time taken for tests: 0.049 seconds Complete requests: 50 Failed requests:0 Write errors: 0 Total transferred: 2711700 bytes HTML transferred: 2692300 bytes Requests per second:1020.26 [#/sec] (mean) Time per request: 24.504 [ms] (mean) Time per request: 0.980 [ms] (mean, across all concurrent requests) Transfer rate: 54036.05 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect:14 3.8 2 15 Processing: 7 17 7.6 18 34 Waiting:19 6.8 6 23 Total: 9 21 7.7 23 36 Percentage of the requests served within a certain time (ms) 50% 23 66% 26 75% 27 80% 27 90% 30 95% 35 98% 36 99% 36 100% 36 (longest request) I feel things will get much better once I optimize table definitions. Anthony -- 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 a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/rH1C7iXMPNA/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- 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/groups/opt_out.
Re: [web2py] Re: Web2py DAL slows down the server response when faced with multiple concurrent requests
In both cases above, 50 requests were completed. In the case of concurrency=25, however, the 50 requests were completed faster (i.e., 3.46 seconds vs. 5.79 seconds in the serial case). So, with concurrent requests, the time per request dropped from 115ms to 69ms. Did you expect it to drop all the way down to 4.6ms (i.e., 115/25)? No, not all the way down to 4.6 ms certainly, but to some intermediate small value. Look at this while serving static files: Serving static files is very different from having a web framework process dynamic requests. -- 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/groups/opt_out.
Re: [web2py] Re: Web2py DAL slows down the server response when faced with multiple concurrent requests
On Tue, Nov 26, 2013 at 8:42 PM, Ricardo Pedroso rmdpedr...@gmail.comwrote: How may cores do you have? Are all the cores being used when you run the tests? What webserver are you testing against? I have 4 cores, 16 GB RAM running Apache. But I think, this is irrelevant. Apache easily serves 1000 static file requests (which are not processed through web2y) with 100 concurrent connections on the same machine, with the largest response time being 133 ms. Every thing is relevant. Assuming that you are using an OS with sendfile support: Webservers are optimized to serve static content, you cannot expect to go near that with dynamic content. When doing static files serving, and in your case always the same file, the kernel will cache it and there is no disk access, also to serve the file you will not have the typical system calls in the user space (open/read/write) you will have only one system call sendfile that works in the kernel space. from https://httpd.apache.org/docs/2.2/misc/perf-tuning.html: If your OS supports a sendfile(2) system call, make sure you install the release and/or patches needed to enable it. (With Linux, for example, this means using Linux 2.4 or later. For early releases of Solaris 8, you may need to apply a patch.) On systems where it is available, sendfile enables Apache 2 to deliver static content faster and with lower CPU utilization. What I can suggest right know, and assuming that you have the database and webserver in the same machine, is to put the database in another machine. If you are doing the ab tests in the same machine, do it in another one. Ricardo -- 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/groups/opt_out.
Re: [web2py] Re: Web2py DAL slows down the server response when faced with multiple concurrent requests
I think as you say the problem is with table definition code, which I am trying to sort out. If you have any other suggestions regarding the same (speeding up and concurrency) please let me know. I am really thankful to all of you for helping me out :) See third bullet here: http://web2py.com/books/default/chapter/29/13/deployment-recipes#Efficiency-tricks Also, see http://web2py.com/books/default/chapter/29/04/the-core#Workflow for details on conditional models as well as http://web2py.com/books/default/chapter/29/04/the-core#markmin_response_models_to_run for more fine-grained control over which models get run. And of course, there is the DAL(..., lazy_tables=True) option. Anthony -- 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/groups/opt_out.
Re: [web2py] Re: Web2py DAL slows down the server response when faced with multiple concurrent requests
And to see how much you loose when doing dynamic serving against static content serving, just create a web2py application with only one file: models/0.py: raise HTTP(200, 'OK') On Tue, Nov 26, 2013 at 4:40 PM, Anthony abasta...@gmail.com wrote: I think as you say the problem is with table definition code, which I am trying to sort out. If you have any other suggestions regarding the same (speeding up and concurrency) please let me know. I am really thankful to all of you for helping me out :) See third bullet here: http://web2py.com/books/default/chapter/29/13/deployment-recipes#Efficiency-tricks Also, see http://web2py.com/books/default/chapter/29/04/the-core#Workflow for details on conditional models as well as http://web2py.com/books/default/chapter/29/04/the-core#markmin_response_models_to_run for more fine-grained control over which models get run. And of course, there is the DAL(..., lazy_tables=True) option. Anthony -- 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/groups/opt_out. -- 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/groups/opt_out.
Re: [web2py] Re: Web2py DAL slows down the server response when faced with multiple concurrent requests
I am NOT comparing the static files and dynamic requests. I was just illustrating the behaviour I am expecting wrt concurrency. I understand how Linux kernel and Apache works to some extent. All I am trying to do is *25* light concurrent requests [in which controller looks like the following] with decent response time. Currently it is going down to 5-6 seconds. Is it an absurd expectation on a 4 core, 16G machine? def controller(): return Saurabh On Tue, Nov 26, 2013 at 10:06 PM, Ricardo Pedroso rmdpedr...@gmail.comwrote: On Tue, Nov 26, 2013 at 8:42 PM, Ricardo Pedroso rmdpedr...@gmail.comwrote: How may cores do you have? Are all the cores being used when you run the tests? What webserver are you testing against? I have 4 cores, 16 GB RAM running Apache. But I think, this is irrelevant. Apache easily serves 1000 static file requests (which are not processed through web2y) with 100 concurrent connections on the same machine, with the largest response time being 133 ms. Every thing is relevant. Assuming that you are using an OS with sendfile support: Webservers are optimized to serve static content, you cannot expect to go near that with dynamic content. When doing static files serving, and in your case always the same file, the kernel will cache it and there is no disk access, also to serve the file you will not have the typical system calls in the user space (open/read/write) you will have only one system call sendfile that works in the kernel space. from https://httpd.apache.org/docs/2.2/misc/perf-tuning.html: If your OS supports a sendfile(2) system call, make sure you install the release and/or patches needed to enable it. (With Linux, for example, this means using Linux 2.4 or later. For early releases of Solaris 8, you may need to apply a patch.) On systems where it is available, sendfileenables Apache 2 to deliver static content faster and with lower CPU utilization. What I can suggest right know, and assuming that you have the database and webserver in the same machine, is to put the database in another machine. If you are doing the ab tests in the same machine, do it in another one. Ricardo -- 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 a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/rH1C7iXMPNA/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- 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/groups/opt_out.
[web2py] Re: Web2py DAL slows down the server response when faced with multiple concurrent requests
100 table definitions make it look like this project scope has grown a little bit too big. Have you considered breaking the project into more than one web2py application? -- 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/groups/opt_out.
Re: [web2py] Re: Web2py DAL slows down the server response when faced with multiple concurrent requests
On Tue, Nov 26, 2013 at 10:14 PM, Ricardo Pedroso rmdpedr...@gmail.comwrote: And to see how much you loose when doing dynamic serving against static content serving, just create a web2py application with only one file: models/0.py: raise HTTP(200, 'OK') Yes, I tried something similar and it worked well. Its all about loading models which I am going to optimize now. My original doubt was why models are loading slowly. I have got some useful inputs on that part :) On Tue, Nov 26, 2013 at 4:40 PM, Anthony abasta...@gmail.com wrote: I think as you say the problem is with table definition code, which I am trying to sort out. If you have any other suggestions regarding the same (speeding up and concurrency) please let me know. I am really thankful to all of you for helping me out :) See third bullet here: http://web2py.com/books/default/chapter/29/13/deployment-recipes#Efficiency-tricks Also, see http://web2py.com/books/default/chapter/29/04/the-core#Workflow for details on conditional models as well as http://web2py.com/books/default/chapter/29/04/the-core#markmin_response_models_to_run for more fine-grained control over which models get run. And of course, there is the DAL(..., lazy_tables=True) option. Anthony -- 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/groups/opt_out. -- 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 a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/rH1C7iXMPNA/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- 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/groups/opt_out.
Re: [web2py] web2py routes.py
It's really strange. I've try this example from the manual: routes_in = ( ('/testme', '/examples/default/index'), ) routes_out = ( ('/examples/default/index', '/testme'), ) On the first time I load www.mydomain.com I've examples application on root, and if I click on some menu items I turn back on www.mydomain.com/examples/default/download . If I turn back on root it turn back like before, www.mydomain.com/welcome/default/index Really strange. Of course www.mydomain.com/testme turn back invalid request. Could I have any help on this topic ? Thanks. Il giorno lunedì 25 novembre 2013 09:27:52 UTC+1, Gael Princivalle ha scritto: For example I've got 3 stupid pages exactly the same, 2 pages are ok but for one I have an invalid request. I turn back to pages that were ok and I have again Invalid request. I've try also renaming myapp in init but in the path I've got www.mydomain.com/init/default/pagehttp://www.google.com/url?q=http%3A%2F%2Fwww.mydomain.com%2Finit%2Fdefault%2Fpagesa=Dsntz=1usg=AFQjCNEFDsi4yiMy6Im6xBTXc_n2qgzQvw, too bad. Any solution ? Il giorno domenica 24 novembre 2013 23:04:26 UTC+1, Jonathan Lundell ha scritto: On 24 Nov 2013, at 1:21 PM, Gael Princivalle gaelpri...@gmail.com wrote: I've got a domain that is on Webfaction, with a web2py app. I just want to have my app on the domain root. Now I have: https://www.mydomain.com/myapp/default/indexhttps://www.google.com/url?q=https%3A%2F%2Fwww.mydomain.com%2Fmyapp%2Fdefault%2Findexsa=Dsntz=1usg=AFQjCNGSXhjuzW5iDqORpWZliHHHpwnYLA I would like to see my app on : https://www.mydomain.comhttps://www.google.com/url?q=https%3A%2F%2Fwww.mydomain.com%2Fsa=Dsntz=1usg=AFQjCNF6xvLmWSuLSRX5NWjK12L_MqbUng I've read that: http://web2py.com/book/default/chapter/04#Parameter-based-systemhttp://www.google.com/url?q=http%3A%2F%2Fweb2py.com%2Fbook%2Fdefault%2Fchapter%2F04%23Parameter-based-systemsa=Dsntz=1usg=AFQjCNGcjzvzp1eHksIlNqI9tuVcAv9arQ and put a router.py file in my web2py folder with: routers = dict( BASE = dict(default_application='myapp'), ) Sometimes it works, and sometimes not, admin is ko. Someone can help me ? Can you be more specific? In particular, a specific example of what it does when it doesn't work. -- 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/groups/opt_out.
Re: [web2py] Re: Web2py DAL slows down the server response when faced with multiple concurrent requests
On Tue, Nov 26, 2013 at 4:44 PM, Saurabh Kumar saurabh.ca...@gmail.comwrote: I am NOT comparing the static files and dynamic requests. I was just illustrating the behaviour I am expecting wrt concurrency. I understand how Linux kernel and Apache works to some extent. All I am trying to do is *25* light concurrent requests [in which controller looks like the following] with decent response time. Currently it is going down to 5-6 seconds. Is it an absurd expectation on a 4 core, 16G machine? def controller(): return As an experimentation, just lower the threads that apache spawns to for eg 4, and see if you notice any difference. Ricardo -- 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/groups/opt_out.
Re: [web2py] Re: Web2py DAL slows down the server response when faced with multiple concurrent requests
I think l should first try lazy loading and other stuff. I hope that it should work that way. On Tue, Nov 26, 2013 at 10:18 PM, Leonel Câmara leonelcam...@gmail.comwrote: 100 table definitions make it look like this project scope has grown a little bit too big. Have you considered breaking the project into more than one web2py application? -- 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 a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/rH1C7iXMPNA/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- 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/groups/opt_out.
Re: [web2py] Re: Web2py DAL slows down the server response when faced with multiple concurrent requests
On Tue, Nov 26, 2013 at 10:22 PM, Ricardo Pedroso rmdpedr...@gmail.comwrote: On Tue, Nov 26, 2013 at 4:44 PM, Saurabh Kumar saurabh.ca...@gmail.comwrote: I am NOT comparing the static files and dynamic requests. I was just illustrating the behaviour I am expecting wrt concurrency. I understand how Linux kernel and Apache works to some extent. All I am trying to do is *25* light concurrent requests [in which controller looks like the following] with decent response time. Currently it is going down to 5-6 seconds. Is it an absurd expectation on a 4 core, 16G machine? def controller(): return As an experimentation, just lower the threads that apache spawns to for eg 4, and see if you notice any difference. Yes makes sense. Will try :) Ricardo -- 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 a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/rH1C7iXMPNA/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- 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/groups/opt_out.
Re: [web2py] calling controller from view to retrieve data
You mean I insert the controller code into model? -- 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/groups/opt_out.
[web2py] Re: uwsgi threads
Threads make things slower (if you have multiple cores) but prevent one client to hang the server and affect others. You do it for concurrency, not for parallelization. On Tuesday, 26 November 2013 01:00:35 UTC-6, Jayadevan M wrote: The script https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-nginx-uwsgi-centos64.shhttps://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fweb2py%2Fweb2py%2Fblob%2Fmaster%2Fscripts%2Fsetup-web2py-nginx-uwsgi-centos64.shsa=Dsntz=1usg=AFQjCNHTY4qtthAmtf1_wrAL4xigTljnWw does UWSGI_OPTIONS=--enable-threads Elsewhere I read that for python, it is better not to enable threads. Anyway, even with this, I see *** Python threads support is disabled. You can enable it with --enable-threads *** in uwsgi log file. Should we have the enable-threads option? Why am I getting the threads disabled message? -- 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/groups/opt_out.
Re: [web2py] web2py routes.py
On Tuesday, November 26, 2013 8:51:45 AM UTC-8, Gael Princivalle wrote: It's really strange. I've try this example from the manual: routes_in = ( ('/testme', '/examples/default/index'), ) routes_out = ( ('/examples/default/index', '/testme'), ) On the first time I load www.mydomain.comhttp://www.google.com/url?q=http%3A%2F%2Fwww.mydomain.comsa=Dsntz=1usg=AFQjCNGAaGH_NMwPluEnZ5Ra7_1AuZfCoQI've examples application on root, and if I click on some menu items I turn back on www.mydomain.com/examples/default/downloadhttp://www.google.com/url?q=http%3A%2F%2Fwww.mydomain.com%2Fexamples%2Fdefault%2Fdownloadsa=Dsntz=1usg=AFQjCNGIYoXId_BqwIKDy9QC-sMDrApjDg. I'm sorry, I'm having trouble understanding this statement. I turn back is confusing me ... are you saying that the link takes you to the URL .../default/download ? (your routes.py appears to be only translating default/index -- did you want default/download translated as well?) If I turn back on root it turn back like before, www.mydomain.com/welcome/default/indexhttp://www.google.com/url?q=http%3A%2F%2Fwww.mydomain.com%2Fwelcome%2Fdefault%2Findexsa=Dsntz=1usg=AFQjCNG3FIdXmu49xYUuGod8DfZ_hb_WYQ I think you're using turn back in 2 different ways here ... turn back on root suggests to me that you are using the browser back button to try to get to .../testme, and then turn back like before to indicate the URL shows as default/index. Am I close to understanding you? /dps Really strange. Of course www.mydomain.com/testmehttp://www.google.com/url?q=http%3A%2F%2Fwww.mydomain.com%2Ftestmesa=Dsntz=1usg=AFQjCNHYsJmfM259bUsd_Kz0xad0ax74pAturn back invalid request. Could I have any help on this topic ? Thanks. Il giorno lunedì 25 novembre 2013 09:27:52 UTC+1, Gael Princivalle ha scritto: For example I've got 3 stupid pages exactly the same, 2 pages are ok but for one I have an invalid request. I turn back to pages that were ok and I have again Invalid request. I've try also renaming myapp in init but in the path I've got www.mydomain.com/init/default/pagehttp://www.google.com/url?q=http%3A%2F%2Fwww.mydomain.com%2Finit%2Fdefault%2Fpagesa=Dsntz=1usg=AFQjCNEFDsi4yiMy6Im6xBTXc_n2qgzQvw, too bad. Any solution ? Il giorno domenica 24 novembre 2013 23:04:26 UTC+1, Jonathan Lundell ha scritto: On 24 Nov 2013, at 1:21 PM, Gael Princivalle gaelpri...@gmail.com wrote: I've got a domain that is on Webfaction, with a web2py app. I just want to have my app on the domain root. Now I have: https://www.mydomain.com/myapp/default/indexhttps://www.google.com/url?q=https%3A%2F%2Fwww.mydomain.com%2Fmyapp%2Fdefault%2Findexsa=Dsntz=1usg=AFQjCNGSXhjuzW5iDqORpWZliHHHpwnYLA I would like to see my app on : https://www.mydomain.comhttps://www.google.com/url?q=https%3A%2F%2Fwww.mydomain.com%2Fsa=Dsntz=1usg=AFQjCNF6xvLmWSuLSRX5NWjK12L_MqbUng I've read that: http://web2py.com/book/default/chapter/04#Parameter-based-systemhttp://www.google.com/url?q=http%3A%2F%2Fweb2py.com%2Fbook%2Fdefault%2Fchapter%2F04%23Parameter-based-systemsa=Dsntz=1usg=AFQjCNGcjzvzp1eHksIlNqI9tuVcAv9arQ and put a router.py file in my web2py folder with: routers = dict( BASE = dict(default_application='myapp'), ) Sometimes it works, and sometimes not, admin is ko. Someone can help me ? Can you be more specific? In particular, a specific example of what it does when it doesn't work. -- 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/groups/opt_out.
[web2py] jsonify equivalent in web2py
Hi, I am trying to merge sphinx generated documents to a web2py application using sphinx.websupport [1]. I am stuck to get commenting working. Namely, according to [1], a _get_comment controller ought to return jsonify object when using flask. My question is what would be jsonify(..) equivalent in web2py? Any hints are appreciated, Pearu [1] http://sphinx-doc.org/web/quickstart.html -- 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/groups/opt_out.
[web2py] Re: jsonify equivalent in web2py
from gluon.serializers import json def whatever(): return json(object) On Tuesday, November 26, 2013 9:26:04 PM UTC+1, Pearu Peterson wrote: Hi, I am trying to merge sphinx generated documents to a web2py application using sphinx.websupport [1]. I am stuck to get commenting working. Namely, according to [1], a _get_comment controller ought to return jsonify object when using flask. My question is what would be jsonify(..) equivalent in web2py? Any hints are appreciated, Pearu [1] http://sphinx-doc.org/web/quickstart.html -- 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/groups/opt_out.
[web2py] Cron job every 30 seconds
Is is possible to set up a cron job to run every 30 seconds instead of a minute? I have a function that does an HTTP GET request to retrieve some values from another server (a small server running on a microcontroller) and then saves those values in the database. I want to run this function every 30 seconds in the background. Thank you for the help! -- 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/groups/opt_out.
[web2py] Re: jsonify equivalent in web2py
Perfect! That's exactly what I needed. To be exact, `jsonify(**data)` is equivalent to `json(data)`. Thanks, Pearu On Tuesday, November 26, 2013 10:54:30 PM UTC+2, Niphlod wrote: from gluon.serializers import json def whatever(): return json(object) On Tuesday, November 26, 2013 9:26:04 PM UTC+1, Pearu Peterson wrote: Hi, I am trying to merge sphinx generated documents to a web2py application using sphinx.websupport [1]. I am stuck to get commenting working. Namely, according to [1], a _get_comment controller ought to return jsonify object when using flask. My question is what would be jsonify(..) equivalent in web2py? Any hints are appreciated, Pearu [1] http://sphinx-doc.org/web/quickstart.html -- 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/groups/opt_out.
[web2py] Re: FDB (firebird) adapter can't store blobs greater than 64k
Hi, I was watching this. I have a little dizzy with the code. Now I can not prove. The solution is to redefine represent_exceptions in FireBirdAdapter? It is that way? José -- 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/groups/opt_out.
[web2py] Insert many-to-many
You can get all the many to many relationship with table.many_to_many_.select() but is there a way to insert the relationship when you create the row? like db.table.insert(dict(field1=1, field2=2, manytomanytable={x_id}) ? -- 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/groups/opt_out.
[web2py] LDAP Auth
I am in this situation where my team is in the process of migrating our ldap servers to the vpc and as a result I must update my applications to use secure ldap. I have unfortunately run into an issue with ldap_auth where it will use secure ldap but it only takes a ca cert file, but I need to use ca cert, cert and key files all together. This is possible directly through python-ldap like so: con.set_option(ldap.OPT_X_TLS_CACERTFILE, cacert_file) con.set_option(ldap.OPT_X_TLS_CERTFILE, cert_file) con.set_option(ldap.OPT_X_TLS_KEYFILE, key_file) but doesn't appear to be an option at all through the ldap_auth wrapper provided through web2py. I am having to modify this code manually to make this work. I'm just curious why these 2 other files aren't options and the ca cert is the only option? Thanks -- 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/groups/opt_out.
[web2py] Re: Form self-submit broken after redirection
Sorry for the slow response. From within my main view, at the end, I do this: script $(document).ready(function() { {{if auth.is_logged_in() and session.state:}} $(#mydialog).dialog(open); web2py_component({{= URL('mycontroller', 'index')}}, mydialog); {{pass}} }); /script As I write this, I'm remembering how I once wondered why web2py_component doesn't have a user_signature parameter? But that maybe is unrelated to this discussion ('tho if you have an answer to that question, too, it would be nice to know). So basically, if a dialog is open to a particular form and the user hits reload, the main page sees that there's a state variable so it opens a dialog and squirts the appropriate form back into the dialog. But then, the form won't self-submit. On Friday, November 22, 2013 10:05:19 PM UTC+8, Anthony wrote: I tried your code and it works fine for me. Maybe we need to see more of the code and understand the workflow better. On Friday, November 22, 2013 7:55:50 AM UTC-5, weheh wrote: It works like this: # index controller def index(): # some preamble if session.state == 'a': redirect(URL('thiscontoller', 'myfunc1.load', user_signature=True )) # some more states and redirects #later on @auth.requires_signature() def myfunc1(): form = SQLFORM.factory(Field(...the usual stuff, nothing fancy...), Field(...), Field(...)) if form.process().accepted: # process form elif form.errors: response.flash = 'error' return dict(html=form) If myfunc1 is called directly it self-submits fine. But if is reached via the index function, which is triggered by a page reload, the form won't self submit. Hope that clarifies. Must be something really dumb-a** simple but I'm not seeing it. -- 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/groups/opt_out.
[web2py] Re: how to hide the [wiki] menu option in auth.wiki
I'm using web2py 2.7.4-stable+timestamp.2013.11.25.15.21.21 but it doesn't appear that the patch for this is in yet. However, instead of doing the removal of the Wiki link with jQuery on the client, which is susceptible to being hacked by a savvy user, the following may be more secure: To the layout.html or equivalent, add the following line {{if auth.user and (not auth.has_membership('wiki_editor', auth.user.id) andresponse .menu[-1][0].m=='[Wiki]'): response.menu.pop()}} before {{=MENU(response.menu, _class='mobile-menu nav' if is_mobile else 'nav', mobile=is_mobile,li_class='dropdown',ul_class='dropdown-menu')}} On Thursday, 25 October 2012 16:44:08 UTC+8, Andrew W wrote: the [wiki] menu option is good for the person maintaining the website, but shouldn't be seen by others (at least those not logged in) . How do I hide it for unauthorised users ? Any update on when the book will contain auth.wiki information ? I can see plugin_wiki still there. Thanks Andrew W -- 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/groups/opt_out.
[web2py] Running Scheduler in Openshift with Web2py
Hi I'm currently running web2py in an openshift instance using [1]https://github.com/prelegalwonder/openshift_web2py But I'm quite unsure of how to run the scheduler (needed by mi application) within the instance of openshift. Any help I'll be very thankful :) [1] https://github.com/prelegalwonder/openshift_web2py -- 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/groups/opt_out.
[web2py] Web2py on ARM8 V5 embedded systems, how much RAM needed to run properly
Hello dear web2py users ! First of all, sorry about my bad english. We want to develope a small server application to an ARM8 V5 embedded system with a Linux distribution. The hardware have only 64MB of RAM. Max 1-2 user browsing at the same time (it will be a setup application for the device). We will use SQLite to store data. 1. variation: We use the web2py with the rocket server included. 2. variation: We use web2py with lighthttpd. Question: Is the web2py application will run on this device? Thank you very much in advance! Best regards: Istvan -- 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/groups/opt_out.
[web2py] Formatting the Time Field
Having a hard time figuring out this one and after googling my eyeballs off Im here to beg for someone to throw me a bone, here is my code: MODEL: db.define_table('timecard_entry', Field('timecard', 'reference timecard', readable=False, writable=False,), Field('company', 'reference company', label='Company'), Field('tc_start', 'time', requires = IS_DATETIME(format=T('%H:%M %p')), label='Start'), #Formatting Does nothing Field('tc_stop', 'time', requires = IS_DATETIME(format=T('%H:%M')), label='Stop'), #Here either Field('st' , 'double', label='ST'), Field('ot' , 'double', label='OT'), Field('dt' , 'double', label='DT'), Field('tc_classification' ,'string', label='Classification'), auth.signature) CONTROLLER: def build_timecard(): id= request.args(0,cast=int) timecard = db.timecard(id) db.timecard_entry.timecard.default = timecard.id form=SQLFORM(db.timecard_entry).process() rows=db(db.timecard_entry.timecard==db.timecard(id)).select(orderby=db.timecard_entry.tc_start) return locals() This Form Gives me 04:10:19 format for time... How do i change that to be H:M p format such as 04:10 AM? Am I just missing something somewhere? Also are there any validators I can use to have the time be only hours and half hours accepted? for example 8:30 AM and 8:00 AM works but 8:15 AM does not? Thanks in advance! and for the great community really learning a lot from this forum and Massimo's videos -- 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/groups/opt_out.
[web2py] Files toggle sidebar pop-up on initial page load
Hello, In the admin web2py OOB application, when you edit a file, the Files Toggle sidebar pops up every time on initial page load. Does anyone know if there is a setting/code change I could make to stop the sidebar from popping up? I looked through the js code that loads with the edit page but couldn't find the line that sets this behaviour (I suspected a toggle on the #files div). https://lh6.googleusercontent.com/-LaStuHfY4_Y/UpVioYHHjUI/Dnc/E-Wa3W6ey2w/s1600/files-toggle.png Thanks, Bogdan Nechita -- 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/groups/opt_out.
[web2py] Re: Web2py on ARM8 V5 embedded systems, how much RAM needed to run properly
It should run, with or without rocket. Let us know. On Tuesday, 26 November 2013 09:44:17 UTC-6, István Györfi wrote: Hello dear web2py users ! First of all, sorry about my bad english. We want to develope a small server application to an ARM8 V5 embedded system with a Linux distribution. The hardware have only 64MB of RAM. Max 1-2 user browsing at the same time (it will be a setup application for the device). We will use SQLite to store data. 1. variation: We use the web2py with the rocket server included. 2. variation: We use web2py with lighthttpd. Question: Is the web2py application will run on this device? Thank you very much in advance! Best regards: Istvan -- 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/groups/opt_out.
[web2py] Re: Files toggle sidebar pop-up on initial page load
I find it annoying too. Perhaps the default behavior should be for it to stay closed. On Tuesday, 26 November 2013 21:16:13 UTC-6, Bogdan Nechita wrote: Hello, In the admin web2py OOB application, when you edit a file, the Files Toggle sidebar pops up every time on initial page load. Does anyone know if there is a setting/code change I could make to stop the sidebar from popping up? I looked through the js code that loads with the edit page but couldn't find the line that sets this behaviour (I suspected a toggle on the #files div). https://lh6.googleusercontent.com/-LaStuHfY4_Y/UpVioYHHjUI/Dnc/E-Wa3W6ey2w/s1600/files-toggle.png Thanks, Bogdan Nechita -- 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/groups/opt_out.
[web2py] Re: Formatting the Time Field
On Tuesday, November 26, 2013 4:16:49 PM UTC-8, Jesse Ferguson wrote: Having a hard time figuring out this one and after googling my eyeballs off Im here to beg for someone to throw me a bone, here is my code: MODEL: db.define_table('timecard_entry', Field('timecard', 'reference timecard', readable=False, writable=False,), Field('company', 'reference company', label='Company'), Field('tc_start', 'time', requires = IS_DATETIME(format=T('%H:%M %p')), label='Start'), #Formatting Does nothing Field('tc_stop', 'time', requires = IS_DATETIME(format=T('%H:%M')), label='Stop'), #Here either Do you really need the DB field to be hours and minutes, or would *displaying it* as hours and minutes be good enough? Um, no, I guess ... you want to restrict the user to *entering* hours and minutes (and we see below that you want to further restrict what minutes are allowed. But once the input is validated, the DB can hold a normal datetime field, right? Field('st' , 'double', label='ST'), Field('ot' , 'double', label='OT'), Field('dt' , 'double', label='DT'), Field('tc_classification' ,'string', label='Classification'), auth.signature) CONTROLLER: def build_timecard(): id= request.args(0,cast=int) timecard = db.timecard(id) db.timecard_entry.timecard.default = timecard.id form=SQLFORM(db.timecard_entry).process() rows=db(db.timecard_entry.timecard==db.timecard(id)).select(orderby=db.timecard_entry.tc_start) return locals() This Form Gives me 04:10:19 format for time... How do i change that to be H:M p format such as 04:10 AM? Am I just missing something somewhere? Also are there any validators I can use to have the time be only hours and half hours accepted? for example 8:30 AM and 8:00 AM works but 8:15 AM does not? That doesn't sound like one of the validators that comes pre-cooked, but I think (says the newbie) that I've seen recent posts describing how to concatenate multiple validators on a field, and I'm going to make a baseless claim that writing your own to check that minutes is 0 or 30 will be easy, and then just concatenate it after the IS_DATETIME. Thanks in advance! and for the great community really learning a lot from this forum and Massimo's videos /dps -- 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/groups/opt_out.
[web2py] Re: Strange Issue with Executesql
Querying out 47K rows is taking 4.5-5.5 seconds on my laptop (and its specs are nothing special). Not sure how the complexity of my query compares to yours but 20-150 seconds seems slow. Heck I can get back over 800K rows in about 75 seconds. BTW, running the same queries in SQL Server Management Studio is taking basically the same amount of time as in web2py; web2py is a tad slower but we're talking fractions to a 10 seconds depending on # of records. This is with the MSSQL Express instance running on localhost; having to go to a different server would certainly slow things down but I'm assuming you're not doing that. You may want to use the Management Studio to run the query with Query - Include Actual Execution Plan and see if it suggests any indexes to help speed things up DB side. Don't know what's is going wrong in your setup. Perhaps try executing the query directly with the appropriate pyodbchttps://code.google.com/p/pyodbc/calls to be sure something in the DAL isn't causing the issue? (Though that's pretty much what executesql does anyway.) I guess if your work-around of breaking the query into smaller chunks and re-combining in your code works reliably then I'd just stick with it at this point. On Monday, November 25, 2013 1:02:57 PM UTC-6, Josh Myers wrote: @Brian - The minute I sent you the email the problem returned. I ran the following code: test = db1.executesql('select * from table') print test print len(test) print test yields None Exception thrown from line print len(test): type 'exceptions.TypeError' object of type 'NoneType' has no len() Seeing as this JUST worked 10 minutes ago and the time to run has been varying today from 20 up to 150 seconds, I am guessing this is a database issue of some kind. Thanks for your help. If you have any quick thoughts, then please pass along, but otherwise I do not expect you to spend any more time helping me with my problem as I know you have done a lot for me already. -- 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/groups/opt_out.
Re: [web2py] Re: Saving incomplete form with required fields (to prevent dynamically added form inputs from disappear
Yep, the finished field will prevent the unfinished records from being exposed where they shouldn't be. On Mon, Nov 25, 2013 at 11:15 AM, Dave S snidely@gmail.com wrote: On Saturday, November 23, 2013 11:44:05 PM UTC-8, Mark Li wrote: I think I've found an optimal solution for this. Since the validators for my table are only enforced at the form-level, I first insert a blank playlists record, and then use a SQLFORM or CRUD to update the newly inserted record. I can't submit an incomplete form, but I can insert an incomplete record and mark the finished column as false. This way, the playlist id already exists and I can save the playlist_tracks to the reference table. The validators will still apply when the user submits the form. As long as the finished field is adequate protection from having an incomplete or invalid entry messing up some of your db table processing at a later time if the user doesn't correct the form. I think I would have done something with storing partials in the session, but maybe one the Respected Regulars has some alternative advice. /dps On Saturday, November 23, 2013 6:50:19 PM UTC-8, Mark Li wrote: I currently have 2 tables as follows, with a form containing values both tables db.define_table('playlist', Field('title', notnull=True), Field('description'), Field('tags'), Field('genre', 'reference genre') Field('finished', 'boolean') ) db.define_table('playlist_tracks', Field('playlist', 'reference playlist'), Field('songname') ) The form to add playlist_tracks is dynamic; a user enters a songname, which appends an input element with value=songname. When the user submits the form, if the form does not pass validation, then the playlist_tracks will all disappear when the page reloads, since they were added dynamically. I want to prevent this from happening, as it can be very time consuming to add all the playlist tracks. I want to save the playlist_tracks in the reference table so they don't disappear, but it's not possible because there is no 'playlist' reference (the playlist didn't pass validation). I also want to give the user the option of saving an incomplete form to work on later, which has the same problem because the incomplete form might not pass validation, and thus there is no 'playlist' reference. What would be the best method of saving this incomplete form, so the dynamically added playlist tracks will have a playlist reference? I was thinking about inserting the record with dummy default values, after validation fails, but that has the disadvantage of automatically filling a required field that the user didn't choose. For example, if a user doesn't enter a title and doesn't select a genre from the select drop-down, then after validation fails, I'll insert the record with Untitled Playlist and genre==1 (and all other fields that passed validation would remain unchanged) but still show the form errors. -- 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 a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/GG0oaBNSthE/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- 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/groups/opt_out.