Re: [web2py] Reload routes command line?

2012-10-03 Thread Corne Dickens
Op woensdag 3 oktober 2012 00:42:47 UTC+2 schreef rochacbruno het volgende: You could do that from the command line, too, with a python script. I understood that it need to run under the current running environment right? if I have a server running (apache) and I open a web2py console I

Re: [web2py] Re: framework benchmarks - web2py surprisingly slow?

2012-10-03 Thread Niphlod
I was excited too, never thought that tornado runs on Windows, where no epoll/kqueue is available. However, I'm ok with having a normal webserver (performance-wise, I expect to be at least fast as rocket/cherrypy) on Windows but a speedup under Linux, then I bumped into this

Re: [web2py] Re: framework benchmarks - web2py surprisingly slow?

2012-10-03 Thread Niphlod
Ok, with some modifications can be run on windows with anyserver.py . So, I remain with one only doubt ... is tornado on Windows fully tested ? def motor(app, address, **options): import motor app = motor.WSGIContainer(app) http_server = motor.HTTPServer(app)

Re: [web2py] Re: framework benchmarks - web2py surprisingly slow?

2012-10-03 Thread Ricardo Pedroso
On Wed, Oct 3, 2012 at 9:40 AM, Niphlod niph...@gmail.com wrote: Ok, with some modifications can be run on windows with anyserver.py . So, I remain with one only doubt ... is tornado on Windows fully tested ? def motor(app, address, **options): import motor app =

Re: [web2py] Re: framework benchmarks - web2py surprisingly slow?

2012-10-03 Thread Ricardo Pedroso
On Wed, Oct 3, 2012 at 9:14 AM, Niphlod niph...@gmail.com wrote: I was excited too, never thought that tornado runs on Windows, where no epoll/kqueue is available. However, I'm ok with having a normal webserver (performance-wise, I expect to be at least fast as rocket/cherrypy) on Windows but

Re: [web2py] Re: framework benchmarks - web2py surprisingly slow?

2012-10-03 Thread Ricardo Pedroso
On Wed, Oct 3, 2012 at 5:56 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Please open a ticket your your proposal and the link. This is a serious possibility! Can the monolitic build be automated? I guess so, but don't know how without enter in the lex/yacc world. Probably not worth

Re: [web2py] Re: framework benchmarks - web2py surprisingly slow?

2012-10-03 Thread Niphlod
Well, seems to work. I'd need to know if there is some way to test if all web2py framework works on on this, but a normal app seems to do pretty fine. Windows Vista (aaargh!), PortablePython 2.7.3 32-bit, T8100 2.10Ghz, 3 GB RAM, adjusted softcron in anyserver.py (to allow removal) in order to

Re: [web2py] Re: framework benchmarks - web2py surprisingly slow?

2012-10-03 Thread David Marko
The speed difference is huge! Dne středa, 3. října 2012 11:35:06 UTC+2 Niphlod napsal(a): Well, seems to work. I'd need to know if there is some way to test if all web2py framework works on on this, but a normal app seems to do pretty fine. Windows Vista (aaargh!), PortablePython 2.7.3

Re: [web2py] Re: framework benchmarks - web2py surprisingly slow?

2012-10-03 Thread Ricardo Pedroso
On Wed, Oct 3, 2012 at 10:35 AM, Niphlod niph...@gmail.com wrote: Well, seems to work. I'd need to know if there is some way to test if all web2py framework works on on this, but a normal app seems to do pretty fine. Windows Vista (aaargh!), PortablePython 2.7.3 32-bit, T8100 2.10Ghz, 3 GB

Re: [web2py] Re: framework benchmarks - web2py surprisingly slow?

2012-10-03 Thread Niphlod
me too. The default webserver is not - usually - meant for production anyway. I started the test with the idea let's see if tornado on windows (i.e. without all the goodies of select/epoll) can be at least comparable with a threaded server. PS: cherrypy (and rocket) uses a separate thread for

Re: [web2py] Reload routes command line?

2012-10-03 Thread lyn2py
Thank you guys, I'm gonna try this out on the production On Wednesday, October 3, 2012 6:49:31 AM UTC+8, Jonathan Lundell wrote: On 2 Oct 2012, at 3:42 PM, Bruno Rocha rocha...@gmail.com javascript: wrote: You could do that from the command line, too, with a python script. I understood

Re: [web2py] formwizard with 2 tables : - not working ! .. please help !

