[web2py] Re: web2py 1.99.3 is OUT

2011-12-11 Thread Stefan Scholl
This was just a on the fly test in Firebug. And it doesn't feel
right to insert some random BR in there.

Oh, how I hate floats. You can't do without them and then
something random happens ...



Massimo Di Pierro  wrote:
> Can you emailed me the fixed layout.html?
> 
> On Dec 10, 6:02 pm, Stefan Scholl  wrote:
>> Massimo Di Pierro  wrote:
>>
>> > The new web site layout needs work but we put it out there hoping for
>> > more feedback.
>>
>> The announcement "2011 BOSSIE AWARD FOR OPEN SOURCE DEVELOPMENT
>> SOFTWARE" is cut off and too far on the right in Firefox 9.0 Beta
>> on Mac OS X 10.6.
>>
>> Haven't found a good solution, but if you add a 
>> before the announce DIV, the text is centered again.
> 




[web2py] Re: server settings.

2011-12-11 Thread Mchurch
Massimo, how (where) can I change the default web server?
I can't find it in posts...

On 11 Dic, 10:44, Mchurch  wrote:
> Thanks Massimo, I resolve it immediately after Your suggestions using
> Tornado.
> Rocket allows images until 123KB, not over in my case.
> The issue shows up with both Opera mobile and android stock browser.
> I've lost my brain in it yesterday, thanks!!
> My best compliments for Your work.
>
> On 11 Dic, 07:15, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > What's your mobile browser? How big are the images? It is possible
> > there is a problem with chunked encoding with rocket. Other users have
> > mentioned this and we are working on it. Meanwhile, can you try using
> > apache or another web server? (look into web2py/anyserver.py)
>
> > On Dec 10, 8:12 pm, Mchurch  wrote:
>
> > > Hallo guys, I'm a newbie  in Web2py, but I like it a lot. I didn't
> > > want to post for a such stupid question  but I'm stuck and don't know
> > > how to resolve it.
> > > I moved an application from rails to Web2py. basically a dynamic photo
> > > gallery, and everything is working fine on my desktop. But on mobile
> > > phones, somehow, I can't see heavy images (200 Kb), but light images
> > > only! even changing the jquery lightbox with another, I can load
> > > maximum 1/4 of heavy images. Is it possible that Web2py server is
> > > blocking it somehow? The same jquery on rails works well, please, I
> > > don't want to come back to raiiilss. No errors in console.
> > > Nothing. If I change pictures with lighter ones, it works. I really
> > > don't know where to look.
> > > Mac, local host shared.on 0.0.0.0:8000/application
> > > Thanks for Your time.
> > > :/


[web2py] Re: book: why web2py

2011-12-11 Thread rif
I can do that:. Is the following environment relevant?

- ubuntu 11.10 on a kvm virtual instance (mod_wsgi 3.3 - latest)
- web2py with the default setup from scripts/setup-web2py-ubuntu.sh
- ab -n1000 -c20 http://localhost/ and ab -n1000 -c20 http://localhost:8000/

I also have to report two public website made with web2py: 
http://avocadosoft.ro/ and http://firmoasa.appspot.com/, is this a good 
place to report them or should I do it somewhere else?


[web2py] Re: web2py 1.99.3 is OUT

2011-12-11 Thread ma...@rockiger.com
The new home page looks very nice.

Means this web2py is leaving ez-css und mercurial behind?
I am just asking because of my introductory book to web development 
featuring web2py
and don't wanna present obsolete solutions.


[web2py] Rocket vs mod_wsgi

2011-12-11 Thread rif
Environment

machine: libvirt kvm instance: *512Mb 1cpu* on a acer aspire 5100 laptop
os: ubuntu 11.10, mod_wsgi3.3
web2py: 1.99.3
apache config: default resulted from scripts/setup-web2py-ubuntu.sh
Rocket:  v1.2.4  python web2py.py -Na test -i 0.0.0.0

Commands:
- run from the host system
ab -n1000 -c20 http://192.168.122.187/welcome/default/index/
ab -n1000 -c20 http://192.168.122.187:8000/welcome/default/index/

Results:

ab -n1000 -c20 http://192.168.122.187/welcome/default/index
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.122.187 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:Apache/2.2.20
Server Hostname:192.168.122.187
Server Port:80

Document Path:  /welcome/default/index
Document Length:11432 bytes

