[web2py:31252] Re: Authorization of multiple roles

2009-09-18 Thread Jose
On 14 sep, 14:24, mdipierro wrote: > you can do > > @auth.requires(auth.has_membership(auth.id_group('role1')) or > auth.has_membership(auth.id_group('role2'))) > > but this is not the right way to handle it. > > You should add permissions: > > auth.add_permission('run_this',group_id=id.group('

[web2py:31253] Re: Authorization of multiple roles

2009-09-18 Thread Jose
On 14 sep, 14:24, mdipierro wrote: > you can do > > @auth.requires(auth.has_membership(auth.id_group('role1')) or > auth.has_membership(auth.id_group('role2'))) > > but this is not the right way to handle it. > > You should add permissions: > > auth.add_permission('run_this',group_id=id.group('

[web2py:31254] Re: help with web server

2009-09-18 Thread Timbo
Line 215: self.socket=ssl_interface(self.socket) should be: self.socket=self.ssl_interface(self.socket) I presume. What version of wsgiserver are you basing this off of? I remember that a previous version of wsgiserver was using deprecated socket APIs and could not be e

[web2py:31255] Re: help with web server

2009-09-18 Thread mdipierro
This is a complete rewrite of wsgiserver. All functions are different. This is trivial to port to Python 3 and/or lightweight Stackless python threads (althought the pros/cons are not quite clear to me). I am also thinking about rewriting the accepting mechanism to include some of the features of

[web2py:31256] Re: help with web server

2009-09-18 Thread Timbo
IMHO, concurrency is more important than raw speed. In the world of AJAX, we have smaller, more-frequent requests. Thanks for this. On Sep 18, 7:50 am, mdipierro wrote: > This is a complete rewrite of wsgiserver. All functions are different. > This is trivial to port to Python 3 and/or lightwe

[web2py:31257] Re: help with web server

2009-09-18 Thread mdipierro
This server was mainly an exercise. I am planning to separate the "responder" from the code that deal with concurrency so that different concurrency mechanisms can be lugged in (threads, processes, none). On Sep 18, 8:02 am, Timbo wrote: > IMHO, concurrency is more important than raw speed. In

[web2py:31258] Re: Authorization of multiple roles

2009-09-18 Thread Fred
Jose, I have an app with an auth/permission scheme similar to yours and it works fine. I assume that in your auth_permission data where you say "id_group" you mean "auth_permission.group_id". In that table, are the "table_name" column values blank? And are the "record_id" values 0? That's wha

[web2py:/] Re: Authorization of multiple roles

2009-09-18 Thread Jose
On 18 sep, 15:03, Fred wrote: > Jose,  I have an app with an auth/permission scheme similar to yours > and it works fine.  I assume that in your auth_permission data where > you say "id_group" you mean "auth_permission.group_id".  In that Yes > table, are the "table_name" column values blank?

[web2py:31260] Re: FORM, SQLForm - what should I use?

2009-09-18 Thread Alexandre Andrade
The only way I make it work is get two forms + one form to get back. View: {{extend 'layout.html'}} {{if session.secao:}} Seção:      {{=db.secao[session.secao].nome}} {{=form_voltar}}

[web2py:31261] Re: help with web server

2009-09-18 Thread Alex Fanjul
Massimo I tried to run standalone and I recived this: E:\web2py\gluon>python web2pyserver.py 8001 Traceback (most recent call last): File "web2pyserver.py", line 260, in s=web2pyWSGIServer('127.0.0.1:'+sys.argv[1],test_wsgi_app,min_threads=5,max_ threads=10) TypeError: __init__() got an

[web2py:31262] Re: help with web server

2009-09-18 Thread mdipierro
sorry, I tried to make it api compatible with cherrypy and broke the hello world example. You can find the latest here: http://web2py.com/examples/static/web2pyserver.py Massimo On Sep 18, 11:20 am, Alex Fanjul wrote: > Massimo I tried to run standalone and I recived this: > > E:\web2py\gluon>

[web2py:31263] I accidentally deleted a message: safari crashed

2009-09-18 Thread mdipierro
Sorry, please repot it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr

[web2py:31264] Re: help with web server

2009-09-18 Thread Alex Fanjul
Just now I was reviewing, and efectively the init call was wrong... great! El 18/09/2009 18:23, mdipierro escribió: > sorry, I tried to make it api compatible with cherrypy and broke the > hello world example. You can find the latest here: > > http://web2py.com/examples/static/web2pyserver.py > >

[web2py:31265] Re: help with web server

2009-09-18 Thread Alex Fanjul
Massimo, how is posible such a difference between Mac (or Linux) and Windows 7??? more than double in Requests per second :-( Will I have/do something wrong? [web2py Version 1.65.1] E:\wamp\bin\apache\Apache2.2.11\bin>ab -n 1 http://127.0.0.1:8001/ This is ApacheBench, Version 2.3 <$Revi

[web2py:31266] Re: help with web server

2009-09-18 Thread mdipierro
It would be great if you could run and publish more benchmarks for this, cherrypy and apache+mod_wsgi and a couple of different hello_world apps. I have not been able to test chunked upload since I do not know how which clients do it. Firefox does not. The code would be much smaller without suppor

[web2py:31267] Strange error

2009-09-18 Thread Jose
Hello, Maybe it's something obvious, but can not find the problem (or solution). The worst thing is that it was working. Model: http://pastebin.com/m492daf9a Controler: http://pastebin.com/m79a1b876 we see that: db.clasificados.foto.requires = IS_NULL_OR(IS_IMAGE()) if I send the empty foto f

[web2py:31268] Re: Strange error

2009-09-18 Thread mdipierro
You have..: if len(request.vars): categoria = request.vars.values()[0] rubros = db(db.rubros_clasificados.id_categoria == categoria).select() and truns out categoria is not an integer. On Sep 18, 12:47 pm, Jose wrote: > Hello, > > Maybe it's something obvious, but can not find th

[web2py:31269] help with routes.py

2009-09-18 Thread Leandro - ProfessionalIT
Hi, I have two apps in my Web2Py: init - default website. blog - my personal blog. I need of this mapping: www.mysite.com ( the default index page ) point to init/default/index www.mysite.com/company ( a company page )

[web2py:31270] Re: help with routes.py

2009-09-18 Thread mdipierro
You could just do: routes_in=(('/company','/init/default/company/'),) the other two will work by default Massimo On Sep 18, 1:08 pm, Leandro - ProfessionalIT wrote: > Hi, > >    I have two apps in my Web2Py: > >             init - default website. >             blog - my personal blog. > >  

[web2py:31271] Re: saving uploads in a place other than applications/myapp/uploads

2009-09-18 Thread Fran
On Sep 17, 3:29 am, mdipierro wrote: > db.table.field.uploadfolder=os.path.join(request.folder,"uploads/ > somewhere") I've tested it & it works as-advertised, thankyou :) A further enhancement I'd like to see is to be able to specify the filename in the form of: subfolder/name instead of table

[web2py:31272] Re: help with web server

2009-09-18 Thread Alex Fanjul
Sorry my results are very inconsistent... and I dont know why... m4400 notebook, windows7 rtm, t9400, 4gb, 500gb, fx770 -- [[HELLOWORLD WITH WEB2PY IN APACHE+WSGI AND WITHOUT SSL (EVEN IF ITS IN DOMAIN NAME)]

[web2py:31273] Auth customization

2009-09-18 Thread waTR
I am looking to make use of Auth's facilities but implement my own registration form. How would one go about creating a completely custome registration form while making use of Auth? I am unable to find any documentation on that (not in manual). --~--~-~--~~~---~--~---

[web2py:31274] Re: help with web server

2009-09-18 Thread mdipierro
Something is wrong. Cherrypy cannot take 40x longer. Moreover you are not benchmarking the web server but a web2py app. And the time spent in web2py is more than the time spent in the web server by a factor 10. You need to benchmark a bare bone (non-web2py) hello world wsgi application (such as t

[web2py:31275] Re: Auth customization

2009-09-18 Thread Yannick
Let's say you have a registration form : # In the model you have something like that: class MyAuth(Auth): auth = MyAuth(globals(), T,db) db.define_table( auth_user, db.Field('user_name', length=128,default=''), db.Field('first_name', length=128,default=''), db.Field('last_name'

[web2py:31276] Form Key

2009-09-18 Thread eddwinston
Hi, If I create a form on the view and not from the controller action, how can the form get a unique form key? Thanks Winston --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this gro

[web2py:31277] drop down value in the Upload Form....

2009-09-18 Thread Yannick
Hello mate I have a small issue here.. I'm using the latest web2py version. Here is the situation... I'm trying to display an upload picture form and in the form we can have three fields "The picture name field, the upload file field, and a dropdown list for the album". I only want to display the

[web2py:31278] Re: Form Key

2009-09-18 Thread mdipierro
{{=form.hidden_fields()}} will create the On Sep 18, 2:39 pm, eddwinston wrote: > Hi, > > If I create a form on the view and not from the controller action, how > can the form get a unique form key? Thanks > > Winston --~--~-~--~~~---~--~~ You received this

[web2py:31279] Re: drop down value in the Upload Form....

2009-09-18 Thread mdipierro
if auth.user: db.photo.albphotoref_fk.requires = IS_IN_DB(db (db.album.buacct_fk == auth.user.id), "album.id", "%(albumname)s") On Sep 18, 2:49 pm, Yannick wrote: > Hello mate I have a small issue here.. I'm using the latest web2py > version. > Here is the situation... I'm trying to display an u

[web2py:31280] Re: Auth customization

2009-09-18 Thread waTR
I am actually having to customize it far more than that in the end... Related question though... how can one check if password entered matches password stored in DB for that user? When I retrieve the stored password via select(), it is encrypted. How does Auth decrypt? Where can I find that code

[web2py:31281] Re: Auth customization

2009-09-18 Thread Yannick
It depends of what you are trying to do with the password maybe there a way for you to avoid digging into encryption and decryption... Anyway if you really need it, you can take a look in the "Tools.py" in the method "change_password"... this can inspired you... Hope it helps, Cheers, Yannick P.

[web2py:31282] Re: drop down value in the Upload Form....

2009-09-18 Thread Yannick
Thank You :) On Sep 18, 3:58 pm, mdipierro wrote: > if auth.user: db.photo.albphotoref_fk.requires = IS_IN_DB(db > (db.album.buacct_fk == > auth.user.id), "album.id", "%(albumname)s") > > On Sep 18, 2:49 pm, Yannick wrote: > > > Hello mate I have a small issue here.. I'm using the latest web2py

[web2py:31283] Re: Auth customization

2009-09-18 Thread Jonathan Lundell
On Sep 18, 2009, at 1:06 PM, waTR wrote: > Related question though... how can one check if password entered > matches password stored in DB for that user? When I retrieve the > stored password via select(), it is encrypted. How does Auth decrypt? > Where can I find that code (what file)? Briefly

[web2py:31284] Re: Strange error

2009-09-18 Thread Jose
On 18 sep, 18:02, mdipierro wrote: > You have..: > > if len(request.vars): >         categoria = request.vars.values()[0] >     rubros = db(db.rubros_clasificados.id_categoria == > categoria).select() > > and truns out categoria is not an integer. > Ok, but there error only when I upload a pic

[web2py:31285] Re: Strange error

2009-09-18 Thread mdipierro
because it changes what is in request.vars.values()[0] the result of this expression is not predictable because the values are not ordered. Do not use categoria = request.vars.values()[0] On Sep 18, 3:50 pm, Jose wrote: > On 18 sep, 18:02, mdipierro wrote: > > > You have..: > > > if len(requ

[web2py:31286] Re: Form Key

2009-09-18 Thread eddwinston
Hi, But just using {{=form.hidden_fields()}} does not generate a form key On Sep 18, 10:56 pm, mdipierro wrote: > {{=form.hidden_fields()}} > > will create the > > On Sep 18, 2:39 pm, eddwinston wrote: > > > Hi, > > > If I create a form on the view and not from the controller action, how

[web2py:31287] Re: Form Key

2009-09-18 Thread Wes James
Do you have a form=FORM() return dict(form=form) in your controller I just tried it and I get this: {{=wes}} On Fri, Sep 18, 2009 at 3:35 PM, eddwinston wrote: > > Hi, > > But just using {{=form.hidden_fields()}}  does not generate a form key > > On Sep 18, 10:56 pm, mdipierro wrote: >

[web2py:31288] Re: Form with Many To Many relationship?

2009-09-18 Thread Thadeus
How do you go about submiting two forms at once? or do you need to create a SQLFORM.factory and then split the vars up manually? On Sep 17, 4:52 pm, Yarko Tymciurak wrote: > On Thu, Sep 17, 2009 at 10:55 AM, Thadeus Burgess > wrote: > > > I have tried this many different ways and have yet to b

[web2py:31289] Re: gae: gluon undefined

2009-09-18 Thread Robin B
To send mail locally, you need to specify the mail server to be used: http://code.google.com/appengine/docs/python/tools/devserver.html#Using_Mail Robin On Sep 17, 11:02 pm, notcourage wrote: > I can send email after deploying to gae but not in the dev env. --~--~-~--~~

[web2py:31290] Re: Auth customization

2009-09-18 Thread waTR
I need to be able to compare another password submitted against the one in that field. How would I go about doing that? What functions are available in web2py for this. db.define_table('pass', SQLField("password", 'password', readable=False, label='Password', requires=CRYPT())) I.e. I have just

[web2py:31291] Re: Auth customization

2009-09-18 Thread Jonathan Lundell
On Sep 18, 2009, at 4:44 PM, waTR wrote: > > I need to be able to compare another password submitted against the > one in that field. How would I go about doing that? What functions are > available in web2py for this. > > db.define_table('pass', > SQLField("password", 'password', readable=False,

[web2py:/] Re: help with web server

2009-09-18 Thread mdipierro
A friend of mine Garrett Smith from Chipy run the following tests on his machine (not sure what it is): RPS = requests per second Time = average time in milliseconds to server each request Benchmark = `ab -t 10 -c -r http://localhost` 100 Concurrent Requests --- =

[web2py:31293] Re: help with web server

2009-09-18 Thread mdipierro
Here (*) means this web server: http://web2py.com/examples/static/web2pyserver.py which is NOT included in web2py and does NOT uses web2py. In all cases the test refere to a bare bone hello world application. Sorry for the confusion. Massimo On Sep 18, 8:47 pm, mdipierro wrote: > A friend of

[web2py:31294] remote_addr

2009-09-18 Thread suiato
thanks to the instructions on the book and the example web2py_wsgi.conf, i now can run web2py with mod_wsgi on apache. admin with https worked fine, too, but i had to comment out the lines if request.env.remote_addr!=request.env.http_host.split(':')[0]: raise HTTP(400) in models/appadmin.py. i

[web2py:31295] Where is sneaky webserver?

2009-09-18 Thread Iceberg
The latest rev1232 introduces a sneaky web server, but it seems not exist? File "C:\DOWNLOAD\web2py-trunk\gluon\main.py", line 32, in import sneaky ImportError: No module named sneaky --~--~-~--~~~---~--~~ You received this message because you are subscribed

[web2py:31296] Re: Form Key

2009-09-18 Thread eddwinston
Hi Wes, That was not what i meant, I want to creat the form on the view and not in the action. I created initialised an SQLFORM object but wont return it to the view because i want to create my own form. I only use the _formname to identify the form for processing. But I want a _formkey on this f

[web2py:31297] Re: Where is sneaky webserver?

2009-09-18 Thread Yarko Tymciurak
It seems to be in the tree: http://bazaar.launchpad.net/~mdipierro/web2py/devel/files/head%3A/gluon/ When I get the update from launchpad, it seems to be running just fine... On Sat, Sep 19, 2009 at 1:15 AM, Iceberg wrote: > > The latest rev1232 introduces a sneaky web server, but it seems not