2012-10-03 Thread Le Don X
Actually, when the tables are used by themselves ! with a simple controller The first one ( auth_user ) works perfectly ... datas are recorded but the second one ( user_info ) gives me a clear error on 2.0.9 stable version type 'exceptions.RuntimeError' Unable to handle upload but with the

Re: [web2py] formwizard with 2 tables : - not working ! .. please help !

2012-10-03 Thread Le Don X
Here is another controller I tried, and I still get the same results ( no data is recorder in the tables, no errors or ticket given ) and on the last submit button .. nothing happens : def register(): import os STEPS = {0:

Re: [web2py] Re: framework benchmarks - web2py surprisingly slow?

2012-10-03 Thread Ricardo Pedroso
On Wed, Oct 3, 2012 at 11:31 AM, Niphlod niph...@gmail.com wrote: me too. The default webserver is not - usually - meant for production anyway. I started the test with the idea let's see if tornado on windows (i.e. without all the goodies of select/epoll) can be at least comparable with a

Re: [web2py] formwizard with 2 tables : - not working ! .. please help !

2012-10-03 Thread Massimo Di Pierro
The mytables variable ony has values in steps 0,1 but you loop over it for insert only in step 2 (when it is not defined). You do not get an error probably because it already defined in the outer scope. On Wednesday, 3 October 2012 06:23:36 UTC-5, Don_X wrote: Here is another controller I

Re: [web2py] Re: framework benchmarks - web2py surprisingly slow?

2012-10-03 Thread Niphlod
I got that part (barman and beers are nice :P). I envisioned that the threaded servers start one thread per request, and that thread closes when the request ends. So, if only 1 thread is available at most, basically all the requests have to be served serially (the server queues them and pass

Re: [web2py] Re: framework benchmarks - web2py surprisingly slow?

2012-10-03 Thread Michele Comitini
2012/10/3 Niphlod niph...@gmail.com I thought that the achievable concurrency in threaded servers related semi-linearly with the number of available threads, but it seems that this is not the case. the cause is GIL. You could see that on pypi, that has no GIL, but I never tested. CPython is

Re: [web2py] Re: framework benchmarks - web2py surprisingly slow?

2012-10-03 Thread Niphlod
Just for the sake of discussion: are you all saying that in threaded servers on Cpython the best thing is to have a single thread ? Why on hell should anyone support a thread-pool in the beginning if that's the case? Cherrypy existed long before pypy, so it's not a matter of we predisposed a

[web2py] Re: Help with menu error using web2py 2.0.9

2012-10-03 Thread Paolo Caruccio
With datatable do you mean that one from datables.net? If yes, I used this guide http://datatables.net/blog/Twitter_Bootstrap_2 and I did not have any problem. Il giorno mercoledì 3 ottobre 2012 02:16:07 UTC+2, apps in tables ha scritto: For me, The using of datatable will make the menu

[web2py] Re: Help with menu error using web2py 2.0.9

2012-10-03 Thread apps in tables
Thanks... --

[web2py] autocomplete tweak, jquery fade out time

2012-10-03 Thread Mike
The autocomplete box takes too long to disappear when it is no longer in focus. I found the setting for this, it is in gluon/sqlhtml.py : [inside __call__ for autocomplete, line 597 for web2py 1.99] attr['_onblur']=jQuery('#%(div_id)s').delay(3000).fadeOut('slow'); % \

[web2py] Put location of a Raphael element in database

2012-10-03 Thread Richard
Hi, I am using Raphael for drawing diagrams and want to store de location of the elements in the database. Do I need $.ajax or can I stick to ajax helper? View: var up = function () { this.attr({opacity: 1.0}); var locx = this.attr(x); ajax('new_post', ['locx'],

[web2py] Re: SQLFORM.grid custom search where is the error?

2012-10-03 Thread alex
Sorry Jim i just saw your post right now. I don't use the grid search. I use a normal form to collect the key:value pairs. Then I build the query, and I pass it to the grid, with the parameter searchable =False. The advantage is when I have defined the keys I can easily combine (in AND) the

Re: [web2py] APP-specific routers

2012-10-03 Thread Jonathan Lundell
On 2 Oct 2012, at 9:24 PM, lyn2py lyn...@gmail.com wrote: The new (or maybe not so new, by now) app-specific routers is an excellent idea. I love it. Can I get some help regarding the use of it? The following code is in my routes.py file, but it doesn't seem to work: routers = {

[web2py] Re: Adding to derived smartgrid constraints.

2012-10-03 Thread alex
I had a slightly different case, maybe useful to share. I had a table model with two references to make and I wanted the models in the grid, but filtered by one of the two referenced fields of the make table. db.py db.define_table('make', Field('name')) Make_one =

Re: [web2py] autocomplete tweak, jquery fade out time

2012-10-03 Thread Richard Vézina
I think the class for autocomplete is pretty compact and self contained. So, you can just copy the class in your app somewhere in models if you need from many differents controllers or in the controller where you need it instead, rename it and change all what you want then. I had make a

Re: [web2py] APP-specific routers

2012-10-03 Thread lyn2py
With similar code in the main routes.py (main = in the web2py dir), the URL helper will leave out the 'default' and 'index' from the web address. E.g. assuming I have 'some_func' function in default.py controller, URL generated = *http://weburl.com/myapp/some_func* Likewise, for index page, it

Re: [web2py] Re: framework benchmarks - web2py surprisingly slow?

2012-10-03 Thread Massimo Di Pierro
Threads in python are slower then single threads on multicore machines (any modern computer). So 2 threads on 2 cores is almost twice as slow instead of twice as fast because of the GIL. Yet there are advantages. If a thread blocks (because it is streaming data or doing a computation), a

[web2py] Re: Put location of a Raphael element in database

2012-10-03 Thread Massimo Di Pierro
ajax helper is a just a shortcut for $.ajax but I recommend using $.ajax. It is more flexible. On Wednesday, 3 October 2012 09:37:09 UTC-5, Richard wrote: Hi, I am using Raphael for drawing diagrams and want to store de location of the elements in the database. Do I need $.ajax or can I

[web2py] Re: Problem with securing sessions

2012-10-03 Thread Yarin
Niphlod- Thanks, you're correct- that's exactly what's happening. We should then update the *requires_https()* implementation: *gluon/globals.py:* def requires_https(self): If request comes in over HTTP, redirect it to HTTPS and secure the session. if not

[web2py] Re: Put location of a Raphael element in database

2012-10-03 Thread Richard
Massimo, I thought so. But what is missing in th follwowing? View: var up = function () { this.attr({opacity: 1.0}); var locx = this.attr(x); $.ajax({ type: POST, url: {{URL('new_post')}}, data: locx}) }; Controller : def new_post():

Re: [web2py] Re: framework benchmarks - web2py surprisingly slow?

2012-10-03 Thread Niphlod
tested on windows the hello world and a complete app's index page, results are quite similar in some ways at least on windows seems that having a few threads also if in relatively high concurrency environment lead to faster response times (forget about requests served per second, I'm also

[web2py] Re: Manually send confirmation email

2012-10-03 Thread Bruno Codeman
Well, now I see: It's validating the auth data, but not the other's table date. Already tried set onvalidation parameter, but when I do it, it's saving the Empresa table data, but not creating the user. =/ Here's the methos def user(): if request.args(0) == 'login': response.view =

Re: [web2py] APP-specific routers

2012-10-03 Thread Jonathan Lundell
On 3 Oct 2012, at 8:38 AM, lyn2py lyn...@gmail.com wrote: With similar code in the main routes.py (main = in the web2py dir), the URL helper will leave out the 'default' and 'index' from the web address. E.g. assuming I have 'some_func' function in default.py controller, URL generated =

[web2py] pass a arbitrary html attributes with helpers (bootstrap data-toggle with A() for example)

2012-10-03 Thread Richard
Hello, I would generate programmatically a bunch of links with A() helper from controller, but I fall on syntax error because of data-toggle custom bootstrap attribute (new with html5). Ex.: UL([ LI(A(l.upper(), _href='#tab1', *_data-toggle='tab'*)) for l in list_of_letters_required ],

[web2py] Re: Movie not loaded... problem with flash

2012-10-03 Thread LightOfMooN
I have the same problem, which I solved by this way: def download(): if (request.args(0) or '').endswith('swf'): from cStringIO import StringIO import os import time response.headers['Content-Disposition'] = '' filename =

[web2py] Re: Problem with securing sessions

2012-10-03 Thread Massimo Di Pierro
In trunk! On Wednesday, 3 October 2012 10:51:40 UTC-5, Yarin wrote: Niphlod- Thanks, you're correct- that's exactly what's happening. We should then update the *requires_https()* implementation: *gluon/globals.py:* def requires_https(self): If request comes in over HTTP,

[web2py] Re: Put location of a Raphael element in database

2012-10-03 Thread Massimo Di Pierro
url: {{URL('new_post')}}, should be url: {{=URL('new_post')}}, On Wednesday, 3 October 2012 11:14:03 UTC-5, Richard wrote: Massimo, I thought so. But what is missing in th follwowing? View: var up = function () { this.attr({opacity: 1.0}); var locx =

Re: [web2py] pass a arbitrary html attributes with helpers (bootstrap data-toggle with A() for example)

2012-10-03 Thread Paolo Caruccio
Please put the attribute with the hyphen in a dictionary: UL([ LI(A(l.upper(), _href='#tab1', **{{_data-toggle:'tab'}})) for l inlist_of_letters_required ], _class='nav nav-tabs') From web2py book http://web2py.com/books/default/chapter/29/5#HTML-helpers: *Instead of a set of unnamed

Re: [web2py] Re: framework benchmarks - web2py surprisingly slow?

2012-10-03 Thread Massimo Di Pierro
There is an old post by Tim who did extensive benchmarks with Rocket. He discusses extensively problems with using ab for testing. I cannot find the post unfortunately. On Wednesday, 3 October 2012 11:18:40 UTC-5, Niphlod wrote: tested on windows the hello world and a complete app's index

Re: [web2py] Re: framework benchmarks - web2py surprisingly slow?

2012-10-03 Thread Ricardo Pedroso
On Wed, Oct 3, 2012 at 2:09 PM, Niphlod niph...@gmail.com wrote: PS: ab -c 1000 -n 1 on tornado-motor fails after ~7000 requests, cherrypy finishes without issues (both with 1-1 (89 rps) and 10-20 threads(18 rps)). tornado fails because on Windows it's using select() and select doesn't

[web2py] Re: Movie not loaded... problem with flash

2012-10-03 Thread LightOfMooN
oops :) def download(): if (request.args(0) or '').endswith('.swf'): import os response.headers['Content-Disposition'] = '' filename = os.path.join(request.folder,'uploads',request.args(0)) return response.stream(open(filename,'rb')) else: return

Re: [web2py] pass a arbitrary html attributes with helpers (bootstrap data-toggle with A() for example)

2012-10-03 Thread Richard Vézina
Great, I thought about it, I should read the book before sorry! Richard On Wed, Oct 3, 2012 at 1:33 PM, Paolo Caruccio paolo.carucci...@gmail.comwrote: Please put the attribute with the hyphen in a dictionary: UL([ LI(A(l.upper(), _href='#tab1', **{{_data-toggle:'tab'}})) for l

Re: [web2py] pass a arbitrary html attributes with helpers (bootstrap data-toggle with A() for example)

2012-10-03 Thread Richard Vézina
UL([ LI(A(l.upper(), _href='#tab'+str(i), **{'_data-toggle':'tab'})) for i, l in enumerate(list_of_letters_required) ], _class='nav nav-tabs') Only one pairs of curly brackets and the attribute needs to be quoted since it is a key dict finally... Thanks! Richard On Wed, Oct 3, 2012 at 1:44 PM,

Re: [web2py] pass a arbitrary html attributes with helpers (bootstrap data-toggle with A() for example)

2012-10-03 Thread Paolo Caruccio
My fault. Original message corrected. Thank you Il giorno mercoledì 3 ottobre 2012 19:51:26 UTC+2, Richard ha scritto: UL([ LI(A(l.upper(), _href='#tab'+str(i), **{'_data-toggle':'tab'})) for i, l in enumerate(list_of_letters_required) ], _class='nav nav-tabs') Only one pairs of curly

Re: [web2py] pass a arbitrary html attributes with helpers (bootstrap data-toggle with A() for example)

2012-10-03 Thread Richard Vézina
:) On Wed, Oct 3, 2012 at 1:53 PM, Paolo Caruccio paolo.carucci...@gmail.comwrote: My fault. Original message corrected. Thank you Il giorno mercoledì 3 ottobre 2012 19:51:26 UTC+2, Richard ha scritto: UL([ LI(A(l.upper(), _href='#tab'+str(i), **{'_data-toggle':'tab'})) for i, l in

[web2py] Re: Put location of a Raphael element in database

2012-10-03 Thread Richard
That works better indeed, but, var up = function () { this.attr({opacity: 1.0}); var locx = this.attr(x); $.ajax({ type: POST, url: {{=URL('new_post')}}, data: locx}) gives a record insert with Controller : def new_post():

Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual'

2012-10-03 Thread FERNANDO VILLARROEL
Dear Bruno Any update about powerTable + Web2py 2.0.9 --- On Mon, 10/1/12, Bruno Rocha rochacbr...@gmail.com wrote: From: Bruno Rocha rochacbr...@gmail.com Subject: Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' To: web2py@googlegroups.com Date: Monday,

[web2py] How do you organize your applications to be unit-tested?

2012-10-03 Thread vinicius...@gmail.com
Hi all. I continue diving into unit-testing and I'd like to know how do you organize your applications to be unit-tested. Thin controllers? DAO classes? How do you decouple things in web2py to make unit-testing easy? -- Vinicius Assef --

[web2py] Re: Single Table Inheritance?

2012-10-03 Thread Bill Thayer
Fran, Hi Fran, It's been a while since you posted this but I'd like to know which solution you chose. Sounds like you have much more experience than I have and what you described above (the options to have the user see all relevant fields in a single form) was exactly my experience on a few

[web2py] Re: Put location of a Raphael element in database

2012-10-03 Thread Richard
The following seems to work: This in the view: var up = function () { this.attr({opacity: 1.0}); var locx_val = this.attr(x); $.ajax({ type: POST, url: {{ =URL('new_post') }}, data: {locx:locx_val} }) results in the db: Storage

Re: [web2py] Re: framework benchmarks - web2py surprisingly slow?

2012-10-03 Thread Niphlod
I know of the limitations of tornado's architecture on Windows: before today I didn't even know it was possible to run tornado on Win :D To sum up, the problem is: web2py needs a pure python webserver that supports SSL. It needs to be runnable on Win, Mac and Linux (possibly on Solaris too).

[web2py] Re: framework benchmarks - web2py surprisingly slow?

2012-10-03 Thread LightDot
I just noticed that Andriy has updated the article with an Isolated Benchmark yesterday. I quote: In order to provide more reliable benchmark I get rid of application server and network boundary. As a result I simulated a valid WSGI request and isolated calls just to framework alone The

[web2py] Re: framework benchmarks - web2py surprisingly slow?

2012-10-03 Thread Niphlod
no news there. we know that web2py is more packed of features by default. On Wednesday, October 3, 2012 10:51:30 PM UTC+2, LightDot wrote: I just noticed that Andriy has updated the article with an Isolated Benchmark yesterday. I quote: In order to provide more reliable benchmark I get rid

Re: [web2py] autocomplete tweak, jquery fade out time

2012-10-03 Thread Tim Richardson
I have to make a slice about that and redo the integration with the new version of the autocomplete widget because it have been changed since I did my own autocomplete select or add option. Hi Richard, I look forward to that because I also want to try to tweak this widget. --

Re: [web2py] autocomplete tweak, jquery fade out time

2012-10-03 Thread Richard Vézina
Hi Tim, If you can't wait, and have the skill to take the path of tweaking a widget you can have look at this thread : https://groups.google.com/forum/?fromgroups=#!topic/web2py/9KamKgHKUwU You can also read this slice : http://www.web2pyslices.com/slice/show/1446/widget-select-or-add-option

[web2py] Please stop embedding Bootstrap classes in your HTML!

2012-10-03 Thread Richard
Hello, I am not exactly sure how this is relevant about how web2py approach to bootstrap, but it seems to be a logical evolution of the decoupling content and container with HTML/CSS/PHP,Python, etc., as exposed in the post.

[web2py] SQLFORM.grid dinamically update fields

2012-10-03 Thread alex
I have a SQLFORM.grid. When the user updates field 'a' in the grid, before submitting the form, field 'b' should represent a calculation based on value of 'a'. For instance b=a+1 db.py db.define_table('t', Field('a', type='integer'), Field('b', type='integer') ) default.py def

Re: [web2py] APP-specific routers

2012-10-03 Thread lyn2py
Thanks Jonathan. I appreciate this! On Thursday, October 4, 2012 12:23:30 AM UTC+8, Jonathan Lundell wrote: On 3 Oct 2012, at 8:38 AM, lyn2py lyn...@gmail.com javascript: wrote: With similar code in the main routes.py (main = in the web2py dir), the URL helper will leave out the 'default'

Re: [web2py] SQLFORM.grid dinamically update fields

2012-10-03 Thread Javier Pepe
chech this http://web2py.com/books/default/chapter/29/07?search=onupdate may help. On Wed, Oct 3, 2012 at 9:49 PM, alex a22...@gmail.com wrote: I have a SQLFORM.grid. When the user updates field 'a' in the grid, before submitting the form, field 'b' should represent a calculation based

[web2py] App Compile / Command Line

2012-10-03 Thread lyn2py
I compile app very often to move it to production, and I would like to do it via command line (or a sh script). I tried python -c import gluon.compileapp; gluon.compileapp.compile_application('applications/appname') From Thadeus' blog but it throws an error: Traceback (most recent call