Concurrency Level:  20
Time taken for tests:   60.128 seconds
Complete requests:  1000
Failed requests:0
Write errors:   0
Total transferred:  11859889 bytes
HTML transferred:   11432000 bytes
*Requests per second:16.63 [#/sec] (mean)*
Time per request:   1202.552 [ms] (mean)
Time per request:   60.128 [ms] (mean, across all concurrent requests)
Transfer rate:  192.62 [Kbytes/sec] received

Connection Times (ms)
  min  mean[+/-sd] median   max
Connect:01   1.2  0  10
Processing:   608 1195 199.3   11801923
Waiting:  608 1166 199.0   11481892
Total:610 1196 199.3   11801923

Percentage of the requests served within a certain time (ms)
  50%   1180
  66%   1276
  75%   1324
  80%   1356
  90%   1460
  95%   1557
  98%   1652
  99%   1723
 100%   1923 (longest request)



ab -n1000 -c20 http://192.168.122.187:8000/welcome/default/index
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.122.187 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:Rocket
Server Hostname:192.168.122.187
Server Port:8000

Document Path:  /welcome/default/index
Document Length:11432 bytes

Concurrency Level:  20
Time taken for tests:   56.926 seconds
Complete requests:  1000
Failed requests:0
Write errors:   0
Total transferred:  11857000 bytes
HTML transferred:   11432000 bytes
*Requests per second:17.57 [#/sec] (mean)*
Time per request:   1138.520 [ms] (mean)
Time per request:   56.926 [ms] (mean, across all concurrent requests)
Transfer rate:  203.41 [Kbytes/sec] received

Connection Times (ms)
  min  mean[+/-sd] median   max
Connect:01   1.0  0  10
Processing:   380 1129 2093.4   1001   34988
Waiting:  363 1121 2093.7991   34987
Total:383 1130 2093.5   1002   34991

Percentage of the requests served within a certain time (ms)
  50%   1002
  66%   1067
  75%   1099
  80%   1115
  90%   1224
  95%   1333
  98%   1640
  99%   1888
 100%  34991 (longest request)

Conclusion:
Requests per seckond
mod_wsgi: 16.63 [#/sec]
rocket: 17.57 [#/sec]

Rocket is about 5% faster in this environment.

Waiting for your comments!


[web2py] Re: Rocket vs mod_wsgi

2011-12-11 Thread rif
In the same environment I tested nginx configuration:

nginx: 1.0.10
uwsgi: 0.9.8.1

ab -n1000 -c20 http://192.168.122.187/welcome/default/index
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.122.187 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:nginx/1.0.10
Server Hostname:192.168.122.187
Server Port:80

Document Path:  /welcome/default/index
Document Length:11432 bytes

Concurrency Level:  20
Time taken for tests:   58.306 seconds
Complete requests:  1000
Failed requests:0
Write errors:   0
Total transferred:  11819000 bytes
HTML transferred:   11432000 bytes
*Requests per second:17.15 [#/sec] (mean)*
Time per request:   1166.116 [ms] (mean)
Time per request:   58.306 [ms] (mean, across all concurrent requests)
Transfer rate:  197.96 [Kbytes/sec] received

Connection Times (ms)
  min  mean[+/-sd] median   max
Connect:01   1.3  0  12
Processing:   218 1155 180.3   11042045
Waiting:  217 1154 180.3   11042045
Total:225 1156 180.0   11052046

Percentage of the requests served within a certain time (ms)
  50%   1105
  66%   1124
  75%   1152
  80%   1177
  90%   1247
  95%   1507
  98%   2009
  99%   2022
 100%   2046 (longest request)

Conclusion:
Just a bit slower than Rocket.

Nginx + wsgi is my current server configuration


[web2py] Re: username and email login (auth)

2011-12-11 Thread Francisco Costa
has anyone successfully tried this?


On Dec 9, 6:01 pm, Francisco Costa  wrote:
> No error,
> it enters in the if loop, but it seems that the
> auth.settings.login_userfield = 'email' doesn't change anything
>
> On Dec 9, 5:34 pm, Anthony  wrote:
>
>
>
> > The idea is to create the form with the 'username' field by default, but
> > when submitted, if the 'username' field contains an email address, change
> > the setting and also copy the email address to request.vars.email before
> > calling the login() method again. The second call to login will proceed as
> > if the email address is being used for login. If it's not working, I'm not
> > sure where it's breaking down. Did you get an error, or it just didn't
> > check the email address properly?
>
> > Anthony
>
> > On Friday, December 9, 2011 12:17:18 PM UTC-5, Francisco Costa wrote:
>
> > > it seems it dosen't work.. maybe because I have a username field
> > > defined in my auth_user?
>
> > > On Dec 9, 4:46 pm, Anthony  wrote:
> > > > Not tested, but maybe something like:
>
> > > > def user():
> > > >     custom_auth.settings.login_userfield = 'username'
> > > >     if request.args(0) == 'login':
> > > >         if request.vars.username and not
> > > > IS_EMAIL()(request.vars.username)[1]:
> > > >             custom_auth.settings.login_userfield = 'email'
> > > >             request.vars.email = request.vars.username
> > > >         return dict(form=custom_auth.login())
> > > >     return dict(form=custom_auth())
>
> > > > On Friday, December 9, 2011 10:52:56 AM UTC-5, Francisco Costa wrote:
>
> > > > > I would prefer that way.. I what controller function? I'm using in
> > > > > form from default/user but I'm using a customauth
>
> > > > > On Dec 9, 3:02 pm, Anthony  wrote:
> > > > > > Rather than write a whole new method, one trick might be in the 
> > > > > > login
> > > > > > controller function, check the incoming request.vars.username to see
> > > if
> > > > > it
> > > > > > is an email address (using the IS_EMAIL validator). Then, depending
> > > on
> > > > > > that, dynamically set auth.settings.login_userfield to either
> > > 'email' or
> > > > > > 'username', and then call auth.login() as usual.
>
> > > > > > Anthony
>
> > > > > > On Friday, December 9, 2011 9:50:02 AM UTC-5, Francisco Costa wrote:
>
> > > > > > > yes, i think I'm going to build a custom method for login with
> > > > > > > username or email
>
> > > > > > > On Dec 9, 2:13 pm, Anthony  wrote:
> > > > > > > > Are you saying you want users to be able to login with either
> > > their
> > > > > > > > username or their email address? For that, I think you might
> > > need a
> > > > > > > custom
> > > > > > > > login method. On the other hand, if you simply want to allow
> > > users to
> > > > > > > have
> > > > > > > > a username, but always login with email address, you should be
> > > able
> > > > > to
> > > > > > > do:
>
> > > > > > > > auth.settings.login_userfield = 'email'
>
> > > > > > > > Anthony
>
> > > > > > > > On Friday, December 9, 2011 7:22:57 AM UTC-5, Francisco Costa
> > > wrote:
>
> > > > > > > > > lots of users on login form submit their email instead of the
> > > > > > > > > username..
>
> > > > > > > > > it seems that auth.define_tables(username=True) forces 
> > > > > > > > > username
> > > > > login
> > > > > > > > > but it is possible to have both?


[web2py] How to make sqlite database queries from a regular python shell

2011-12-11 Thread Saurabh Kumar
Hi,

I am trying to make database queries to my app database (sqlite) which
resides in .../applications/app/databases folder.

I am importing DAL package to achieve this.

What address should I write  in the following command to make it
connect to the app database..

db=DAL('sqlite://storage.sqlite')

I am working in a regular python shell in my home directory.

Thanks,

Saurabh


[web2py] Re: Rocket vs mod_wsgi

2011-12-11 Thread rif
And now the weirdest thing:

Enabling two CPUs on the virtual machine gave me the following weird 
results:

nginx: 31.92 [#/sec]
apache: 10.63 [#/sec]
rocket: 10.36 [#/sec]

So 1000 request with a concurrency of 20 on 2 CPUs actually slows down 
apache and rocket. I thought that apache and rocket hit the memory limit so 
I raised the memory to 1024 but the results remained the same.

Is this even possible? I can understand that the performance could stay the 
same with 2CPUs (the servers are not using the second one) but to actually 
drop the performance is not very intuitive.

I guess the default configuration of apache and rocket should be improved 
since most of the servers have more than 1 CPU. Or maybe I just my 
environment.


[web2py] pack application from other script

2011-12-11 Thread Alex
I have a python deployment script where I update the build info (build
nr., build date), compile the application, pack it and finally upload
it to a server. The script is in a location independent of web2py.

I can compile the application with:
sys.path.append(web2py_dir)
os.chdir(web2py_dir)
import gluon.compileapp
gluon.compileapp.compile_application('applications/myapp')

I don't know if this is the 'right' way but it works. How can I pack
the compiled application now? there is
gluon.admin.app_pack_compiled
but this needs the request object. How can I call it?

another question: the packed application also contains the folders
databases, cache etc. How does this work when the application is
installed on the server? are these folders simply ignored?

thanks,
Alex


[web2py] Re: read once definitions - development vs. production

2011-12-11 Thread Anthony
On Saturday, December 10, 2011 11:29:49 PM UTC-5, Constantine Vasil wrote:
>
>  I just put my classes in site-packages/models.py
>
> and the 'from models import *'  made the classes available globally.
>
> So if I put them in /modules/models.py it would be the same?
>

It should work the same -- let us know if it doesn't. web2py includes a 
custom importer, so if you use a regular import statement, before searching 
the Python path, it will look in the application's /modules folder. 
See http://web2py.com/book/default/chapter/04#Third-Party-Modules 
and 
http://web2py.com/book/default/chapter/04#Accessing-the-API-from-Python-modules.

Anthony 


[web2py] Re: How to show user_id encrypted in the browser address bar and decrypt in the app?

2011-12-11 Thread Anthony
Unless you change the encryption key every time, the encrypted id would 
still always be the same, so could still be stolen and used. Instead, you 
might simply want to confirm that the id in request.vars matches the id of 
the current logged in user.

Anthony

On Sunday, December 11, 2011 2:57:01 AM UTC-5, Constantine Vasil wrote:
>
> I am getting  user_id = str(auth.user.id), form a link to be clicked 
> later.
>
> When clicked on to the browser bar looks like like /user?user_id=9
>
> That is insecure. How to encrypt it to look like /user?user_id=10iksmwu0 
> (something like that)
> and decrypt later when extracting from the request_vars?
>
>
>

[web2py] limiting web2py to my LAN in order to expose secure access to /admin & /appadmin

2011-12-11 Thread web-dev-m
Dear Everyone,

I am closing in on a finished web2py application that I will
eventually launch to the web (woo hoo!)

I am using Debian/Apache2 and I want to expose it only to my LAN so I
can do a mini-launch and test it with some other developers that VPN
in. I understand that this is primarily an Apache question, but I
managed to get a similar thing to work for another (non-web2py) site,
and I can't figure this out...

I found an article on how to expose admin and appadmin on old
versions, but i couldn't make that work..

Any suggestions?


[web2py] Re: How to show user_id encrypted in the browser address bar and decrypt in the app?

2011-12-11 Thread Anthony
You might also consider using URL(..., user_signature=True) and 
@auth.requires_signature: 
http://web2py.com/book/default/chapter/04#Digitally-signed-URLs. 
That will further ensure that the URL itself has not been tampered with 
(i.e., no args or vars have been altered).

Anthony

On Sunday, December 11, 2011 9:57:19 AM UTC-5, Anthony wrote:
>
> Unless you change the encryption key every time, the encrypted id would 
> still always be the same, so could still be stolen and used. Instead, you 
> might simply want to confirm that the id in request.vars matches the id of 
> the current logged in user.
>
> Anthony
>
> On Sunday, December 11, 2011 2:57:01 AM UTC-5, Constantine Vasil wrote:
>>
>> I am getting  user_id = str(auth.user.id), form a link to be clicked 
>> later.
>>
>> When clicked on to the browser bar looks like like /user?user_id=9
>>
>> That is insecure. How to encrypt it to look like /user?user_id=10iksmwu0 
>> (something like that)
>> and decrypt later when extracting from the request_vars?
>>
>>
>>

[web2py] Re: server settings.

2011-12-11 Thread Massimo Di Pierro
Is there any ways you can do a packet capture and record what is going
on when you use Opera and Rocket?

If we can get some data should be an easy fix.

On Dec 11, 3:44 am, Mchurch  wrote:
> Thanks Massimo, I resolve it immediately after Your suggestions using
> Tornado.
> Rocket allows images until 123KB, not over in my case.
> The issue shows up with both Opera mobile and android stock browser.
> I've lost my brain in it yesterday, thanks!!
> My best compliments for Your work.
>
> On 11 Dic, 07:15, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > What's your mobile browser? How big are the images? It is possible
> > there is a problem with chunked encoding with rocket. Other users have
> > mentioned this and we are working on it. Meanwhile, can you try using
> > apache or another web server? (look into web2py/anyserver.py)
>
> > On Dec 10, 8:12 pm, Mchurch  wrote:
>
> > > Hallo guys, I'm a newbie  in Web2py, but I like it a lot. I didn't
> > > want to post for a such stupid question  but I'm stuck and don't know
> > > how to resolve it.
> > > I moved an application from rails to Web2py. basically a dynamic photo
> > > gallery, and everything is working fine on my desktop. But on mobile
> > > phones, somehow, I can't see heavy images (200 Kb), but light images
> > > only! even changing the jquery lightbox with another, I can load
> > > maximum 1/4 of heavy images. Is it possible that Web2py server is
> > > blocking it somehow? The same jquery on rails works well, please, I
> > > don't want to come back to raiiilss. No errors in console.
> > > Nothing. If I change pictures with lighter ones, it works. I really
> > > don't know where to look.
> > > Mac, local host shared.on 0.0.0.0:8000/application
> > > Thanks for Your time.
> > > :/


[web2py] Re: web2py 1.99.3 is OUT

2011-12-11 Thread Massimo Di Pierro
we abandoned ez-css.

we are not abandoning mercurial. Just replacing bzr with git.

On Dec 11, 5:11 am, "ma...@rockiger.com" 
wrote:
> The new home page looks very nice.
>
> Means this web2py is leaving ez-css und mercurial behind?
> I am just asking because of my introductory book to web development
> featuring web2py
> and don't wanna present obsolete solutions.


[web2py] Re: Rocket vs mod_wsgi

2011-12-11 Thread Massimo Di Pierro
Python multithreaded programs (all of them, including rocket and
mod_wsgi) decrease performance the more CPUs you have. This is because
of the GIL. It is a well known problem and, in view, the biggest
problem with Python. In the case of apache, to improve things, you
have to configure apache to run one child per cpu.

On Dec 11, 8:04 am, rif  wrote:
> And now the weirdest thing:
>
> Enabling two CPUs on the virtual machine gave me the following weird
> results:
>
> nginx: 31.92 [#/sec]
> apache: 10.63 [#/sec]
> rocket: 10.36 [#/sec]
>
> So 1000 request with a concurrency of 20 on 2 CPUs actually slows down
> apache and rocket. I thought that apache and rocket hit the memory limit so
> I raised the memory to 1024 but the results remained the same.
>
> Is this even possible? I can understand that the performance could stay the
> same with 2CPUs (the servers are not using the second one) but to actually
> drop the performance is not very intuitive.
>
> I guess the default configuration of apache and rocket should be improved
> since most of the servers have more than 1 CPU. Or maybe I just my
> environment.


[web2py] Re: server settings.

2011-12-11 Thread Mchurch
Of course! The problem is to understand what You are asking me to
do...
:)

On Dec 11, 4:38 pm, Massimo Di Pierro 
wrote:
> Is there any ways you can do a packet capture and record what is going
> on when you use Opera and Rocket?
>
> If we can get some data should be an easy fix.
>
> On Dec 11, 3:44 am, Mchurch  wrote:
>
>
>
>
>
>
>
> > Thanks Massimo, I resolve it immediately after Your suggestions using
> > Tornado.
> > Rocket allows images until 123KB, not over in my case.
> > The issue shows up with both Opera mobile and android stock browser.
> > I've lost my brain in it yesterday, thanks!!
> > My best compliments for Your work.
>
> > On 11 Dic, 07:15, Massimo Di Pierro 
> > wrote:
>
> > > What's your mobile browser? How big are the images? It is possible
> > > there is a problem with chunked encoding with rocket. Other users have
> > > mentioned this and we are working on it. Meanwhile, can you try using
> > > apache or another web server? (look into web2py/anyserver.py)
>
> > > On Dec 10, 8:12 pm, Mchurch  wrote:
>
> > > > Hallo guys, I'm a newbie  in Web2py, but I like it a lot. I didn't
> > > > want to post for a such stupid question  but I'm stuck and don't know
> > > > how to resolve it.
> > > > I moved an application from rails to Web2py. basically a dynamic photo
> > > > gallery, and everything is working fine on my desktop. But on mobile
> > > > phones, somehow, I can't see heavy images (200 Kb), but light images
> > > > only! even changing the jquery lightbox with another, I can load
> > > > maximum 1/4 of heavy images. Is it possible that Web2py server is
> > > > blocking it somehow? The same jquery on rails works well, please, I
> > > > don't want to come back to raiiilss. No errors in console.
> > > > Nothing. If I change pictures with lighter ones, it works. I really
> > > > don't know where to look.
> > > > Mac, local host shared.on 0.0.0.0:8000/application
> > > > Thanks for Your time.
> > > > :/


[web2py] Re: Rocket vs mod_wsgi

2011-12-11 Thread rif
This comparison was intended to help writing the why web2py paragraph from 
the book (https://groups.google.com/d/topic/web2py/29jdfjejwZo/discussion )

[web2py] Re: server settings.

2011-12-11 Thread Massimo Di Pierro
There is a program called wireshark. It allows to record network
traffic and save it to a file. Assuming you run rocket/web2py on port
8000. you can tell it to record all traffic to and from port 8000,
then run the dowload that fails. Dump the wireshark recording to a
file and send it to me. Wireshark is free and should be easy to use.

Massimo

On Dec 11, 10:14 am, Mchurch  wrote:
> Of course! The problem is to understand what You are asking me to
> do...
> :)
>
> On Dec 11, 4:38 pm, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > Is there any ways you can do a packet capture and record what is going
> > on when you use Opera and Rocket?
>
> > If we can get some data should be an easy fix.
>
> > On Dec 11, 3:44 am, Mchurch  wrote:
>
> > > Thanks Massimo, I resolve it immediately after Your suggestions using
> > > Tornado.
> > > Rocket allows images until 123KB, not over in my case.
> > > The issue shows up with both Opera mobile and android stock browser.
> > > I've lost my brain in it yesterday, thanks!!
> > > My best compliments for Your work.
>
> > > On 11 Dic, 07:15, Massimo Di Pierro 
> > > wrote:
>
> > > > What's your mobile browser? How big are the images? It is possible
> > > > there is a problem with chunked encoding with rocket. Other users have
> > > > mentioned this and we are working on it. Meanwhile, can you try using
> > > > apache or another web server? (look into web2py/anyserver.py)
>
> > > > On Dec 10, 8:12 pm, Mchurch  wrote:
>
> > > > > Hallo guys, I'm a newbie  in Web2py, but I like it a lot. I didn't
> > > > > want to post for a such stupid question  but I'm stuck and don't know
> > > > > how to resolve it.
> > > > > I moved an application from rails to Web2py. basically a dynamic photo
> > > > > gallery, and everything is working fine on my desktop. But on mobile
> > > > > phones, somehow, I can't see heavy images (200 Kb), but light images
> > > > > only! even changing the jquery lightbox with another, I can load
> > > > > maximum 1/4 of heavy images. Is it possible that Web2py server is
> > > > > blocking it somehow? The same jquery on rails works well, please, I
> > > > > don't want to come back to raiiilss. No errors in console.
> > > > > Nothing. If I change pictures with lighter ones, it works. I really
> > > > > don't know where to look.
> > > > > Mac, local host shared.on 0.0.0.0:8000/application
> > > > > Thanks for Your time.
> > > > > :/


[web2py] Re: username and email login (auth)

2011-12-11 Thread Francisco Costa
Gotta after some debugging: post_vars was missing

So this will verification will work for username or email login:

if request.vars.username and not IS_EMAIL()
(request.vars.username)[1]:
auth.settings.login_userfield = 'email'
request.vars.email = request.vars.username
request.post_vars.email = request.vars.email
request.vars.username = None
request.post_vars.username = None



On Dec 11, 1:30 pm, Francisco Costa  wrote:
> has anyone successfully tried this?
>
> On Dec 9, 6:01 pm, Francisco Costa  wrote:
>
>
>
>
>
>
>
> > No error,
> > it enters in the if loop, but it seems that the
> > auth.settings.login_userfield = 'email' doesn't change anything
>
> > On Dec 9, 5:34 pm, Anthony  wrote:
>
> > > The idea is to create the form with the 'username' field by default, but
> > > when submitted, if the 'username' field contains an email address, change
> > > the setting and also copy the email address to request.vars.email before
> > > calling the login() method again. The second call to login will proceed as
> > > if the email address is being used for login. If it's not working, I'm not
> > > sure where it's breaking down. Did you get an error, or it just didn't
> > > check the email address properly?
>
> > > Anthony
>
> > > On Friday, December 9, 2011 12:17:18 PM UTC-5, Francisco Costa wrote:
>
> > > > it seems it dosen't work.. maybe because I have a username field
> > > > defined in my auth_user?
>
> > > > On Dec 9, 4:46 pm, Anthony  wrote:
> > > > > Not tested, but maybe something like:
>
> > > > > def user():
> > > > >     custom_auth.settings.login_userfield = 'username'
> > > > >     if request.args(0) == 'login':
> > > > >         if request.vars.username and not
> > > > > IS_EMAIL()(request.vars.username)[1]:
> > > > >             custom_auth.settings.login_userfield = 'email'
> > > > >             request.vars.email = request.vars.username
> > > > >         return dict(form=custom_auth.login())
> > > > >     return dict(form=custom_auth())
>
> > > > > On Friday, December 9, 2011 10:52:56 AM UTC-5, Francisco Costa wrote:
>
> > > > > > I would prefer that way.. I what controller function? I'm using in
> > > > > > form from default/user but I'm using a customauth
>
> > > > > > On Dec 9, 3:02 pm, Anthony  wrote:
> > > > > > > Rather than write a whole new method, one trick might be in the 
> > > > > > > login
> > > > > > > controller function, check the incoming request.vars.username to 
> > > > > > > see
> > > > if
> > > > > > it
> > > > > > > is an email address (using the IS_EMAIL validator). Then, 
> > > > > > > depending
> > > > on
> > > > > > > that, dynamically set auth.settings.login_userfield to either
> > > > 'email' or
> > > > > > > 'username', and then call auth.login() as usual.
>
> > > > > > > Anthony
>
> > > > > > > On Friday, December 9, 2011 9:50:02 AM UTC-5, Francisco Costa 
> > > > > > > wrote:
>
> > > > > > > > yes, i think I'm going to build a custom method for login with
> > > > > > > > username or email
>
> > > > > > > > On Dec 9, 2:13 pm, Anthony  wrote:
> > > > > > > > > Are you saying you want users to be able to login with either
> > > > their
> > > > > > > > > username or their email address? For that, I think you might
> > > > need a
> > > > > > > > custom
> > > > > > > > > login method. On the other hand, if you simply want to allow
> > > > users to
> > > > > > > > have
> > > > > > > > > a username, but always login with email address, you should be
> > > > able
> > > > > > to
> > > > > > > > do:
>
> > > > > > > > > auth.settings.login_userfield = 'email'
>
> > > > > > > > > Anthony
>
> > > > > > > > > On Friday, December 9, 2011 7:22:57 AM UTC-5, Francisco Costa
> > > > wrote:
>
> > > > > > > > > > lots of users on login form submit their email instead of 
> > > > > > > > > > the
> > > > > > > > > > username..
>
> > > > > > > > > > it seems that auth.define_tables(username=True) forces 
> > > > > > > > > > username
> > > > > > login
> > > > > > > > > > but it is possible to have both?


[web2py] Re: routers only exposing default controller

2011-12-11 Thread Olympus Runner

I have the following setup
http://groups.google.com/group/web2py/browse_thread/thread/b4df60e75f0d64fb
This is my routes.py file:
#
routers = dict(     BASE = dict(         domains = {            
'mymanager.example.com': 'mymanager',             'test.example.com':
'test',         }     ), )
#
I was working on something for a client and noticed this issue after 1
week. I couldn'tadd any new controllers without getting 'default/
newcontroller' invalid function errors.
Had a worried face and thought I misread the docs or something
sinister was happening.
Found these postings and figured it might be similar.
I did a restart of Apache and it looks like it's working now
I guess I will restart Apache after creating a new controller???
I have an Ubuntu setup and moved from my original setup to the link
above posted by Ross Peoples.
My server hard drives crashed and now I am using web2py via an Amazon
ec2 instance...


On Nov 18, 9:56 am, Jonathan Lundell  wrote:
> On Nov 18, 2011, at 5:28 AM, Richard Baron Penman wrote:
>
> > yes only the default controller is available by default, until I
> > defined the controllers variable.
>
> Send me your routes.py privately, please.


[web2py] Re: username and email login (auth)

2011-12-11 Thread Anthony
Sorry, good catch.

On Sunday, December 11, 2011 11:30:12 AM UTC-5, Francisco Costa wrote:
>
> Gotta after some debugging: post_vars was missing
>
> So this will verification will work for username or email login:
>
> if request.vars.username and not IS_EMAIL()
> (request.vars.username)[1]:
> auth.settings.login_userfield = 'email'
> request.vars.email = request.vars.username
> request.post_vars.email = request.vars.email
> request.vars.username = None
> request.post_vars.username = None
>
> On Dec 11, 1:30 pm, Francisco Costa  wrote:
> > has anyone successfully tried this?
> >
> > On Dec 9, 6:01 pm, Francisco Costa  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > No error,
> > > it enters in the if loop, but it seems that the
> > > auth.settings.login_userfield = 'email' doesn't change anything
> >
> > > On Dec 9, 5:34 pm, Anthony  wrote:
> >
> > > > The idea is to create the form with the 'username' field by default, 
> but
> > > > when submitted, if the 'username' field contains an email address, 
> change
> > > > the setting and also copy the email address to request.vars.email 
> before
> > > > calling the login() method again. The second call to login will 
> proceed as
> > > > if the email address is being used for login. If it's not working, 
> I'm not
> > > > sure where it's breaking down. Did you get an error, or it just 
> didn't
> > > > check the email address properly?
> >
> > > > Anthony
> >
> > > > On Friday, December 9, 2011 12:17:18 PM UTC-5, Francisco Costa wrote:
> >
> > > > > it seems it dosen't work.. maybe because I have a username field
> > > > > defined in my auth_user?
> >
> > > > > On Dec 9, 4:46 pm, Anthony  wrote:
> > > > > > Not tested, but maybe something like:
> >
> > > > > > def user():
> > > > > > custom_auth.settings.login_userfield = 'username'
> > > > > > if request.args(0) == 'login':
> > > > > > if request.vars.username and not
> > > > > > IS_EMAIL()(request.vars.username)[1]:
> > > > > > custom_auth.settings.login_userfield = 'email'
> > > > > > request.vars.email = request.vars.username
> > > > > > return dict(form=custom_auth.login())
> > > > > > return dict(form=custom_auth())
> >
> > > > > > On Friday, December 9, 2011 10:52:56 AM UTC-5, Francisco Costa 
> wrote:
> >
> > > > > > > I would prefer that way.. I what controller function? I'm 
> using in
> > > > > > > form from default/user but I'm using a customauth
> >
> > > > > > > On Dec 9, 3:02 pm, Anthony  wrote:
> > > > > > > > Rather than write a whole new method, one trick might be in 
> the login
> > > > > > > > controller function, check the incoming 
> request.vars.username to see
> > > > > if
> > > > > > > it
> > > > > > > > is an email address (using the IS_EMAIL validator). Then, 
> depending
> > > > > on
> > > > > > > > that, dynamically set auth.settings.login_userfield to either
> > > > > 'email' or
> > > > > > > > 'username', and then call auth.login() as usual.
> >
> > > > > > > > Anthony
> >
> > > > > > > > On Friday, December 9, 2011 9:50:02 AM UTC-5, Francisco 
> Costa wrote:
> >
> > > > > > > > > yes, i think I'm going to build a custom method for login 
> with
> > > > > > > > > username or email
> >
> > > > > > > > > On Dec 9, 2:13 pm, Anthony  wrote:
> > > > > > > > > > Are you saying you want users to be able to login with 
> either
> > > > > their
> > > > > > > > > > username or their email address? For that, I think you 
> might
> > > > > need a
> > > > > > > > > custom
> > > > > > > > > > login method. On the other hand, if you simply want to 
> allow
> > > > > users to
> > > > > > > > > have
> > > > > > > > > > a username, but always login with email address, you 
> should be
> > > > > able
> > > > > > > to
> > > > > > > > > do:
> >
> > > > > > > > > > auth.settings.login_userfield = 'email'
> >
> > > > > > > > > > Anthony
> >
> > > > > > > > > > On Friday, December 9, 2011 7:22:57 AM UTC-5, Francisco 
> Costa
> > > > > wrote:
> >
> > > > > > > > > > > lots of users on login form submit their email instead 
> of the
> > > > > > > > > > > username..
> >
> > > > > > > > > > > it seems that auth.define_tables(username=True) forces 
> username
> > > > > > > login
> > > > > > > > > > > but it is possible to have both?
>
>

Re: [web2py] Re: routers only exposing default controller

2011-12-11 Thread Jonathan Lundell
On Dec 11, 2011, at 9:04 AM, Olympus Runner wrote:

> 
> I have the following setup
> http://groups.google.com/group/web2py/browse_thread/thread/b4df60e75f0d64fb
> This is my routes.py file:
> #
> routers = dict( BASE = dict( domains = {
> 'mymanager.example.com': 'mymanager', 'test.example.com':
> 'test', } ), )
> #
> I was working on something for a client and noticed this issue after 1
> week. I couldn'tadd any new controllers without getting 'default/
> newcontroller' invalid function errors.
> Had a worried face and thought I misread the docs or something
> sinister was happening.
> Found these postings and figured it might be similar.
> I did a restart of Apache and it looks like it's working now
> I guess I will restart Apache after creating a new controller???

It's necessary to get web2py to reload the routing configuration when you make 
a change to the configuration, and adding a controller counts as a change. 
Restarting Apache restarts web2py, so that's one way to do it.

> I have an Ubuntu setup and moved from my original setup to the link
> above posted by Ross Peoples.
> My server hard drives crashed and now I am using web2py via an Amazon
> ec2 instance...
> 
> 
> On Nov 18, 9:56 am, Jonathan Lundell  wrote:
>> On Nov 18, 2011, at 5:28 AM, Richard Baron Penman wrote:
>> 
>>> yes only the default controller is available by default, until I
>>> defined the controllers variable.
>> 
>> Send me your routes.py privately, please.




[web2py] Re: routers only exposing default controller

2011-12-11 Thread Anthony
It might be sufficient to just reload routes.py, which you can do via a 
button in 'admin', or via a call to URL('admin', 'default', 
'reload_routes'), or via:

import gluon.rewrite
gluon.rewrite.load()

Anthony

On Sunday, December 11, 2011 12:04:41 PM UTC-5, Olympus Runner wrote:
>
>
> I have the following setup
> http://groups.google.com/group/web2py/browse_thread/thread/b4df60e75f0d64fb
> This is my routes.py file:
> #
> routers = dict( BASE = dict( domains = {
> 'mymanager.example.com': 'mymanager', 'test.example.com':
> 'test', } ), )
> #
> I was working on something for a client and noticed this issue after 1
> week. I couldn'tadd any new controllers without getting 'default/
> newcontroller' invalid function errors.
> Had a worried face and thought I misread the docs or something
> sinister was happening.
> Found these postings and figured it might be similar.
> I did a restart of Apache and it looks like it's working now
> I guess I will restart Apache after creating a new controller???
> I have an Ubuntu setup and moved from my original setup to the link
> above posted by Ross Peoples.
> My server hard drives crashed and now I am using web2py via an Amazon
> ec2 instance...
>
>
> On Nov 18, 9:56 am, Jonathan Lundell  wrote:
> > On Nov 18, 2011, at 5:28 AM, Richard Baron Penman wrote:
> >
> > > yes only the default controller is available by default, until I
> > > defined the controllers variable.
> >
> > Send me your routes.py privately, please.
>


Re: [web2py] Re: routers only exposing default controller

2011-12-11 Thread Jonathan Lundell
On Dec 11, 2011, at 9:39 AM, Anthony wrote:

> It might be sufficient to just reload routes.py, which you can do via a 
> button in 'admin', or via a call to URL('admin', 'default', 'reload_routes'), 
> or via:
> 
> import gluon.rewrite
> gluon.rewrite.load()

Yes, anything that reloads the routing configuration will suffice. 

If you have admin available, the button there is probably the easiest, since 
you don't have to add/enable code that you'll later have to remove/disable.

> 
> Anthony
> 
> On Sunday, December 11, 2011 12:04:41 PM UTC-5, Olympus Runner wrote:
> 
> I have the following setup
> http://groups.google.com/group/web2py/browse_thread/thread/b4df60e75f0d64fb
> This is my routes.py file:
> #
> routers = dict( BASE = dict( domains = {
> 'mymanager.example.com': 'mymanager', 'test.example.com':
> 'test', } ), )
> #
> I was working on something for a client and noticed this issue after 1
> week. I couldn'tadd any new controllers without getting 'default/
> newcontroller' invalid function errors.
> Had a worried face and thought I misread the docs or something
> sinister was happening.
> Found these postings and figured it might be similar.
> I did a restart of Apache and it looks like it's working now
> I guess I will restart Apache after creating a new controller???
> I have an Ubuntu setup and moved from my original setup to the link
> above posted by Ross Peoples.
> My server hard drives crashed and now I am using web2py via an Amazon
> ec2 instance...
> 
> On Nov 18, 9:56 am, Jonathan Lundell  wrote:
> > On Nov 18, 2011, at 5:28 AM, Richard Baron Penman wrote:
> >
> > > yes only the default controller is available by default, until I
> > > defined the controllers variable.
> >
> > Send me your routes.py privately, please.
> 




[web2py] Re: web2py 1.99.3 is OUT

2011-12-11 Thread Jim Gregory
Changing the "announce" class specification on line 13 in examples.css
from :

.announce { position:absolute;align:center;color:white;top:120px;font-
weight:bold;text-align:center;}

to:
.announce {clear:both;color:white;top:120px;font-weight:bold;text-
align:center;}

takes care of the problem for me.

-Jim



On Dec 10, 6:02 pm, Stefan Scholl  wrote:
> Massimo Di Pierro  wrote:
>
> > The new web site layout needs work but we put it out there hoping for
> > more feedback.
>
> The announcement "2011 BOSSIE AWARD FOR OPEN SOURCE DEVELOPMENT
> SOFTWARE" is cut off and too far on the right in Firefox 9.0 Beta
> on Mac OS X 10.6.
>
> Haven't found a good solution, but if you add a 
> before the announce DIV, the text is centered again.


[web2py] Re: Getting table a to use as default string from field in table b

2011-12-11 Thread tsvim
Obviously you're right. I realized later that I needed to re-think what I 
was trying to do.
The id of current user is stored in the data table. Is there a way I can 
refernce that field in the line you gaveme?

Thanks for all your help.


[web2py] Re: Getting table a to use as default string from field in table b

2011-12-11 Thread Anthony
Sorry, not sure exactly what you mean? Can you provide more detail -- maybe 
show some code?

On Sunday, December 11, 2011 1:35:35 PM UTC-5, tsvim wrote:
>
> Obviously you're right. I realized later that I needed to re-think what I 
> was trying to do.
> The id of current user is stored in the data table. Is there a way I can 
> refernce that field in the line you gaveme?
>
> Thanks for all your help.
>


[web2py] Re: How to remove 'Registration needs verification'?

2011-12-11 Thread Constantine Vasil
I see in  GAE Database Viewer in reset_password_key that there are some 
value - not sure if it will ask again for 'Registration needs verification'

   auth.settings.registration_requires_verification = False


I define user tabble as follows:
   from gluon.tools import Auth
   settings = current.app.settings
   request = current.request

   db = current.app.db
   auth = Auth(current.app.db)  #authentication/authorization
   auth.settings.hmac_key = settings.security_key  # before 
define_tables()
   current.app.auth = auth
  
   auth.define_tables(username=False, migrate = 
current.app.settings.migrate) #  to be called unless tables are defined 
manually

   db.auth_user.first_name.writable = db.auth_user.first_name.readable 
= False
   db.auth_user.last_name.writable = db.auth_user.last_name.readable 
=False


   auth.messages.verify_password_comment = ''

   auth.messages.login_button = 'Sign In'
   auth.messages.logged_in = 'Signed In'
 
   auth.messages.logged_out = 'Signed Out'
 
   #'table3cols', 'divs', 'ul'
   auth.settings.formstyle = 'table3cols'
 
   auth.messages.register_button = 'Sign Up'

   ## configure auth policy
   auth.settings.registration_requires_verification = False
   auth.settings.registration_requires_approval = False
   auth.settings.reset_password_requires_verification = True

   #validate if email is valid on login
   auth.settings.login_email_validate = True
   #go to home page, otherwise goes to profile
   auth.settings.logged_url = None   
  
   #get rid of the second password field: 
 auth.settings.register_verify_password=False
   current.app.auth = auth

   auth = current.app.auth





[web2py] Re: Getting table a to use as default string from field in table b

2011-12-11 Thread tsvim
db.define_table('table_settings',
Field('name','string'),
Field('default_value','string'))

db.define_table('data',

Field('parent_table',db.table_settings,writable=False,readable=False),
Field('datetime','datetime',default=request.now),
Field('title','string'),
Field('value','string'))

db.data.value.default = db.table_settings['parent_table'].default_value
db.table_settings.default_value.requires = IS_IN_SET(['a','b'])



[web2py] Re: read once definitions - development vs. production

2011-12-11 Thread Constantine Vasil
Thank you, I tested it and it works both ways.

[web2py] Re: read once definitions - development vs. production

2011-12-11 Thread Constantine Vasil
Just to confirm:

If I put a code in /modules folder is it imported every time
on each function request?

I want it imported on demand only when I need it.


[web2py] Re: Rocket vs mod_wsgi

2011-12-11 Thread Massimo Di Pierro
I understand and it is very much appreciated. I will correct it.

massimo

On Dec 11, 10:15 am, rif  wrote:
> This comparison was intended to help writing the why web2py paragraph from
> the book (https://groups.google.com/d/topic/web2py/29jdfjejwZo/discussion)


[web2py] Re: web2py 1.99.3 is OUT

2011-12-11 Thread Massimo Di Pierro
Does this work?

.announce { clear:both;position:absolute;align:center;color:white;top:
120px;font-weight:bold;text-align:center;}

your proposed chance breaks it for me with chrome.

On Dec 11, 12:11 pm, Jim Gregory  wrote:
> Changing the "announce" class specification on line 13 in examples.css
> from :
>
> .announce { position:absolute;align:center;color:white;top:120px;font-
> weight:bold;text-align:center;}
>
> to:
> .announce {clear:both;color:white;top:120px;font-weight:bold;text-
> align:center;}
>
> takes care of the problem for me.
>
> -Jim
>
> On Dec 10, 6:02 pm, Stefan Scholl  wrote:
>
>
>
>
>
>
>
> > Massimo Di Pierro  wrote:
>
> > > The new web site layout needs work but we put it out there hoping for
> > > more feedback.
>
> > The announcement "2011 BOSSIE AWARD FOR OPEN SOURCE DEVELOPMENT
> > SOFTWARE" is cut off and too far on the right in Firefox 9.0 Beta
> > on Mac OS X 10.6.
>
> > Haven't found a good solution, but if you add a 
> > before the announce DIV, the text is centered again.


[web2py] Re: read once definitions - development vs. production

2011-12-11 Thread Massimo Di Pierro
No. code in models is executed at every request. Code in modules is
importent only once and cached. It is executed when functions in the
module are called (as in normal python).

On Dec 11, 2:51 pm, Constantine Vasil  wrote:
> Just to confirm:
>
> If I put a code in /modules folder is it imported every time
> on each function request?
>
> I want it imported on demand only when I need it.


[web2py] Re: server settings.

2011-12-11 Thread ron_m
I have recorded what might be a similar problem. If I run the application 
using the rocket server where the client browser and server are on the same 
LAN the application works. If I have the client come in from another 
location over a VPN I get partial pages. The Safari archive in the failure 
case is about 100k short of the 400k that a normal page load takes. The 
failed page looks like the jQuery Javascript that places symbols on a map 
did not run at the window.load event. If I take the same server 
configuration to apache/mod_wsgi it works fine in all cases.

An even stranger variable is if I use a different browser such as switching 
from Safari to Firefox it works in both client locations. Possibly 
different browsers have a different load order on resources within the 
page, there are several JS, CSS and image files that make up the page.

It looks to me like a time out on the server cuts short a portion of the 
page in the case the server is rocket and the client is coming on on a VPN 
over the WAN.

I have wireshark captures and Safari save page archives for working and 
failure cases if anyone wants to look. I am going to deploy on apache or 
nginx so the solution was more a matter of interest that I have not got 
around to working on yet.

Ron



[web2py] Re: Rocket vs mod_wsgi

2011-12-11 Thread peter
Any chance of trying uwsgi on its own, something like this

uwsgi --pythonpath /opt/web-apps/web2py --module wsgihandler --http :
80 -s /tmp/we2py.sock

Thanks
Peter

On Dec 11, 1:10 pm, rif  wrote:
> In the same environment I tested nginx configuration:
>
> nginx: 1.0.10
> uwsgi: 0.9.8.1
>
> ab -n1000 -c20http://192.168.122.187/welcome/default/index
> This is ApacheBench, Version 2.3 <$Revision: 655654 $>
> Copyright 1996 Adam Twiss, Zeus Technology Ltd,http://www.zeustech.net/
> Licensed to The Apache Software Foundation,http://www.apache.org/
>
> Benchmarking 192.168.122.187 (be patient)
> Completed 100 requests
> Completed 200 requests
> Completed 300 requests
> Completed 400 requests
> Completed 500 requests
> Completed 600 requests
> Completed 700 requests
> Completed 800 requests
> Completed 900 requests
> Completed 1000 requests
> Finished 1000 requests
>
> Server Software:        nginx/1.0.10
> Server Hostname:        192.168.122.187
> Server Port:            80
>
> Document Path:          /welcome/default/index
> Document Length:        11432 bytes
>
> Concurrency Level:      20
> Time taken for tests:   58.306 seconds
> Complete requests:      1000
> Failed requests:        0
> Write errors:           0
> Total transferred:      11819000 bytes
> HTML transferred:       11432000 bytes
> *Requests per second:    17.15 [#/sec] (mean)*
> Time per request:       1166.116 [ms] (mean)
> Time per request:       58.306 [ms] (mean, across all concurrent requests)
> Transfer rate:          197.96 [Kbytes/sec] received
>
> Connection Times (ms)
>               min  mean[+/-sd] median   max
> Connect:        0    1   1.3      0      12
> Processing:   218 1155 180.3   1104    2045
> Waiting:      217 1154 180.3   1104    2045
> Total:        225 1156 180.0   1105    2046
>
> Percentage of the requests served within a certain time (ms)
>   50%   1105
>   66%   1124
>   75%   1152
>   80%   1177
>   90%   1247
>   95%   1507
>   98%   2009
>   99%   2022
>  100%   2046 (longest request)
>
> Conclusion:
> Just a bit slower than Rocket.
>
> Nginx + wsgi is my current server configuration


[web2py] auth.requires_membership('admin') in templates

2011-12-11 Thread Vincenzo Ampolo

Hi,
is there a way to use auth.requires_membership('admin') in templates? i 
tried :


{{if auth.requires_membership('admin'):}}
Admin
{{pass}}


because :

print auth.requires_membership('admin')


How can i use auth.* ACs in templates?

thanks.

--
Vincenzo Ampolo
http://vincenzo-ampolo.net
http://goshawknest.wordpress.com



[web2py] Re: auth.requires_membership('admin') in templates

2011-12-11 Thread Vincenzo Ampolo

On 12/12/2011 12:22 AM, Vincenzo Ampolo wrote:

Hi,
is there a way to use auth.requires_membership('admin') in templates? 
i tried :


 {{if auth.requires_membership('admin'):}}
Admin
{{pass}}



I mean it didn't work because of this :


because :

print auth.requires_membership('admin')


How can i use auth.* ACs in templates?

thanks. 



--
Vincenzo Ampolo
http://vincenzo-ampolo.net
http://goshawknest.wordpress.com



[web2py] Re: Rocket vs mod_wsgi

2011-12-11 Thread rif
Compiled uwsgi 0.9.9.3 (the 0.9.8.1 did not now about pythonpath)
uwsgi --pythonpath /opt/web-apps/web2py --module wsgihandler --http :80 -s 
/tmp/we2py.sock >uwsgi.log 2>&1

1 CPU: 17.83 [#/sec] (better than rocket)
2 CPUs: 17.98 [#/sec]

uwsgi --pythonpath /opt/web-apps/web2py --module wsgihandler --http :80 -s 
/tmp/we2py.sock -M -p2 >uwsgi.log 2>&1

2 CPUs: 31.30 [#/sec]

I guess with the -p 2 enabled it was not as fast as nginx for static 
content.

Anyhow, is this a recommended setup? Doesn't it show the same behavior as 
gunicorn ( "Without this (nginx) buffering Gunicorn will be easily 
susceptible to denial-of-service attacks." )


[web2py] Re: auth.requires_membership('admin') in templates

2011-12-11 Thread Anthony
The various auth.requires... functions are strictly decorators. If you just 
need to test for membership, do:

{{if auth.has_membership('admin'):}}

See http://web2py.com/book/default/chapter/08#Authorization. 

Anthony

On Sunday, December 11, 2011 6:22:20 PM UTC-5, Vincenzo Ampolo wrote:
>
> Hi,
> is there a way to use auth.requires_membership('admin') in templates? i 
> tried :
>
>   {{if auth.requires_membership('admin'):}}
>  Admin
>  {{pass}}
>
>
> because :
>
> print auth.requires_membership('admin')
> 
>
> How can i use auth.* ACs in templates?
>
> thanks.
>
> -- 
> Vincenzo Ampolo
> http://vincenzo-ampolo.net
> http://goshawknest.wordpress.com
>
>

[web2py] Re: web2py 1.99.3 is OUT

2011-12-11 Thread Anthony
Massimo, shortly I'll be sending an updated 'examples' that fixes this as 
well as some other issues (courtesy of Chris May). The Bossie Award problem 
is resolved by moving the .announce div outside the statusbar div (perhaps 
it was nested inadvertently).

Anthony

On Sunday, December 11, 2011 3:58:00 PM UTC-5, Massimo Di Pierro wrote:
>
> Does this work?
>
> .announce { clear:both;position:absolute;align:center;color:white;top:
> 120px;font-weight:bold;text-align:center;}
>
> your proposed chance breaks it for me with chrome.
>
> On Dec 11, 12:11 pm, Jim Gregory  wrote:
> > Changing the "announce" class specification on line 13 in examples.css
> > from :
> >
> > .announce { position:absolute;align:center;color:white;top:120px;font-
> > weight:bold;text-align:center;}
> >
> > to:
> > .announce {clear:both;color:white;top:120px;font-weight:bold;text-
> > align:center;}
> >
> > takes care of the problem for me.
> >
> > -Jim
> >
> > On Dec 10, 6:02 pm, Stefan Scholl  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Massimo Di Pierro  wrote:
> >
> > > > The new web site layout needs work but we put it out there hoping for
> > > > more feedback.
> >
> > > The announcement "2011 BOSSIE AWARD FOR OPEN SOURCE DEVELOPMENT
> > > SOFTWARE" is cut off and too far on the right in Firefox 9.0 Beta
> > > on Mac OS X 10.6.
> >
> > > Haven't found a good solution, but if you add a 
> > > before the announce DIV, the text is centered again.
>
>

[web2py] weird database behavior

2011-12-11 Thread Nik Go
I have a custom auth_user field that I could edit from admin (and I can
verify that changes are actually written in the sqlite table) but every
time I check the data from a view, the field value is always set to the
initial default values, and not whatever's actually stored in the table.
It's like the data is being retrieved from some cache I don't know about.

I'm stumped. Has anyone experienced anything similar? This is the first
time I encountered this. What gives?


[web2py] Re: weird database behavior

2011-12-11 Thread Nik Go
And the other fields are still set to "none", while their true values are
otherwise.

On Monday, December 12, 2011, Nik Go wrote:

>
> Here's a screenshot. Noticed that i edited the name to"GJonathan" but the
> response.flash  retrieves it as "Jonathan"
>
> On Monday, December 12, 2011, Nik Go wrote:
>
>> I have a custom auth_user field that I could edit from admin (and I can
>> verify that changes are actually written in the sqlite table) but every
>> time I check the data from a view, the field value is always set to the
>> initial default values, and not whatever's actually stored in the table.
>> It's like the data is being retrieved from some cache I don't know about.
>>
>> I'm stumped. Has anyone experienced anything similar? This is the first
>> time I encountered this. What gives?
>>
>>
>>


[web2py] FluxFlex New Version Issue

2011-12-11 Thread Ismael Serratos
HI!! I just installed web2py on fluxlflex and I noticed it is the new
web2py version (best for me :D).

But just after installing it I tried to go to the admin interface and I get
this error:

"admin disabled because unable to access password file"

Thanks!!


[web2py] Re: FluxFlex New Version Issue

2011-12-11 Thread Massimo Di Pierro
You need to run it from shell once so that it creates the password
file.

On Dec 11, 8:14 pm, Ismael Serratos  wrote:
> HI!! I just installed web2py on fluxlflex and I noticed it is the new
> web2py version (best for me :D).
>
> But just after installing it I tried to go to the admin interface and I get
> this error:
>
> "admin disabled because unable to access password file"
>
> Thanks!!


Re: [web2py] Re: FluxFlex New Version Issue

2011-12-11 Thread Ismael Serratos
And how can I do that?


=( Sorry I've never used fluxflex.


On Sun, Dec 11, 2011 at 8:18 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> You need to run it from shell once so that it creates the password
> file.
>
> On Dec 11, 8:14 pm, Ismael Serratos  wrote:
> > HI!! I just installed web2py on fluxlflex and I noticed it is the new
> > web2py version (best for me :D).
> >
> > But just after installing it I tried to go to the admin interface and I
> get
> > this error:
> >
> > "admin disabled because unable to access password file"
> >
> > Thanks!!
>


Re: [web2py] Re: FluxFlex New Version Issue

2011-12-11 Thread ochiba77
Ismael,

You need to access by https and password is your mysql password. This 
instruction should be written in readme. 
Sent from my Verizon Wireless BlackBerry

-Original Message-
From: Ismael Serratos 
Sender: web2py@googlegroups.com
Date: Sun, 11 Dec 2011 20:27:30 
To: 
Reply-To: web2py@googlegroups.com
Subject: Re: [web2py] Re: FluxFlex New Version Issue

And how can I do that?


=( Sorry I've never used fluxflex.


On Sun, Dec 11, 2011 at 8:18 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> You need to run it from shell once so that it creates the password
> file.
>
> On Dec 11, 8:14 pm, Ismael Serratos  wrote:
> > HI!! I just installed web2py on fluxlflex and I noticed it is the new
> > web2py version (best for me :D).
> >
> > But just after installing it I tried to go to the admin interface and I
> get
> > this error:
> >
> > "admin disabled because unable to access password file"
> >
> > Thanks!!
>



Re: [web2py] Re: FluxFlex New Version Issue

2011-12-11 Thread Ismael Serratos
Now I'm having another issue, it doesn´t load anything, it was working but
now when I get into my url http://kodeside.fluxflex.com I get a server
error.

On Sun, Dec 11, 2011 at 9:35 PM,  wrote:

> **
> Ismael,
>
> You need to access by https and password is your mysql password. This
> instruction should be written in readme.
> Sent from my Verizon Wireless BlackBerry
> --
> *From: * Ismael Serratos 
> *Sender: * web2py@googlegroups.com
> *Date: *Sun, 11 Dec 2011 20:27:30 -0600
> *To: *
> *ReplyTo: * web2py@googlegroups.com
> *Subject: *Re: [web2py] Re: FluxFlex New Version Issue
>
> And how can I do that?
>
>
> =( Sorry I've never used fluxflex.
>
>
> On Sun, Dec 11, 2011 at 8:18 PM, Massimo Di Pierro <
> massimo.dipie...@gmail.com> wrote:
>
>> You need to run it from shell once so that it creates the password
>> file.
>>
>> On Dec 11, 8:14 pm, Ismael Serratos  wrote:
>> > HI!! I just installed web2py on fluxlflex and I noticed it is the new
>> > web2py version (best for me :D).
>> >
>> > But just after installing it I tried to go to the admin interface and I
>> get
>> > this error:
>> >
>> > "admin disabled because unable to access password file"
>> >
>> > Thanks!!
>>
>
>


Re: [web2py] Re: FluxFlex New Version Issue

2011-12-11 Thread ochiba77
Hm... I've never seen this error before. Is this your welcome app and you said 
it's just installed ? If you haven't done anything maybe you can reinstall from 
scratch.
Sent from my Verizon Wireless BlackBerry

-Original Message-
From: Ismael Serratos 
Sender: web2py@googlegroups.com
Date: Sun, 11 Dec 2011 21:38:32 
To: 
Reply-To: web2py@googlegroups.com
Subject: Re: [web2py] Re: FluxFlex New Version Issue

Now I'm having another issue, it doesn´t load anything, it was working but
now when I get into my url http://kodeside.fluxflex.com I get a server
error.

On Sun, Dec 11, 2011 at 9:35 PM,  wrote:

> **
> Ismael,
>
> You need to access by https and password is your mysql password. This
> instruction should be written in readme.
> Sent from my Verizon Wireless BlackBerry
> --
> *From: * Ismael Serratos 
> *Sender: * web2py@googlegroups.com
> *Date: *Sun, 11 Dec 2011 20:27:30 -0600
> *To: *
> *ReplyTo: * web2py@googlegroups.com
> *Subject: *Re: [web2py] Re: FluxFlex New Version Issue
>
> And how can I do that?
>
>
> =( Sorry I've never used fluxflex.
>
>
> On Sun, Dec 11, 2011 at 8:18 PM, Massimo Di Pierro <
> massimo.dipie...@gmail.com> wrote:
>
>> You need to run it from shell once so that it creates the password
>> file.
>>
>> On Dec 11, 8:14 pm, Ismael Serratos  wrote:
>> > HI!! I just installed web2py on fluxlflex and I noticed it is the new
>> > web2py version (best for me :D).
>> >
>> > But just after installing it I tried to go to the admin interface and I
>> get
>> > this error:
>> >
>> > "admin disabled because unable to access password file"
>> >
>> > Thanks!!
>>
>
>



[web2py] Re: weird database behavior

2011-12-11 Thread Anthony
Can you show some code? What do you mean "check the data from a view"?

On Sunday, December 11, 2011 8:43:50 PM UTC-5, ニコノコ wrote:
>
> I have a custom auth_user field that I could edit from admin (and I can 
> verify that changes are actually written in the sqlite table) but every 
> time I check the data from a view, the field value is always set to the 
> initial default values, and not whatever's actually stored in the table. 
> It's like the data is being retrieved from some cache I don't know about.
>
> I'm stumped. Has anyone experienced anything similar? This is the first 
> time I encountered this. What gives?
>
>
>

Re: [web2py] Re: FluxFlex New Version Issue

2011-12-11 Thread Ismael Serratos
In fact, I'm trying to create new projects, and new appliances of web2py
and with all happens the same.. http://kodesideman.fluxflex.com/ the new
one, same error, and the old one kodeside.fluxflex.com now I'm getting a
quota limit error. I'm wondering if is a fluxflex issue. I've already send
them an email.

On Sun, Dec 11, 2011 at 10:01 PM,  wrote:

> **
> Hm... I've never seen this error before. Is this your welcome app and you
> said it's just installed ? If you haven't done anything maybe you can
> reinstall from scratch.
> Sent from my Verizon Wireless BlackBerry
> --
> *From: * Ismael Serratos 
> *Sender: * web2py@googlegroups.com
> *Date: *Sun, 11 Dec 2011 21:38:32 -0600
> *To: *
> *ReplyTo: * web2py@googlegroups.com
> *Subject: *Re: [web2py] Re: FluxFlex New Version Issue
>
> Now I'm having another issue, it doesn´t load anything, it was working but
> now when I get into my url http://kodeside.fluxflex.com I get a server
> error.
>
> On Sun, Dec 11, 2011 at 9:35 PM,  wrote:
>
>> **
>> Ismael,
>>
>> You need to access by https and password is your mysql password. This
>> instruction should be written in readme.
>> Sent from my Verizon Wireless BlackBerry
>> --
>> *From: * Ismael Serratos 
>> *Sender: * web2py@googlegroups.com
>> *Date: *Sun, 11 Dec 2011 20:27:30 -0600
>> *To: *
>> *ReplyTo: * web2py@googlegroups.com
>> *Subject: *Re: [web2py] Re: FluxFlex New Version Issue
>>
>> And how can I do that?
>>
>>
>> =( Sorry I've never used fluxflex.
>>
>>
>> On Sun, Dec 11, 2011 at 8:18 PM, Massimo Di Pierro <
>> massimo.dipie...@gmail.com> wrote:
>>
>>> You need to run it from shell once so that it creates the password
>>> file.
>>>
>>> On Dec 11, 8:14 pm, Ismael Serratos  wrote:
>>> > HI!! I just installed web2py on fluxlflex and I noticed it is the new
>>> > web2py version (best for me :D).
>>> >
>>> > But just after installing it I tried to go to the admin interface and
>>> I get
>>> > this error:
>>> >
>>> > "admin disabled because unable to access password file"
>>> >
>>> > Thanks!!
>>>
>>
>>
>


Re: [web2py] Getting table a to use as default string from field in table b

2011-12-11 Thread Nik Go
db.table_settings.default_value.requires = IS_IN_SET(['a','b'])
db.table_settings['parent_table'].default_value*.default*

I think this is what you want, but make sure that you assign your
validators first in your table_settings, because otherwise they're empty
(or properly, None)


On Monday, December 12, 2011, tsvim wrote:

> db.define_table('table_settings',
> Field('name','string'),
> Field('default_value','string'))
>
> db.define_table('data',
>
> Field('parent_table',db.table_settings,writable=False,readable=False),
> Field('datetime','datetime',default=request.now),
> Field('title','string'),
> Field('value','string'))
>
> db.data.value.default = db.table_settings['parent_table'].default_value
> db.table_settings.default_value.requires = IS_IN_SET(['a','b'])
>
>


[web2py] Re: weird database behavior

2011-12-11 Thread ニコノコ
I meant, if the data is accessed from a function.

On Dec 12, 12:07 pm, Anthony  wrote:
> Can you show some code? What do you mean "check the data from a view"?
>
>
>
>
>
>
>
> On Sunday, December 11, 2011 8:43:50 PM UTC-5, ニコノコ wrote:
>
> > I have a custom auth_user field that I could edit from admin (and I can
> > verify that changes are actually written in the sqlite table) but every
> > time I check the data from a view, the field value is always set to the
> > initial default values, and not whatever's actually stored in the table.
> > It's like the data is being retrieved from some cache I don't know about.
>
> > I'm stumped. Has anyone experienced anything similar? This is the first
> > time I encountered this. What gives?


[web2py] Re: Getting table a to use as default string from field in table b

2011-12-11 Thread ニコノコ
SOrry, email editor mangled the text. SHould read:
db.table_settings['parent_table'].default_value.default


On Dec 12, 12:21 pm, Nik Go  wrote:
> db.table_settings.default_value.requires = IS_IN_SET(['a','b'])
> db.table_settings['parent_table'].default_value*.default*
>
> I think this is what you want, but make sure that you assign your
> validators first in your table_settings, because otherwise they're empty
> (or properly, None)
>
>
>
>
>
>
>
> On Monday, December 12, 2011, tsvim wrote:
> > db.define_table('table_settings',
> >                 Field('name','string'),
> >                 Field('default_value','string'))
>
> > db.define_table('data',
>
> > Field('parent_table',db.table_settings,writable=False,readable=False),
> >                 Field('datetime','datetime',default=request.now),
> >                 Field('title','string'),
> >                 Field('value','string'))
>
> > db.data.value.default = db.table_settings['parent_table'].default_value
> > db.table_settings.default_value.requires = IS_IN_SET(['a','b'])


[web2py] Re: read once definitions - development vs. production

2011-12-11 Thread Constantine Vasil
Thank you , Massimo!

[web2py] 500 internal server error after deployment of app and upgrade to latest version

2011-12-11 Thread Adnan Smajlovic
I switched several times between the old and the latest version of web2py, 
and the old version works fine in my environment, but the new one is giving 
the internal server error.

The old version is Version 1.94.3 (2011-03-17 20:22:37)

I know my version of Python is 2.4.3, but Host Gator was not eager to 
upgrade to a higher version. Is there anything else I should look for? 

I upgraded mod_wsgi to 3.3 (from previous 3.1), and all else is the same. 

Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8e-fips-rhel5 DAV/2 
mod_wsgi/3.3 Python/2.4.3 mod_auth_passthrough/2.1 mod_bwlimited/1.4 
FrontPage/5.0.2.2635 Server at w22.recruit55.com Port 80

Tried turning on logging for wsgihandler.py, but I don't see httpserver.log 
being created... 

Thanks,
A.


[web2py] Re: Getting table a to use as default string from field in table b

2011-12-11 Thread Anthony
On Sunday, December 11, 2011 1:53:11 PM UTC-5, tsvim wrote:
>
> db.define_table('table_settings',
> Field('name','string'),
> Field('default_value','string'))
>
> db.define_table('data',
> 
> Field('parent_table',db.table_settings,writable=False,readable=False),
> Field('datetime','datetime',default=request.now),
> Field('title','string'),
> Field('value','string'))
>
> db.data.value.default = db.table_settings['parent_table'].default_value
> db.table_settings.default_value.requires = IS_IN_SET(['a','b'])
>

It looks like you want the default value of db.data.value to be dependent 
on the particular parent_table selected. Obviously, this cannot be 
determined until after the parent_table has been selected. What do you want 
the user experience to be? Are you creating a form where the user will 
select a parent_table (i.e., one of the values stored in table_settings)? 
Upon selection, do you want the 'value' field to then be dynamically 
populated with the default_value from table_settings? If so, you'll need to 
set up an Ajax call on the client side. Another simpler alternative is 
using a computed field:

Field('value', compute=lambda r: 
db.table_settings[r.parent_table].default_value)

Note, by default, computed fields are not displayed in SQLFORMs. If you 
want the field to be displayed, you'll have to explicitly list the fields 
you want shown in the form. If the user leaves that field blank, the value 
will be computed as above -- otherwise, the user's submitted value will be 
inserted. Note, in this case, the user will not see any default value 
pre-populated in the field -- it will simply be blank and filled in on the 
server side after submission if no value has been entered.

See http://web2py.com/book/default/chapter/06#Computed-Fields.

Anthony


[web2py] Re: 500 internal server error after deployment of app and upgrade to latest version

2011-12-11 Thread Anthony
I don't think web2py supports Python 2.4 any more.

On Sunday, December 11, 2011 11:45:55 PM UTC-5, Adnan Smajlovic wrote:
>
> I switched several times between the old and the latest version of web2py, 
> and the old version works fine in my environment, but the new one is giving 
> the internal server error.
>
> The old version is Version 1.94.3 (2011-03-17 20:22:37)
>
> I know my version of Python is 2.4.3, but Host Gator was not eager to 
> upgrade to a higher version. Is there anything else I should look for? 
>
> I upgraded mod_wsgi to 3.3 (from previous 3.1), and all else is the same. 
>
> Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8e-fips-rhel5 DAV/2 
> mod_wsgi/3.3 Python/2.4.3 mod_auth_passthrough/2.1 mod_bwlimited/1.4 
> FrontPage/5.0.2.2635 Server at w22.recruit55.com Port 80
>
> Tried turning on logging for wsgihandler.py, but I don't see 
> httpserver.log being created... 
>
> Thanks,
> A.
>


[web2py] Re: weird database behavior

2011-12-11 Thread Anthony
Yes, but exactly how are you accessing it? Show your model code, how you 
are updating the data, and how you are then querying and displaying it.

On Sunday, December 11, 2011 11:23:39 PM UTC-5, ニコノコ wrote:
>
> I meant, if the data is accessed from a function.
>
> On Dec 12, 12:07 pm, Anthony  wrote:
> > Can you show some code? What do you mean "check the data from a view"?
> >
> >
> >
> >
> >
> >
> >
> > On Sunday, December 11, 2011 8:43:50 PM UTC-5, ニコノコ wrote:
> >
> > > I have a custom auth_user field that I could edit from admin (and I can
> > > verify that changes are actually written in the sqlite table) but every
> > > time I check the data from a view, the field value is always set to the
> > > initial default values, and not whatever's actually stored in the 
> table.
> > > It's like the data is being retrieved from some cache I don't know 
> about.
> >
> > > I'm stumped. Has anyone experienced anything similar? This is the first
> > > time I encountered this. What gives?
>


[web2py] Re: 500 internal server error after deployment of app and upgrade to latest version

2011-12-11 Thread Massimo Di Pierro
No we do not.

On Dec 11, 10:55 pm, Anthony  wrote:
> I don't think web2py supports Python 2.4 any more.
>
>
>
>
>
>
>
> On Sunday, December 11, 2011 11:45:55 PM UTC-5, Adnan Smajlovic wrote:
>
> > I switched several times between the old and the latest version of web2py,
> > and the old version works fine in my environment, but the new one is giving
> > the internal server error.
>
> > The old version is Version 1.94.3 (2011-03-17 20:22:37)
>
> > I know my version of Python is 2.4.3, but Host Gator was not eager to
> > upgrade to a higher version. Is there anything else I should look for?
>
> > I upgraded mod_wsgi to 3.3 (from previous 3.1), and all else is the same.
>
> > Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8e-fips-rhel5 DAV/2
> > mod_wsgi/3.3 Python/2.4.3 mod_auth_passthrough/2.1 mod_bwlimited/1.4
> > FrontPage/5.0.2.2635 Server at w22.recruit55.com Port 80
>
> > Tried turning on logging for wsgihandler.py, but I don't see
> > httpserver.log being created...
>
> > Thanks,
> > A.


[web2py] Re: CMS idea

2011-12-11 Thread Massimo Di Pierro
I made a better version and I made a video about it:

http://vimeo.com/33513600

Massimo

On Dec 10, 10:55 am, Massimo Di Pierro 
wrote:
> notice that every "edited" page gets its own new url... with minor
> changes one could make it edit its own pages and display a list of
> pages edited by the same user:
>
> Example of workflow:
> 1. point it to a page you like
> 2. clone it
> 3. edit it
> 4. clone the clone
> 5. edit it and add links to the other cloned page
> 6. goto 4
>
> ...
>
> the editor could be replaced with a minimalist version of ckeditor so
> one gets some clientside html validation.
> one could add macros like "$comments", "$contactform", translated
> serverside.
>
> On Dec 10, 10:07 am, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > Would be really nice if you could hack the jeditable in inject.js so
> > that when clicking on an image one could edit the src and when
> > clicking on a link one could edit the href as well as the content.
> > Although this could also be handled via some server-side re.sub.
>
> > On Dec 10, 2:12 am, Angelo Compagnucci 
> > wrote:
>
> > > Totally insane! I'm astonished!
>
> > > This could be really useful for a project I'm working on, it's really
> > > what I'm looking for!
>
> > > Thank you!
>
> > > 2011/12/10 Massimo Di Pierro :
>
> > > > I wrote this code which could be used to create a CMS.
>
> > > > The app basically asks for the URL of any existing pubic page. It 
> > > > allows you to edit the text of that page in place (simply double click 
> > > > on it) and saves it locally as a modified copy of the original page. It 
> > > > gives you a unique URL for the "spoofed" site. Basically this can be 
> > > > used to take any page and turn it into a layout. The in-place edit is 
> > > > filtered server-side therefore we can imagine all kind of manipulations 
> > > > such as using a markup language, etc.
>
> > > > It is setup as a working demo but it probably is illegal to run it on a 
> > > > public site as it is.
> > > > Yet you can install it on your machine and play with it.
>
> > > > There is lots of room for improvement.
>
> > > > Can somebody help and modify it so that all html and css are also 
> > > > downloaded and moved into a static subfolder, instead of linked?
>
> > > > Can somebody help and improve the popup textareas so that is looks 
> > > > better?
>
> > > > Massimo
>
> > > --
> > > Profile:http://www.gild.com/compagnucciangelo
> > > Register on Gild:http://www.gild.com/referral/compagnucciangelo


[web2py] Image broken in exported CSV

2011-12-11 Thread Saurabh S
Hi ,

I have a table in my application , i have stored a image field in one
column of that table.


but when i export the table via /appadmin, the image field appears to
be broken/in some format which is not readable.



How can i export the image as it is ?


Please provide suggestions.




[web2py] Image broken in exported CSV

2011-12-11 Thread Saurabh S
Hi ,

I have a table in my application , i have an image colomn in that
table which stores images.

when i export the table via /appadmin, the image field appears to
be broken/in some format which is not readable.

How can i export the image as it is (in the same format is it was
stored) ?


Please provide suggestions.


[web2py] Re: CMS idea

2011-12-11 Thread Massimo Di Pierro
And here is the full source

https://github.com/mdipierro/Plasmid

On Dec 11, 11:14 pm, Massimo Di Pierro 
wrote:
> I made a better version and I made a video about it:
>
> http://vimeo.com/33513600
>
> Massimo
>
> On Dec 10, 10:55 am, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > notice that every "edited" page gets its own new url... with minor
> > changes one could make it edit its own pages and display a list of
> > pages edited by the same user:
>
> > Example of workflow:
> > 1. point it to a page you like
> > 2. clone it
> > 3. edit it
> > 4. clone the clone
> > 5. edit it and add links to the other cloned page
> > 6. goto 4
>
> > ...
>
> > the editor could be replaced with a minimalist version of ckeditor so
> > one gets some clientside html validation.
> > one could add macros like "$comments", "$contactform", translated
> > serverside.
>
> > On Dec 10, 10:07 am, Massimo Di Pierro 
> > wrote:
>
> > > Would be really nice if you could hack the jeditable in inject.js so
> > > that when clicking on an image one could edit the src and when
> > > clicking on a link one could edit the href as well as the content.
> > > Although this could also be handled via some server-side re.sub.
>
> > > On Dec 10, 2:12 am, Angelo Compagnucci 
> > > wrote:
>
> > > > Totally insane! I'm astonished!
>
> > > > This could be really useful for a project I'm working on, it's really
> > > > what I'm looking for!
>
> > > > Thank you!
>
> > > > 2011/12/10 Massimo Di Pierro :
>
> > > > > I wrote this code which could be used to create a CMS.
>
> > > > > The app basically asks for the URL of any existing pubic page. It 
> > > > > allows you to edit the text of that page in place (simply double 
> > > > > click on it) and saves it locally as a modified copy of the original 
> > > > > page. It gives you a unique URL for the "spoofed" site. Basically 
> > > > > this can be used to take any page and turn it into a layout. The 
> > > > > in-place edit is filtered server-side therefore we can imagine all 
> > > > > kind of manipulations such as using a markup language, etc.
>
> > > > > It is setup as a working demo but it probably is illegal to run it on 
> > > > > a public site as it is.
> > > > > Yet you can install it on your machine and play with it.
>
> > > > > There is lots of room for improvement.
>
> > > > > Can somebody help and modify it so that all html and css are also 
> > > > > downloaded and moved into a static subfolder, instead of linked?
>
> > > > > Can somebody help and improve the popup textareas so that is looks 
> > > > > better?
>
> > > > > Massimo
>
> > > > --
> > > > Profile:http://www.gild.com/compagnucciangelo
> > > > Register on Gild:http://www.gild.com/referral/compagnucciangelo


Re: [web2py] Re: Rocket vs mod_wsgi

2011-12-11 Thread Roberto De Ioris

> Compiled uwsgi 0.9.9.3 (the 0.9.8.1 did not now about pythonpath)
> uwsgi --pythonpath /opt/web-apps/web2py --module wsgihandler --http :80 -s
> /tmp/we2py.sock >uwsgi.log 2>&1
>
> 1 CPU: 17.83 [#/sec] (better than rocket)
> 2 CPUs: 17.98 [#/sec]
>
> uwsgi --pythonpath /opt/web-apps/web2py --module wsgihandler --http :80 -s
> /tmp/we2py.sock -M -p2 >uwsgi.log 2>&1
>
> 2 CPUs: 31.30 [#/sec]
>
> I guess with the -p 2 enabled it was not as fast as nginx for static
> content.


because you are comparing a preforking (apache-style) approach with a
non-blocking one (nginx). For determistic areas (like serving static
files) there is no competition. This is why having a non blocking-server
on front of the application server is a common setup. Having a front-end
will obviously slow-down things, but the impact (as you have already
noted) is non-existant.

(by the way, --http is still a proxied-setup as the uwsgi http server will
run in another process, if you want native http you have to use
--http-socket)


In addition to this, you have to think about security: nginx, apache,
cherokee... are all developed for being front-line servers, and this
requires a higher level of security in mind.

>
> Anyhow, is this a recommended setup? Doesn't it show the same behavior as
> gunicorn ( "Without this (nginx) buffering Gunicorn will be easily
> susceptible to denial-of-service attacks." )
>

as i have already said having a front line server (like --http does) is
always a good choice, independently by the front-line server. Nginx has
obviously more tolerance in high-concurrency in serving static file (have
you tried the --static-map and --check-static option in uWSGI 1.0.x ?),
but
if you are developing the next amazon, you should really start thinking
about using a CDN for your static assets instead of your own webserver.

regarding gunicorn, it does only one thing and does it well (TM), its
philosophy is towards simplicity, writing logic to check the
good-behaviour of your app (like uWSGI morbidly does) is at the opposite
of that philosophy. I am perfectly agree with this approach (programmers
should fix their apps), but i work in a ISP where customers expect their
apps being available as most as possibile and tend to blame the ISP for
their fault (yes, it is a ugly world :).
That's why uWSGI exists and that's why you cannot compare it with gunicorn
(different philosophy and different target)


-- 
Roberto De Ioris
http://unbit.it


Re: [web2py] Re: Massimo

2011-12-11 Thread VIREN PATEL
Hatsoff to Massimo for all continuous help !!

On Thu, Dec 8, 2011 at 9:28 PM, Chris May  wrote:

> I second that!
>
> We are truly blessed to have so many great, patient and
> available contributors to the code and the community!
>
>
> Anthony, do you have the book memorized yet? :D
>


[web2py] Re: read once definitions - development vs. production

2011-12-11 Thread Vineet
As Anthony pointed out rightly, if you need that module for a specific
app, then put it in modules folder.
If that module is required to be imported in other apps as well, then
put it in site-packages folder.

HTH

-- Vineet

On Dec 11, 9:29 am, Constantine Vasil  wrote:
>  I just put my classes in site-packages/models.py
>
> and the 'from models import *'  made the classes available globally.
>
> So if I put them in /modules/models.py it would be the same?


[web2py] Re: server settings.

2011-12-11 Thread Mchurch
Thanks Massimo, I resolve it immediately after Your suggestions using
Tornado.
Rocket allows images until 123KB, not over in my case.
The issue shows up with both Opera mobile and android stock browser.
I've lost my brain in it yesterday, thanks!!
My best compliments for Your work.

On 11 Dic, 07:15, Massimo Di Pierro 
wrote:
> What's your mobile browser? How big are the images? It is possible
> there is a problem with chunked encoding with rocket. Other users have
> mentioned this and we are working on it. Meanwhile, can you try using
> apache or another web server? (look into web2py/anyserver.py)
>
> On Dec 10, 8:12 pm, Mchurch  wrote:
>
>
>
>
>
>
>
> > Hallo guys, I'm a newbie  in Web2py, but I like it a lot. I didn't
> > want to post for a such stupid question  but I'm stuck and don't know
> > how to resolve it.
> > I moved an application from rails to Web2py. basically a dynamic photo
> > gallery, and everything is working fine on my desktop. But on mobile
> > phones, somehow, I can't see heavy images (200 Kb), but light images
> > only! even changing the jquery lightbox with another, I can load
> > maximum 1/4 of heavy images. Is it possible that Web2py server is
> > blocking it somehow? The same jquery on rails works well, please, I
> > don't want to come back to raiiilss. No errors in console.
> > Nothing. If I change pictures with lighter ones, it works. I really
> > don't know where to look.
> > Mac, local host shared.on 0.0.0.0:8000/application
> > Thanks for Your time.
> > :/