[web2py] Re: Lacking nginx deployment guide

2011-03-27 Thread LightOfMooN
I reinstalled Nginx with
sudo add-apt-repository ppa:nginx/stable
sudo apt-get update
sudo apt-get install nginx

and now have error with sertificates

ssl_certificate  /opt/nginx/conf/server.crt;
ssl_certificate_key  /opt/nginx/conf/server.key;

Where can I get it?

On 27 мар, 05:55, VP vtp2...@gmail.com wrote:
 Make sure uwsgi has the correct path.  Look at /etc/init.d/uswgi

 There's a path to uwsgi.  The latest uwsgi sets the path to /usr/bin/
 uwgsi but it might have been installed in /usr/local/bin/uwsgi

 On Mar 26, 5:04 pm, LightOfMooN vladsale...@yandex.ru wrote:







  Hi
  I follow this 
  guidehttp://stackoverflow.com/questions/5335153/how-to-deply-web2py-using-...
  I have ubuntu 10.4 + nginx + web2py, installed in var

  And the result is 502 Bad Gateway.
  Any suggestions?


[web2py] Re: Lacking nginx deployment guide

2011-03-27 Thread LightOfMooN
David, I'd like to try nginx with fastcgi.
Can you give me some helpful links to deploy it?

On 27 мар, 08:32, David J. da...@styleflare.com wrote:
 I don't know about running web2py using uwsgi;

 However;

 When I run web2py with nginx I use the fastcgi module;

 I configure nginx like described in the stackoverflow article;

 except I use fastcgi;

 In nginx config I have

 location / {
      include fascgi_params;
      fastcgi_pass unix:/tmp/fcgi.sock

 }

 then go to web2py root and run the python fastcgihandler.py script;

 The caveat is that you have to change the permissions on the
 /tmp/fcgi.sock file because when web2py runs it; its run under the user
 that started the process;

 so you do

 chown nginx:nginx /tmp/fcgi.sock

 and then your done;

 You wont get and 502 errors or anything; its really quite simple;

 I am not sure if the uwsgi implementation is better as I am trying that
 tonight; but fastcgi has be running very stable for the past few months.

 I apologize for the lack of detailed instructions (I am not in front of
 the configs) but if you have any questions I can look into it further
 and try to help.

 Thanks.

 On 3/26/11 6:04 PM, LightOfMooN wrote:







  Hi
  I follow this 
  guidehttp://stackoverflow.com/questions/5335153/how-to-deply-web2py-using-...
  I have ubuntu 10.4 + nginx + web2py, installed in var

  And the result is 502 Bad Gateway.
  Any suggestions?


[web2py] Re: Lacking nginx deployment guide

2011-03-27 Thread pbreit
OK, here's another try. This is just a shell script which I have verified 
works on a clean Ubuntu 10.04 install. This script needs no additional 
editing. To get it to work with the script provided by Linode, everything is 
owned be the user uwsgi. Besides the script, the only other place where 
the user is specified is in the uwsgi init.d script. Still working on SSL 
but that shouldn't be too hard. Sorry if I have wasted anyone's time. I have 
certainly wasted a lot of my own!

SSH in as root:
root$ vi setup.sh (paste the script below and save)
root$ chmod +x setup.sh
root$ sudo ./setup.sh

=== setup.sh ===
#!/bin/bash

apt-get update
apt-get -y upgrade
apt-get -y install build-essential psmisc python-dev libxml2 libxml2-dev 
python-setuptools
adduser --system --no-create-home --disabled-login --disabled-password 
--group uwsgi

apt-get -y install unzip
cd /opt/
wget http://web2py.com/examples/static/web2py_src.zip
unzip web2py_src.zip
chown -R uwsgi:uwsgi web2py
cd web2py
sudo -u uwsgi python -c from gluon.widget import console; console();
sudo -u uwsgi python -c from gluon.main import save_password; 
save_password(raw_input('admin password: '),443)

cd /opt/
wget http://projects.unbit.it/downloads/uwsgi-0.9.6.8.tar.gz
tar -zxvf uwsgi*
mv uwsgi*/ uwsgi/
cd uwsgi/
python setup.py install
chown -R uwsgi:uwsgi /opt/uwsgi
touch /var/log/uwsgi.log
chown uwsgi /var/log/uwsgi.log

apt-get -y install libpcre3-dev build-essential libssl-dev
cd /opt/
wget http://nginx.org/download/nginx-0.8.54.tar.gz
tar -zxvf nginx-0.8.54.tar.gz
cd /opt/nginx-0.8.54/
./configure --prefix=/opt/nginx --user=nginx --group=nginx 
--with-http_ssl_module
make
make install
adduser --system --no-create-home --disabled-login --disabled-password 
--group nginx
cp /opt/uwsgi/nginx/uwsgi_params /opt/nginx/conf/uwsgi_params
wget 
https://library.linode.com/web-servers/nginx/installation/reference/init-deb.sh
mv init-deb.sh /etc/init.d/nginx
chmod +x /etc/init.d/nginx
/usr/sbin/update-rc.d -f nginx defaults
/etc/init.d/nginx start
cd /opt/
wget 
https://library.linode.com/web-servers/nginx/python-uwsgi/reference/init-deb.sh
mv /opt/init-deb.sh /etc/init.d/uwsgi
chmod +x /etc/init.d/uwsgi
echo 'PYTHONPATH=/opt/web2py/
MODULE=wsgihandler'  /etc/default/uwsgi
/usr/sbin/update-rc.d -f uwsgi defaults
/etc/init.d/uwsgi start

echo 'user uwsgi;
worker_processes  4;

events {
worker_connections  1024;
}

http {
include   mime.types;
default_type  application/octet-stream;

server {
listen   80;
server_name  ;

location / {
uwsgi_pass 127.0.0.1:9001;
includeuwsgi_params;
}

location /static {
root   /opt/web2py/applications/welcome/;
}
}
}'  /opt/nginx/conf/nginx.conf
/etc/init.d/nginx restart


[web2py] Re: Lacking nginx deployment guide

2011-03-27 Thread pbreit
Ah, that's probably what caused the problems since my scripts were pulling the 
latest version not a specific version.


[web2py] Re: Lacking nginx deployment guide

2011-03-27 Thread LightOfMooN
Huh, it runs :)
Thanks a lot!
I think, this + 443 port should be on web2py slices
Thanks again

On 27 мар, 13:24, pbreit pbreitenb...@gmail.com wrote:
 OK, here's another try. This is just a shell script which I have verified
 works on a clean Ubuntu 10.04 install. This script needs no additional
 editing. To get it to work with the script provided by Linode, everything is
 owned be the user uwsgi. Besides the script, the only other place where
 the user is specified is in the uwsgi init.d script. Still working on SSL
 but that shouldn't be too hard. Sorry if I have wasted anyone's time. I have
 certainly wasted a lot of my own!

 SSH in as root:
 root$ vi setup.sh (paste the script below and save)
 root$ chmod +x setup.sh
 root$ sudo ./setup.sh

 === setup.sh ===
 #!/bin/bash

 apt-get update
 apt-get -y upgrade
 apt-get -y install build-essential psmisc python-dev libxml2 libxml2-dev
 python-setuptools
 adduser --system --no-create-home --disabled-login --disabled-password
 --group uwsgi

 apt-get -y install unzip
 cd /opt/
 wgethttp://web2py.com/examples/static/web2py_src.zip
 unzip web2py_src.zip
 chown -R uwsgi:uwsgi web2py
 cd web2py
 sudo -u uwsgi python -c from gluon.widget import console; console();
 sudo -u uwsgi python -c from gluon.main import save_password;
 save_password(raw_input('admin password: '),443)

 cd /opt/
 wgethttp://projects.unbit.it/downloads/uwsgi-0.9.6.8.tar.gz
 tar -zxvf uwsgi*
 mv uwsgi*/ uwsgi/
 cd uwsgi/
 python setup.py install
 chown -R uwsgi:uwsgi /opt/uwsgi
 touch /var/log/uwsgi.log
 chown uwsgi /var/log/uwsgi.log

 apt-get -y install libpcre3-dev build-essential libssl-dev
 cd /opt/
 wgethttp://nginx.org/download/nginx-0.8.54.tar.gz
 tar -zxvf nginx-0.8.54.tar.gz
 cd /opt/nginx-0.8.54/
 ./configure --prefix=/opt/nginx --user=nginx --group=nginx
 --with-http_ssl_module
 make
 make install
 adduser --system --no-create-home --disabled-login --disabled-password
 --group nginx
 cp /opt/uwsgi/nginx/uwsgi_params /opt/nginx/conf/uwsgi_params
 wgethttps://library.linode.com/web-servers/nginx/installation/reference/i...
 mv init-deb.sh /etc/init.d/nginx
 chmod +x /etc/init.d/nginx
 /usr/sbin/update-rc.d -f nginx defaults
 /etc/init.d/nginx start
 cd /opt/
 wgethttps://library.linode.com/web-servers/nginx/python-uwsgi/reference/i...
 mv /opt/init-deb.sh /etc/init.d/uwsgi
 chmod +x /etc/init.d/uwsgi
 echo 'PYTHONPATH=/opt/web2py/
 MODULE=wsgihandler'  /etc/default/uwsgi
 /usr/sbin/update-rc.d -f uwsgi defaults
 /etc/init.d/uwsgi start

 echo 'user uwsgi;
 worker_processes  4;

 events {
     worker_connections  1024;

 }

 http {
     include       mime.types;
     default_type  application/octet-stream;

     server {
         listen       80;
         server_name  ;

         location / {
             uwsgi_pass     127.0.0.1:9001;
             include        uwsgi_params;
         }

         location /static {
             root   /opt/web2py/applications/welcome/;
         }
     }}'  /opt/nginx/conf/nginx.conf

 /etc/init.d/nginx restart


[web2py] Re: Web2py GAE integration

2011-03-27 Thread Luther Goh Lu Feng
Check your python version that you are running on. That tripped me up
badly the 1st time I used GAE with web2py

On Mar 27, 7:10 am, Shark shark4...@gmail.com wrote:
 We have troubles in GAE and web2py integration in our graduation
 project
 We tried many tutorials in the web and we fails so I hope you can help
 us with step by step advice

 Ahmed Sharkawy

 4th year engineering faculty


[web2py] Re: Lacking nginx deployment guide

2011-03-27 Thread LightOfMooN
Can't configure SSL.
pbreit, can you help?

I used this to create certificate:

cd /opt/nginx/conf; openssl genrsa -out server.key 1024
cd /opt/nginx/conf; openssl req -batch -new -key server.key -out
server.csr
cd /opt/nginx/conf;
openssl x509 -req -days 1780 -in server.csr -signkey server.key -out
server.crt

And add this to nginx.conf

server {
listen   443;
server_name  ;
 ssl  on;
 ssl_certificate  /opt/nginx/conf/server.crt;
 ssl_certificate_key  /opt/nginx/conf/server.key;

location / {
uwsgi_pass 127.0.0.1:9001;
includeuwsgi_params;
uwsgi_param UWSGI_SCHEME $scheme;
}
location /static {
root   /opt/web2py/applications/welcome/;
}
}

But if I try to start nginx, it rises error:
unknown directive ssl

On 27 мар, 13:50, LightOfMooN vladsale...@yandex.ru wrote:
 Huh, it runs :)
 Thanks a lot!
 I think, this + 443 port should be on web2py slices
 Thanks again

 On 27 мар, 13:24, pbreit pbreitenb...@gmail.com wrote:







  OK, here's another try. This is just a shell script which I have verified
  works on a clean Ubuntu 10.04 install. This script needs no additional
  editing. To get it to work with the script provided by Linode, everything is
  owned be the user uwsgi. Besides the script, the only other place where
  the user is specified is in the uwsgi init.d script. Still working on SSL
  but that shouldn't be too hard. Sorry if I have wasted anyone's time. I have
  certainly wasted a lot of my own!

  SSH in as root:
  root$ vi setup.sh (paste the script below and save)
  root$ chmod +x setup.sh
  root$ sudo ./setup.sh

  === setup.sh ===
  #!/bin/bash

  apt-get update
  apt-get -y upgrade
  apt-get -y install build-essential psmisc python-dev libxml2 libxml2-dev
  python-setuptools
  adduser --system --no-create-home --disabled-login --disabled-password
  --group uwsgi

  apt-get -y install unzip
  cd /opt/
  wgethttp://web2py.com/examples/static/web2py_src.zip
  unzip web2py_src.zip
  chown -R uwsgi:uwsgi web2py
  cd web2py
  sudo -u uwsgi python -c from gluon.widget import console; console();
  sudo -u uwsgi python -c from gluon.main import save_password;
  save_password(raw_input('admin password: '),443)

  cd /opt/
  wgethttp://projects.unbit.it/downloads/uwsgi-0.9.6.8.tar.gz
  tar -zxvf uwsgi*
  mv uwsgi*/ uwsgi/
  cd uwsgi/
  python setup.py install
  chown -R uwsgi:uwsgi /opt/uwsgi
  touch /var/log/uwsgi.log
  chown uwsgi /var/log/uwsgi.log

  apt-get -y install libpcre3-dev build-essential libssl-dev
  cd /opt/
  wgethttp://nginx.org/download/nginx-0.8.54.tar.gz
  tar -zxvf nginx-0.8.54.tar.gz
  cd /opt/nginx-0.8.54/
  ./configure --prefix=/opt/nginx --user=nginx --group=nginx
  --with-http_ssl_module
  make
  make install
  adduser --system --no-create-home --disabled-login --disabled-password
  --group nginx
  cp /opt/uwsgi/nginx/uwsgi_params /opt/nginx/conf/uwsgi_params
  wgethttps://library.linode.com/web-servers/nginx/installation/reference/i...
  mv init-deb.sh /etc/init.d/nginx
  chmod +x /etc/init.d/nginx
  /usr/sbin/update-rc.d -f nginx defaults
  /etc/init.d/nginx start
  cd /opt/
  wgethttps://library.linode.com/web-servers/nginx/python-uwsgi/reference/i...
  mv /opt/init-deb.sh /etc/init.d/uwsgi
  chmod +x /etc/init.d/uwsgi
  echo 'PYTHONPATH=/opt/web2py/
  MODULE=wsgihandler'  /etc/default/uwsgi
  /usr/sbin/update-rc.d -f uwsgi defaults
  /etc/init.d/uwsgi start

  echo 'user uwsgi;
  worker_processes  4;

  events {
      worker_connections  1024;

  }

  http {
      include       mime.types;
      default_type  application/octet-stream;

      server {
          listen       80;
          server_name  ;

          location / {
              uwsgi_pass     127.0.0.1:9001;
              include        uwsgi_params;
          }

          location /static {
              root   /opt/web2py/applications/welcome/;
          }
      }}'  /opt/nginx/conf/nginx.conf

  /etc/init.d/nginx restart


[web2py] Re: Lacking nginx deployment guide

2011-03-27 Thread LightOfMooN
Sorry, it's my bad. Just compiled without http_ssl_module, because I
missed newline when pasted script

On 27 мар, 14:18, LightOfMooN vladsale...@yandex.ru wrote:
 Can't configure SSL.
 pbreit, can you help?

 I used this to create certificate:

 cd /opt/nginx/conf; openssl genrsa -out server.key 1024
 cd /opt/nginx/conf; openssl req -batch -new -key server.key -out
 server.csr
 cd /opt/nginx/conf;
 openssl x509 -req -days 1780 -in server.csr -signkey server.key -out
 server.crt

 And add this to nginx.conf

 server {
         listen       443;
         server_name  ;
          ssl                  on;
          ssl_certificate      /opt/nginx/conf/server.crt;
          ssl_certificate_key  /opt/nginx/conf/server.key;

         location / {
             uwsgi_pass     127.0.0.1:9001;
             include        uwsgi_params;
             uwsgi_param     UWSGI_SCHEME $scheme;
         }
         location /static {
             root   /opt/web2py/applications/welcome/;
         }
     }

 But if I try to start nginx, it rises error:
 unknown directive ssl

 On 27 мар, 13:50, LightOfMooN vladsale...@yandex.ru wrote:







  Huh, it runs :)
  Thanks a lot!
  I think, this + 443 port should be on web2py slices
  Thanks again

  On 27 мар, 13:24, pbreit pbreitenb...@gmail.com wrote:

   OK, here's another try. This is just a shell script which I have verified
   works on a clean Ubuntu 10.04 install. This script needs no additional
   editing. To get it to work with the script provided by Linode, everything 
   is
   owned be the user uwsgi. Besides the script, the only other place where
   the user is specified is in the uwsgi init.d script. Still working on SSL
   but that shouldn't be too hard. Sorry if I have wasted anyone's time. I 
   have
   certainly wasted a lot of my own!

   SSH in as root:
   root$ vi setup.sh (paste the script below and save)
   root$ chmod +x setup.sh
   root$ sudo ./setup.sh

   === setup.sh ===
   #!/bin/bash

   apt-get update
   apt-get -y upgrade
   apt-get -y install build-essential psmisc python-dev libxml2 libxml2-dev
   python-setuptools
   adduser --system --no-create-home --disabled-login --disabled-password
   --group uwsgi

   apt-get -y install unzip
   cd /opt/
   wgethttp://web2py.com/examples/static/web2py_src.zip
   unzip web2py_src.zip
   chown -R uwsgi:uwsgi web2py
   cd web2py
   sudo -u uwsgi python -c from gluon.widget import console; console();
   sudo -u uwsgi python -c from gluon.main import save_password;
   save_password(raw_input('admin password: '),443)

   cd /opt/
   wgethttp://projects.unbit.it/downloads/uwsgi-0.9.6.8.tar.gz
   tar -zxvf uwsgi*
   mv uwsgi*/ uwsgi/
   cd uwsgi/
   python setup.py install
   chown -R uwsgi:uwsgi /opt/uwsgi
   touch /var/log/uwsgi.log
   chown uwsgi /var/log/uwsgi.log

   apt-get -y install libpcre3-dev build-essential libssl-dev
   cd /opt/
   wgethttp://nginx.org/download/nginx-0.8.54.tar.gz
   tar -zxvf nginx-0.8.54.tar.gz
   cd /opt/nginx-0.8.54/
   ./configure --prefix=/opt/nginx --user=nginx --group=nginx
   --with-http_ssl_module
   make
   make install
   adduser --system --no-create-home --disabled-login --disabled-password
   --group nginx
   cp /opt/uwsgi/nginx/uwsgi_params /opt/nginx/conf/uwsgi_params
   wgethttps://library.linode.com/web-servers/nginx/installation/reference/i...
   mv init-deb.sh /etc/init.d/nginx
   chmod +x /etc/init.d/nginx
   /usr/sbin/update-rc.d -f nginx defaults
   /etc/init.d/nginx start
   cd /opt/
   wgethttps://library.linode.com/web-servers/nginx/python-uwsgi/reference/i...
   mv /opt/init-deb.sh /etc/init.d/uwsgi
   chmod +x /etc/init.d/uwsgi
   echo 'PYTHONPATH=/opt/web2py/
   MODULE=wsgihandler'  /etc/default/uwsgi
   /usr/sbin/update-rc.d -f uwsgi defaults
   /etc/init.d/uwsgi start

   echo 'user uwsgi;
   worker_processes  4;

   events {
       worker_connections  1024;

   }

   http {
       include       mime.types;
       default_type  application/octet-stream;

       server {
           listen       80;
           server_name  ;

           location / {
               uwsgi_pass     127.0.0.1:9001;
               include        uwsgi_params;
           }

           location /static {
               root   /opt/web2py/applications/welcome/;
           }
       }}'  /opt/nginx/conf/nginx.conf

   /etc/init.d/nginx restart


[web2py] Found an app running on facebook with web2py.

2011-03-27 Thread Jason Brower
I don't use facebook, but he mentioned it runs on web2py I wanted to 
post the link to it here.

http://mytop10gift.appspot.com/
BR,
Jason Brower



[web2py] Re: Web2py GAE integration

2011-03-27 Thread Mariusz Zieliński
More details would be useful. I'm no expert on deploying on GAE,
though I succesfully managed to deploy my first app on GAE
yesterday :) I got some problems with app.yaml file as with some rules
from example file in skip_files section there were errors, that it
couldn't find contrib modules. Other than that deployment went without
problems. Also remember to run app on Python 2.5 just like Luther
wrote as that's version which GAE uses currently.

On 27 Mar, 01:10, Shark shark4...@gmail.com wrote:
 We have troubles in GAE and web2py integration in our graduation
 project
 We tried many tutorials in the web and we fails so I hope you can help
 us with step by step advice

 Ahmed Sharkawy

 4th year engineering faculty


[web2py] Re: Lacking nginx deployment guide

2011-03-27 Thread LightOfMooN
also need add into nginx.conf something like this:

sendfileon;
client_max_body_size 100M;

to avoid 413 Request Entity Too Large
when upload big files


Re: [web2py] Re: Cherokee server locking while upload

2011-03-27 Thread Roberto De Ioris

 Thx, but what is the best solution for now to deploy web2py with more
 than 3k users online, which can upload and download files?


No using a streaming upload webserver will solve your problem

Move to nginx, this will solve your specific problem, and use
X-Accel-Redirect (this is the equivalent of X-Sendfile in nginx) for all
the downloads.



 On 27 ÜÐà, 11:46, Roberto De Ioris robe...@unbit.it wrote:
  Thx, processes4/processes helps.
  But so if 4 users go to page with image, or upload some file, all will
  be crashed again.
  Is it a good to have processes1000/processes?
  Sounds bad

 This is a normal deploy problem (not related to uWSGI). This is why
 async/evented is so loved this days :) If your machine can tolerate 1000
 processes (but sorry i do not think so) use this, but every process is a
 full copy of your app stack so memory will be devoured.

 If you have so many users doing uploads, you can try threads (they are
 cheaper than processes) but the best solution would be Cherokee
 disabiling
 streaming uploads to pass the request to uWSGI only when the upload is
 done.

 I will talk to the Cherokee lead developer to reintroduce this feature
 (before 1 point releases Cherokee worked that way)

 --
 Roberto De Iorishttp://unbit.it



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


[web2py] Re: Cherokee server locking while upload

2011-03-27 Thread LightOfMooN
Yes, just tested it.
Many parallel downloads, nice speed, and no locks even more.
Nginx Rocks!

On 27 мар, 15:41, Roberto De Ioris robe...@unbit.it wrote:
  Thx, but what is the best solution for now to deploy web2py with more
  than 3k users online, which can upload and download files?

 No using a streaming upload webserver will solve your problem

 Move to nginx, this will solve your specific problem, and use
 X-Accel-Redirect (this is the equivalent of X-Sendfile in nginx) for all
 the downloads.











  On 27 , 11:46, Roberto De Ioris robe...@unbit.it wrote:
   Thx, processes4/processes helps.
   But so if 4 users go to page with image, or upload some file, all will
   be crashed again.
   Is it a good to have processes1000/processes?
   Sounds bad

  This is a normal deploy problem (not related to uWSGI). This is why
  async/evented is so loved this days :) If your machine can tolerate 1000
  processes (but sorry i do not think so) use this, but every process is a
  full copy of your app stack so memory will be devoured.

  If you have so many users doing uploads, you can try threads (they are
  cheaper than processes) but the best solution would be Cherokee
  disabiling
  streaming uploads to pass the request to uWSGI only when the upload is
  done.

  I will talk to the Cherokee lead developer to reintroduce this feature
  (before 1 point releases Cherokee worked that way)

  --
  Roberto De Iorishttp://unbit.it

 --
 Roberto De Iorishttp://unbit.it


[web2py] Re: Web2py GAE integration

2011-03-27 Thread johntynan
Ahmed,

I had written a tutorial about Setting up web2py for use with Google
App Engine here:

http://opensourcebroadcasting.blogspot.com/2010/04/setting-up-web2py-for-use-with-google.html

Please feel free to have a look and let me know if this helps you.

Also, please feel free to let me know if anything has gone out of
date.


On Mar 27, 11:08 am, Mariusz Zieliński evile...@gmail.com wrote:
 More details would be useful. I'm no expert on deploying on GAE,
 though I succesfully managed to deploy my first app on GAE
 yesterday :) I got some problems with app.yaml file as with some rules
 from example file in skip_files section there were errors, that it
 couldn't find contrib modules. Other than that deployment went without
 problems. Also remember to run app on Python 2.5 just like Luther
 wrote as that's version which GAE uses currently.

 On 27 Mar, 01:10, Shark shark4...@gmail.com wrote:

  We have troubles in GAE and web2py integration in our graduation
  project
  We tried many tutorials in the web and we fails so I hope you can help
  us with step by step advice

  Ahmed Sharkawy

  4th year engineering faculty




[web2py] add single pseudo-field to SQLFORM

2011-03-27 Thread Brian Will
I have an insert SQLFORM of 8 fields, to which I'd like to add a
single I agree to terms checkbox at the bottom. There are probably
tons of ways to do this, but I'm hoping someone has a really simple
method that doesn't require resorting to a manual FORM? Can I simply
tack on another INPUT to the SQLFORM? (Bonus points for placing it
after my last field but before the submit button). Here's the current
code.

form = SQLFORM(db.job_post, submit_button='Post Job',
formstyle='table2cols',
fields=['poster_name', 'poster_email', 'poster_phone',
'zipcode', 'location_description', 'job_type', 'job_title',
'job_description'],
_id='postjob'
)

if form.accepts(request.vars, session):
redirect(URL('post_email', vars={'id': form.vars.id,
'poster_name': form.vars.poster_name, 'poster_email':
form.vars.poster_email}))


What's solution allows me to make the minimal change? The simplest
solution that occurs to me is to use a SQLFORM.factory:


form = SQLFORM(db.job_post.poster_name, db.job_post.poster_email,
db.job_post.poster_phone, db.job_post.zipcode,
db.job_post.location_description, db.job_post.job_type,
db.job_post.job_title, db.job_post.job_description, FIELD('terms',
'boolean', IS_EQUAL_TO(True)) submit_button='Post Job',
formstyle='table2cols',
_id='postjob'
)

if form.accepts(request.vars, session):
form.vars.id =
db.job_post.insert(**db.job_post._filter_fields(request.vars))
redirect(URL('post_email', vars={'id': form.vars.id,
'poster_name': form.vars.poster_name, 'poster_email':
form.vars.poster_email}))


I guess this isn't too onerous, but I don't really like having to
manually do the insert, so I'm wondering about alternatives. BTW, why
does _filter_fields begin with _ if it's used publicly? Shouldn't it
just be filter_fields?


[web2py] Re: Found an app running on facebook with web2py.

2011-03-27 Thread Anthony
It's also listed on http://web2py.com/poweredby

On Sunday, March 27, 2011 4:51:56 AM UTC-4, encompass wrote:

 I don't use facebook, but he mentioned it runs on web2py I wanted to 
 post the link to it here.
 http://mytop10gift.appspot.com/
 BR,
 Jason Brower 



[web2py] Re: add single pseudo-field to SQLFORM

2011-03-27 Thread villas
Hi Brian

One rather low-level way to add a field to a SQLFORM would be
something like this:

myinput = INPUT(_type='checkbox',_name='test')
f = SQLFORM(db.job_post)
f[0].insert(len(f[0])-1,myinput)

See also this post from Bruno:

http://groups.google.com/group/web2py/msg/41fbeda903c71f3f

There are probably better methods to deal with this. When we have
established the best way, we should put this in the book.

Regards,  David

On Mar 27, 11:43 am, Brian Will brian.thomas.w...@gmail.com wrote:
 I have an insert SQLFORM of 8 fields, to which I'd like to add a
 single I agree to terms checkbox at the bottom. There are probably
 tons of ways to do this, but I'm hoping someone has a really simple
 method that doesn't require resorting to a manual FORM? Can I simply
 tack on another INPUT to the SQLFORM? (Bonus points for placing it
 after my last field but before the submit button). Here's the current
 code.

     form = SQLFORM(db.job_post, submit_button='Post Job',
 formstyle='table2cols',
         fields=['poster_name', 'poster_email', 'poster_phone',
 'zipcode', 'location_description', 'job_type', 'job_title',
 'job_description'],
         _id='postjob'
     )

     if form.accepts(request.vars, session):
         redirect(URL('post_email', vars={'id': form.vars.id,
 'poster_name': form.vars.poster_name, 'poster_email':
 form.vars.poster_email}))

 What's solution allows me to make the minimal change? The simplest
 solution that occurs to me is to use a SQLFORM.factory:

     form = SQLFORM(db.job_post.poster_name, db.job_post.poster_email,
 db.job_post.poster_phone, db.job_post.zipcode,
 db.job_post.location_description, db.job_post.job_type,
 db.job_post.job_title, db.job_post.job_description, FIELD('terms',
 'boolean', IS_EQUAL_TO(True)) submit_button='Post Job',
 formstyle='table2cols',
         _id='postjob'
     )

     if form.accepts(request.vars, session):
         form.vars.id =
 db.job_post.insert(**db.job_post._filter_fields(request.vars))
         redirect(URL('post_email', vars={'id': form.vars.id,
 'poster_name': form.vars.poster_name, 'poster_email':
 form.vars.poster_email}))

 I guess this isn't too onerous, but I don't really like having to
 manually do the insert, so I'm wondering about alternatives. BTW, why
 does _filter_fields begin with _ if it's used publicly? Shouldn't it
 just be filter_fields?


[web2py] Re: getting fields created by SQLFORM but which are not in the form

2011-03-27 Thread DenesL

On Mar 26, 9:22 pm, Brian Will brian.thomas.w...@gmail.com wrote:
 Found my own answer: I can create an onvalidation function for the
 form that only runs when the form is accepted but before the new
 record is made.

Right

 The problem this then introduces is how to set the
 enclosing variable from the function without use of nonlocal.

you could add it to the form

 Guess I
 can just create a dict for the vars ahead of time and set that from
 the function. Like so:

     vars = {}

     def get_uuid(form):
         from uuid import uuid4
         uuid = uuid4()
         db.job_post.uuid.default = lambda: uuid
         vars['uuid'] = uuid

def get_uuid(form):
from uuid import uuid4
form.vars.uuid = uuid4()

Setting a field's default value is useful before creating a form,
at this point you are between acceptance and db i/o.
BTW, you don't need lambda to set a default.

     if form.accepts(request.vars, session, onvalidation=get_uuid):
         vars['poster_name'] = form.vars.poster_name
         vars['poster_email'] = form.vars.poster_email
         redirect(URL('post_email', vars=vars))

if form.accepts(request.vars, session, onvalidation=get_uuid):
   redirect(URL('post_email',
   vars={'poster_name' : form.vars.poster_name,
 'poster_email' : form.vars.poster_email})


[web2py] Re: add single pseudo-field to SQLFORM

2011-03-27 Thread DenesL

Just add

form[0].insert(-2,TR(LABEL('I agree to
terms'),INPUT(_name='agree',value=True,_type='checkbox')))

after the form has been defined.
On submission form.vars.agree will have the status of the checkbox,
which you probably would check using onvalidation.

Where do I collect my bonus points? ;)



On Mar 27, 6:43 am, Brian Will brian.thomas.w...@gmail.com wrote:
 I have an insert SQLFORM of 8 fields, to which I'd like to add a
 single I agree to terms checkbox at the bottom. There are probably
 tons of ways to do this, but I'm hoping someone has a really simple
 method that doesn't require resorting to a manual FORM? Can I simply
 tack on another INPUT to the SQLFORM? (Bonus points for placing it
 after my last field but before the submit button). Here's the current
 code.

     form = SQLFORM(db.job_post, submit_button='Post Job',
 formstyle='table2cols',
         fields=['poster_name', 'poster_email', 'poster_phone',
 'zipcode', 'location_description', 'job_type', 'job_title',
 'job_description'],
         _id='postjob'
     )

     if form.accepts(request.vars, session):
         redirect(URL('post_email', vars={'id': form.vars.id,
 'poster_name': form.vars.poster_name, 'poster_email':
 form.vars.poster_email}))

 What's solution allows me to make the minimal change? The simplest
 solution that occurs to me is to use a SQLFORM.factory:

     form = SQLFORM(db.job_post.poster_name, db.job_post.poster_email,
 db.job_post.poster_phone, db.job_post.zipcode,
 db.job_post.location_description, db.job_post.job_type,
 db.job_post.job_title, db.job_post.job_description, FIELD('terms',
 'boolean', IS_EQUAL_TO(True)) submit_button='Post Job',
 formstyle='table2cols',
         _id='postjob'
     )

     if form.accepts(request.vars, session):
         form.vars.id =
 db.job_post.insert(**db.job_post._filter_fields(request.vars))
         redirect(URL('post_email', vars={'id': form.vars.id,
 'poster_name': form.vars.poster_name, 'poster_email':
 form.vars.poster_email}))

 I guess this isn't too onerous, but I don't really like having to
 manually do the insert, so I'm wondering about alternatives. BTW, why
 does _filter_fields begin with _ if it's used publicly? Shouldn't it
 just be filter_fields?


[web2py] Re: add single pseudo-field to SQLFORM

2011-03-27 Thread Anthony
See also 
http://web2py.com/book/default/chapter/05#Server-side-DOM-and-Parsing and 
http://www.web2pyslices.com/main/slices/take_slice/43.

On Sunday, March 27, 2011 9:03:26 AM UTC-4, villas wrote:

 Hi Brian 

 One rather low-level way to add a field to a SQLFORM would be 
 something like this: 

 myinput = INPUT(_type='checkbox',_name='test') 
 f = SQLFORM(db.job_post) 
 f[0].insert(len(f[0])-1,myinput) 

 See also this post from Bruno: 

 http://groups.google.com/group/web2py/msg/41fbeda903c71f3f 

 There are probably better methods to deal with this. When we have 
 established the best way, we should put this in the book. 

 Regards,  David 

 On Mar 27, 11:43 am, Brian Will brian.th...@gmail.com wrote: 
  I have an insert SQLFORM of 8 fields, to which I'd like to add a 
  single I agree to terms checkbox at the bottom. There are probably 
  tons of ways to do this, but I'm hoping someone has a really simple 
  method that doesn't require resorting to a manual FORM? Can I simply 
  tack on another INPUT to the SQLFORM? (Bonus points for placing it 
  after my last field but before the submit button). Here's the current 
  code. 
  
  form = SQLFORM(db.job_post, submit_button='Post Job', 
  formstyle='table2cols', 
  fields=['poster_name', 'poster_email', 'poster_phone', 
  'zipcode', 'location_description', 'job_type', 'job_title', 
  'job_description'], 
  _id='postjob' 
  ) 
  
  if form.accepts(request.vars, session): 
  redirect(URL('post_email', vars={'id': form.vars.id, 
  'poster_name': form.vars.poster_name, 'poster_email': 
  form.vars.poster_email})) 
  
  What's solution allows me to make the minimal change? The simplest 
  solution that occurs to me is to use a SQLFORM.factory: 
  
  form = SQLFORM(db.job_post.poster_name, db.job_post.poster_email, 
  db.job_post.poster_phone, db.job_post.zipcode, 
  db.job_post.location_description, db.job_post.job_type, 
  db.job_post.job_title, db.job_post.job_description, FIELD('terms', 
  'boolean', IS_EQUAL_TO(True)) submit_button='Post Job', 
  formstyle='table2cols', 
  _id='postjob' 
  ) 
  
  if form.accepts(request.vars, session): 
  form.vars.id = 
  db.job_post.insert(**db.job_post._filter_fields(request.vars)) 
  redirect(URL('post_email', vars={'id': form.vars.id, 
  'poster_name': form.vars.poster_name, 'poster_email': 
  form.vars.poster_email})) 
  
  I guess this isn't too onerous, but I don't really like having to 
  manually do the insert, so I'm wondering about alternatives. BTW, why 
  does _filter_fields begin with _ if it's used publicly? Shouldn't it 
  just be filter_fields?



[web2py] clean database

2011-03-27 Thread LightOfMooN
Is there a way to pack just app code?
(without images and other uploads)
Or it can be done only by manual delete upload content?


Re: [web2py] Re: Web2py GAE integration

2011-03-27 Thread Ahmed Sharkawy
*Thanks for help but I need step by step tutorial for windows if you can so
you elp us in solve a big trouble in our project*
*
*
*Do I need to edit some files ?*
*How to tell GAE that this my app ?*
*
*
*Thanks in advance
*
2011/3/27 johntynan jgty...@gmail.com

 Ahmed,

 I had written a tutorial about Setting up web2py for use with Google
 App Engine here:


 http://opensourcebroadcasting.blogspot.com/2010/04/setting-up-web2py-for-use-with-google.html

 Please feel free to have a look and let me know if this helps you.

 Also, please feel free to let me know if anything has gone out of
 date.


 On Mar 27, 11:08 am, Mariusz Zieliński evile...@gmail.com wrote:
  More details would be useful. I'm no expert on deploying on GAE,
  though I succesfully managed to deploy my first app on GAE
  yesterday :) I got some problems with app.yaml file as with some rules
  from example file in skip_files section there were errors, that it
  couldn't find contrib modules. Other than that deployment went without
  problems. Also remember to run app on Python 2.5 just like Luther
  wrote as that's version which GAE uses currently.
 
  On 27 Mar, 01:10, Shark shark4...@gmail.com wrote:
 
   We have troubles in GAE and web2py integration in our graduation
   project
   We tried many tutorials in the web and we fails so I hope you can help
   us with step by step advice
 
   Ahmed Sharkawy
 
   4th year engineering faculty
 
 




-- 
Ahmed Sharkawy


Re: [web2py] Re: Web2py GAE integration

2011-03-27 Thread Jonathan Lundell
On Mar 27, 2011, at 3:21 AM, johntynan wrote:
 
 I had written a tutorial about Setting up web2py for use with Google
 App Engine here:
 
 http://opensourcebroadcasting.blogspot.com/2010/04/setting-up-web2py-for-use-with-google.html
 
 Please feel free to have a look and let me know if this helps you.
 
 Also, please feel free to let me know if anything has gone out of
 date.

It looks to me like the instructions will work OK for OS X, with some minor 
alterations. /home/joesmith becomes /Users/joesmith. I ended up doing a 
parallel installation of Python 2.5 and connecting the GAE apps to that; I'm 
not sure if that's necessary, but it was an easy way to shut up one of GAE's 
complaints.

However, OS X (and Windows) users are probably going to use the very handy GAE 
GUI application for testing and deployment.

Finally, it might be worth noting that there might be some other changes 
required to app.yaml. The example is set up to deploy the web2py welcome app, 
and it tries to keep the upload fairly lightweight, skipping some of the 
less-often-used contrib files and the like.

You might also mention the use of GAE's app versioning, which can be handy for 
uploading newer versions for test purposes without making them the default.

Re: [web2py] Re: Web2py GAE integration

2011-03-27 Thread Jonathan Lundell
On Mar 27, 2011, at 2:08 AM, Mariusz Zieliński wrote:
 
 More details would be useful. I'm no expert on deploying on GAE,
 though I succesfully managed to deploy my first app on GAE
 yesterday :) I got some problems with app.yaml file as with some rules
 from example file in skip_files section there were errors, that it
 couldn't find contrib modules. Other than that deployment went without
 problems. Also remember to run app on Python 2.5 just like Luther
 wrote as that's version which GAE uses currently.

Which contrib modules did you end up needing?

app.example.yaml is configured to upload  run the web2py welcome app, and it 
doesn't upload all of contrib.


 
 On 27 Mar, 01:10, Shark shark4...@gmail.com wrote:
 We have troubles in GAE and web2py integration in our graduation
 project
 We tried many tutorials in the web and we fails so I hope you can help
 us with step by step advice
 
 Ahmed Sharkawy
 
 4th year engineering faculty




[web2py] Re: Cherokee server locking while upload

2011-03-27 Thread Jose


On 27 mar, 06:54, LightOfMooN vladsale...@yandex.ru wrote:
 Yes, just tested it.
 Many parallel downloads, nice speed, and no locks even more.
 Nginx Rocks!

Hello LightOfMooN,

please, could show me how to configure nginx + + web2py uwsgi. I use
uwsgi + cherokee + web2py and I had the same problems that you
mentioned.

Thank you very much.

Jose


[web2py] Re: Cherokee server locking while upload

2011-03-27 Thread LightOfMooN
Yes, ofc.
Thanks to pbreit for his script.
I just added support for 443 port (SSL) and Postgres to it.
It installs web2py+nginx+uwsgi+postgres on ubuntu:

===
apt-get update
apt-get -y upgrade
apt-get -y install build-essential psmisc python-dev libxml2 libxml2-
dev python-setuptools
adduser --system --no-create-home --disabled-login --disabled-password
--group uwsgi
apt-get -y install unzip
cd /opt/
wget http://web2py.com/examples/static/web2py_src.zip
unzip web2py_src.zip
chown -R uwsgi:uwsgi web2py
cd web2py
sudo -u uwsgi python -c from gluon.widget import console; console();
sudo -u uwsgi python -c from gluon.main import save_password;
save_password(raw_input('admin password: '),443)
cd /opt/
wget http://projects.unbit.it/downloads/uwsgi-0.9.6.8.tar.gz
tar -zxvf uwsgi*
mv uwsgi*/ uwsgi/
cd uwsgi/
python setup.py install
chown -R uwsgi:uwsgi /opt/uwsgi
touch /var/log/uwsgi.log
chown uwsgi /var/log/uwsgi.log
apt-get -y install libpcre3-dev build-essential libssl-dev
cd /opt/
wget http://nginx.org/download/nginx-0.8.54.tar.gz
tar -zxvf nginx-0.8.54.tar.gz
cd /opt/nginx-0.8.54/
./configure --prefix=/opt/nginx --user=nginx --group=nginx --with-
http_ssl_module
make
make install
adduser --system --no-create-home --disabled-login --disabled-password
--group nginx
cp /opt/uwsgi/nginx/uwsgi_params /opt/nginx/conf/uwsgi_params
wget 
https://library.linode.com/web-servers/nginx/installation/reference/init-deb.sh
mv init-deb.sh /etc/init.d/nginx
chmod +x /etc/init.d/nginx
/usr/sbin/update-rc.d -f nginx defaults
/etc/init.d/nginx start
cd /opt/
wget 
https://library.linode.com/web-servers/nginx/python-uwsgi/reference/init-deb.sh
mv /opt/init-deb.sh /etc/init.d/uwsgi
chmod +x /etc/init.d/uwsgi
echo 'PYTHONPATH=/opt/web2py/
MODULE=wsgihandler'  /etc/default/uwsgi
/usr/sbin/update-rc.d -f uwsgi defaults
/etc/init.d/uwsgi start
echo 'user uwsgi;
worker_processes  4;
events {
worker_connections  1024;
}

http {
include   mime.types;
default_type  application/octet-stream;
sendfileon;
client_max_body_size 100M;

server {
listen   80;
server_name  ;
location / {
uwsgi_pass 127.0.0.1:9001;
includeuwsgi_params;
}
location /static {
root   /opt/web2py/applications/welcome/;
}
}
server {
listen   443;
server_name  ;
ssl  on;
ssl_certificate  /opt/nginx/conf/server.crt;
ssl_certificate_key  /opt/nginx/conf/server.key;

location / {
uwsgi_pass 127.0.0.1:9001;
includeuwsgi_params;
uwsgi_param UWSGI_SCHEME $scheme;
}
location /static {
root   /opt/web2py/applications/welcome/;
}
}
}'  /opt/nginx/conf/nginx.conf

/etc/init.d/nginx restart

# get sertificates
cd /opt/nginx/conf; openssl genrsa -out server.key 1024
cd /opt/nginx/conf; openssl req -batch -new -key server.key -out
server.csr
cd /opt/nginx/conf;
openssl x509 -req -days 1780 -in server.csr -signkey server.key -out
server.crt
/etc/init.d/nginx restart

#install PostgreSQL
sudo apt-get -y install postgresql
sudo apt-get -y install python-psycopg2

===

take care with copy and paste it, because google break links and
newlines


On 27 мар, 21:16, Jose jjac...@gmail.com wrote:
 On 27 mar, 06:54, LightOfMooN vladsale...@yandex.ru wrote:

  Yes, just tested it.
  Many parallel downloads, nice speed, and no locks even more.
  Nginx Rocks!

 Hello LightOfMooN,

 please, could show me how to configure nginx + + web2py uwsgi. I use
 uwsgi + cherokee + web2py and I had the same problems that you
 mentioned.

 Thank you very much.

 Jose


[web2py] Re: Cherokee server locking while upload

2011-03-27 Thread pbreit
Oh cool, you added ssl and postgres. Looks good. Nice.


[web2py] Re: add single pseudo-field to SQLFORM

2011-03-27 Thread villas
Thanks Denes. It is very frustrating when this kind of information is
not readily available, so I have added this pearl of wisdom to the
book.

I appreciate that what I have written is not fully explained, but
sometimes a simple example is worth a thousand words. If you feel this
could or should be improved, please let me know.

http://web2py.com/book/default/chapter/07#Adding-extra-form-elements-to-SQLFORM


On Mar 27, 3:16 pm, DenesL denes1...@yahoo.ca wrote:
 Just add

 form[0].insert(-2,TR(LABEL('I agree to
 terms'),INPUT(_name='agree',value=True,_type='checkbox')))

 after the form has been defined.
 On submission form.vars.agree will have the status of the checkbox,
 which you probably would check using onvalidation.

 Where do I collect my bonus points? ;)

 On Mar 27, 6:43 am, Brian Will brian.thomas.w...@gmail.com wrote:

  I have an insert SQLFORM of 8 fields, to which I'd like to add a
  single I agree to terms checkbox at the bottom. There are probably
  tons of ways to do this, but I'm hoping someone has a really simple
  method that doesn't require resorting to a manual FORM? Can I simply
  tack on another INPUT to the SQLFORM? (Bonus points for placing it
  after my last field but before the submit button). Here's the current
  code.

      form = SQLFORM(db.job_post, submit_button='Post Job',
  formstyle='table2cols',
          fields=['poster_name', 'poster_email', 'poster_phone',
  'zipcode', 'location_description', 'job_type', 'job_title',
  'job_description'],
          _id='postjob'
      )

      if form.accepts(request.vars, session):
          redirect(URL('post_email', vars={'id': form.vars.id,
  'poster_name': form.vars.poster_name, 'poster_email':
  form.vars.poster_email}))

  What's solution allows me to make the minimal change? The simplest
  solution that occurs to me is to use a SQLFORM.factory:

      form = SQLFORM(db.job_post.poster_name, db.job_post.poster_email,
  db.job_post.poster_phone, db.job_post.zipcode,
  db.job_post.location_description, db.job_post.job_type,
  db.job_post.job_title, db.job_post.job_description, FIELD('terms',
  'boolean', IS_EQUAL_TO(True)) submit_button='Post Job',
  formstyle='table2cols',
          _id='postjob'
      )

      if form.accepts(request.vars, session):
          form.vars.id =
  db.job_post.insert(**db.job_post._filter_fields(request.vars))
          redirect(URL('post_email', vars={'id': form.vars.id,
  'poster_name': form.vars.poster_name, 'poster_email':
  form.vars.poster_email}))

  I guess this isn't too onerous, but I don't really like having to
  manually do the insert, so I'm wondering about alternatives. BTW, why
  does _filter_fields begin with _ if it's used publicly? Shouldn't it
  just be filter_fields?




[web2py] Re: web2py cherokee vanilla

2011-03-27 Thread pbreit
Hmmm...I don't use Cherokee anymore but will try to have a look. Is that a 
Web2py-issued ticket? Setting up SSL on Cherokee took me a few tries.

Also, do you see parameters_443.py in your web2py directory? If you 
see parameters_80.py you can duplicate it and rename it. 443 is the SSL 
port which is required for admin when you're not on localhost.

Another trick on Cherokee is to run admin like this:

$ cherokee-admin -b

This avoids needing to set up the SSH tunnel so you can more easily access 
your Cherokee admin. The -b means you are binding to all ports. It's 
discouraged because it's a *very* small security risk for the shot period of 
time that admin is active.


[web2py] Freelancer project to build web chat client with web2py

2011-03-27 Thread Anthony
http://www.freelancer.com/projects/XML-Python/XMPP-Web-chat-Client-with.html
 


[web2py] web2py 1.94.6

2011-03-27 Thread Massimo Di Pierro
Fixes some minor issues, including adding the missing *.yaml.

Please report any issue ASAP.

Massimo


[web2py] Re: web2py cherokee vanilla

2011-03-27 Thread dewittdale
I've definitely got parameters_443.py and parameters_8000.py in the
/var/web2py directory.  No parameters_80.py file to note though.  I tried
the https login in a guessing game to succeed.  I'm at a stalemate.  I'm a
chemist not a programmer per se.  The web2py issued ticket was copy/pasted
from the browser after plugging in the raw ISP IP.  http://75.87.135.60
-- which returns with:

http://75.87.135.60/welcome/default/index and the aforementioned ticket.


The cherokee-admin -b based startup has been employed for a few days now.  I
discovered it from http://blog.e-shell.org/279 though it's described
in theCherokee with FastGGIsection of The Official web2py Book.

Dale


On Sun, Mar 27, 2011 at 12:10 PM, pbreit pbreitenb...@gmail.com wrote:

 Hmmm...I don't use Cherokee anymore but will try to have a look. Is that a
 Web2py-issued ticket? Setting up SSL on Cherokee took me a few tries.

 Also, do you see parameters_443.py in your web2py directory? If you
 see parameters_80.py you can duplicate it and rename it. 443 is the SSL
 port which is required for admin when you're not on localhost.

 Another trick on Cherokee is to run admin like this:

 $ cherokee-admin -b

 This avoids needing to set up the SSH tunnel so you can more easily access
 your Cherokee admin. The -b means you are binding to all ports. It's
 discouraged because it's a *very* small security risk for the shot period of
 time that admin is active.



Re: [web2py] web2py 1.94.6

2011-03-27 Thread Praneeth Bodduluri
Massimo,
Now that we have a setup.py in the tree could you also upload the
package to PyPI?

http://pypi.python.org/pypi/web2py/

python setup.py sdist upload

Should do it.

Thanks,
Praneeth
IRC: lifeeth



On Sun, Mar 27, 2011 at 10:52 PM, Massimo Di Pierro
massimo.dipie...@gmail.com wrote:
 Fixes some minor issues, including adding the missing *.yaml.

 Please report any issue ASAP.

 Massimo


Re: [web2py] web2py 1.94.6

2011-03-27 Thread Massimo Di Pierro
I can do it. Do you want to be in charge of it?

Massimo

On Mar 27, 2011, at 12:43 PM, Praneeth Bodduluri wrote:

 python setup.py sdist upload



[web2py] Re: web2py 1.94.6

2011-03-27 Thread VP
Massimo:

I don't know if this should be considered a bug, but it appears
requires_login() redirects to default/user/login if a not-logged-in
user accesses a page that requires login.   The problem is if the log-
in function is not with the default controller and/or not called
user, the redirect will send to a broken link.

I think the log in page is supposed to be overridden by setting
auth.settings.login_url, but that doesn't seem to work for me.


[web2py] How suitable would Web2Py be for building a federated search engine?

2011-03-27 Thread NoviceSortOf

I'm curious if anybody has built a federated search engine or a front
end for a federated search engine with Web2py?

Had  conversation about this with a client today who suggested Django
as a possible framework. My initial reaction was that Django was more
invested in content management  than complex query mechanisms. I'm
wondering though if Web2Py might be a better tool for the job.

Please advise


[web2py] View for 1:n dataset

2011-03-27 Thread asklucas

Hello!

I created an app using the wizard. I'd like to create a general view
for a record and its sub-records (1:n relation).

Unfortunately I tend to creating Spaghetti-code and the solution is
quite messy.

Could you suggest any solution that is simpler?
Is it possible to reuse this for different views and / or not creating
an own view for everything? The wizard generated more than 30 views!

Thank you!

L.


# In /models/db_wizard.py:


db.define_table( 't_videos',
Field( 'id', 'id', represent=lambda id:SPAN(id,' ', A( 'view',
_href=URL( 'videos_read', args=id,
Field( 'f_title', type='string', label=T( 'Title')),
Field( 'f_studio_id', db.t_studios, label=T( 'Studio Id')),
Field( 'f_date_produced', type='date',
widget=SQLFORM.widgets.date.widget, label=T( 'Date Produced')),
Field( 'f_date_released', type='date',
widget=SQLFORM.widgets.date.widget, label=T( 'Date Released')),
Field( 'active', 'boolean', default=True,
label=T( 'Active'),writable=False,readable=False),
Field( 'created_on', 'datetime', default=request.now,
label=T( 'Created On'),writable=False,readable=False),
Field( 'modified_on', 'datetime', default=request.now,
label=T( 'Modified On'),writable=False,readable=False,
update=request.now),
format='%(f_title)s',
migrate=settings.migrate
)


db.define_table( 't_shots',
Field( 'id', 'id', represent=lambda id:SPAN(id,' ', A( 'view',
_href=URL( 'shots_read', args=id,
Field( 'f_video_id', db.t_videos, label=T( 'Video ID')),
Field( 'f_time_start', type='time',
widget=SQLFORM.widgets.time.widget, label=T( 'Time Start')),
Field( 'f_time_end', type='time',
widget=SQLFORM.widgets.time.widget, label=T( 'Time End')),
Field( 'active', 'boolean', default=True,
label=T( 'Active'),writable=False,readable=False),
Field( 'created_on', 'datetime', default=request.now,
label=T( 'Created On'),writable=False,readable=False),
Field( 'modified_on', 'datetime', default=request.now,
label=T( 'Modified On'),writable=False,readable=False,
update=request.now),
format='%(f_video_id)s',
migrate=settings.migrate
)


# In /controllers/default.py

#[...]

topsub = local_import( 'topsub')

#[...]

def videos_read():
form, sub_sqltable = topsub.topsub_helper(
db,
crud,
db.t_videos,
request.args(0),
't_shots',
'f_video_id',
[ 't_shots.id', 't_shots.f_time_start', 't_shots.f_time_end'],
{ 'orderby':'f_time_start'},
sub_link = 'VideoDB/default/shots_read'
)
return dict( form=form, sub_sqltable=sub_sqltable)

# In /modules/topsub.py

#[...]
def sublink( sub_link):
# Doesn't work, because SQLTABLE( linkto... adds the table name
(../default/shots_read/t_shots/[ID])
application, controller, function = sub_link.split('/')
return URL( a=application, c=controller, f=function)

def topsub_helper( db, crud, t_top, t_top_id, t_sub,
str_sub_reference_field, fields, attributes, sub_link):
top_record = t_top( t_top_id) or redirect( URL( 'error'))
top_form = crud.read( t_top, top_record)
sub_table = db[ t_sub]
sub_reference_field = sub_table[ str_sub_reference_field]
sub_rows = db( sub_reference_field ==
top_record).select( sub_table.ALL, **attributes)
sub_sqltable = SQLTABLE( sub_rows, headers='labels',
linkto=sublink( sub_link), columns=fields, orderby=True)
return top_form, sub_sqltable


# In /views/default/videos_read.html

{{extend 'layout.html'}}

h2Movies/h2
{{=A(T('edit
videos'),_href=URL('videos_update',args=request.args(0)))}}
br/

{{=form}}
{{for t,f in db.t_tags._referenced_by:}}
{{if not t[-8:]=='_archive':}}
 
[{{=A(t[2:],_href=URL('%s_select'%t[2:],args=(f,form.record.id)))}}]
{{pass}}
{{pass}}


h2Shots/h2

{{if sub_sqltable:}}
{{=sub_sqltable}}
{{else:}}
{{=TAG.blockquote(T('No Data'))}}
{{pass}}


[web2py] Setup Script: Ubuntu + Nginx + uWSGI

2011-03-27 Thread pbreit
I did a little more work on a setup script for Ubuntu + Nginx + uWSGI. 
Please let me know if you experience any problems or have any suggestions. 
I'm fairly new to this.

+ Tested on Ubuntu 10.04 (Rackspace Cloud)
+ Nginx 0.8.54
+ SSL (self-signed)
+ uWSGI 0.9.7.1
+ Postgres 8.4
+ Web2py Current
+ user=www-data
+ Hosted at BitBucket: https://bitbucket.org/pbreit/web2py-automation/src/

$ 
wget http://bitbucket.org/pbreit/web2py-automation/raw/tip/setup-ubuntu-nginx.sh
$ chmod +x setup-ubuntu-nginx.sh
$ sudo ./setup-ubuntu-nginx.sh

Note: the script runs almsot unattended. The only user input required is 
specifying web2py admin password.


[web2py] Re: web2py fabric, pip, virtualenv, virtualenvwrappers deployment scripts

2011-03-27 Thread Christopher Steel
If you are running OS X 10.04 this worked well for me :

http://universalcake.blogspot.com/2011/03/installing-python-and-pil-on-os-x-104.html


On Mar 25, 2:50 pm, pbreit pbreitenb...@gmail.com wrote:
 I had a lot of trouble getting reliable installs of PIL, especially on my
 Mac. What I currently do is apt-get install python-imaging which seems to
 work OK.


[web2py] Re: Setup Script: Ubuntu + Nginx + uWSGI

2011-03-27 Thread Anthony
Once this has been tested/refined, it might be a nice addition to the 
/web2py/scripts folder.

On Sunday, March 27, 2011 3:29:43 PM UTC-4, pbreit wrote:

 I did a little more work on a setup script for Ubuntu + Nginx + uWSGI. 
 Please let me know if you experience any problems or have any suggestions. 
 I'm fairly new to this. 

 + Tested on Ubuntu 10.04 (Rackspace Cloud)
 + Nginx 0.8.54
 + SSL (self-signed)
 + uWSGI 0.9.7.1
 + Postgres 8.4
 + Web2py Current
 + user=www-data
 + Hosted at BitBucket: https://bitbucket.org/pbreit/web2py-automation/src/

 $ wget 
 http://bitbucket.org/pbreit/web2py-automation/raw/tip/setup-ubuntu-nginx.sh
 $ chmod +x setup-ubuntu-nginx.sh
 $ sudo ./setup-ubuntu-nginx.sh

 Note: the script runs almsot unattended. The only user input required is 
 specifying web2py admin password.



[web2py] Re: How suitable would Web2Py be for building a federated search engine?

2011-03-27 Thread Massimo Di Pierro
consider this proof of concept:

db.define_table('document',Field('title'),Field('body'))
db.define_table('peer',Field('url'))

def index(): return dict(form=crud.create(db.document)

def search():
from gluon.dal import Rows
import xmlrpclib
form = SQLFORM.factory(Field('keyword'))
if form.accepts(request,session):
 rows =
db(db.document.title.contains(form.vars.keyword)).select()
 ### search at peers
 for peer in db(db.peer).select():
 records = xmlrpclib.ServerProxy(peer.url).search(keyword)
 ## merge responses
 rows = rows|Rows(db,records,rows.colnames)
else:
 rows = None
return dict(form=form,rows=rows)

## allow other peers to search this peer
@service.xmlrpc
def search(keywrod):
return db(db.document.title.contains(keyword)).select().as_list()


I did not try run it and it may need some debugging. I doubt you can
do this more efficiently with Django. Yet, there are lots of
complications depending on details that need to be addressed and are
not web2py or Django specific.

Massimo

On Mar 27, 1:49 pm, NoviceSortOf dljonsson2...@gmail.com wrote:
 I'm curious if anybody has built a federated search engine or a front
 end for a federated search engine with Web2py?

 Had  conversation about this with a client today who suggested Django
 as a possible framework. My initial reaction was that Django was more
 invested in content management  than complex query mechanisms. I'm
 wondering though if Web2Py might be a better tool for the job.

 Please advise


[web2py] Re: Setup Script: Ubuntu + Nginx + uWSGI

2011-03-27 Thread Massimo Di Pierro
Let me know when you think this is a ready for inclusion. I agree with
Anthony, it would be a valuable addition to scrips/

On Mar 27, 2:29 pm, pbreit pbreitenb...@gmail.com wrote:
 I did a little more work on a setup script for Ubuntu + Nginx + uWSGI.
 Please let me know if you experience any problems or have any suggestions.
 I'm fairly new to this.

 + Tested on Ubuntu 10.04 (Rackspace Cloud)
 + Nginx 0.8.54
 + SSL (self-signed)
 + uWSGI 0.9.7.1
 + Postgres 8.4
 + Web2py Current
 + user=www-data
 + Hosted at BitBucket:https://bitbucket.org/pbreit/web2py-automation/src/

 $
 wgethttp://bitbucket.org/pbreit/web2py-automation/raw/tip/setup-ubuntu-ng...
 $ chmod +x setup-ubuntu-nginx.sh
 $ sudo ./setup-ubuntu-nginx.sh

 Note: the script runs almsot unattended. The only user input required is
 specifying web2py admin password.


[web2py] Funny behavior with referenced Field display if writable=False

2011-03-27 Thread szimszon
Hi!

I use Version 1.94.6 (2011-03-27 18:20:38).

I have in db:
-
db.define_table( 'mail_domain',
Field( 'domainname', 
'string',

label = 'Domain név',

requires = IS_NOT_EMPTY()

),
signature,
migrate = 
settings.migrate,
)
db.define_table( 'mail_domain_alias',
Field( 
'mail_domain_id', db.mail_domain,

label = 'Domain név',

requires = IS_IN_DB( db, db.mail_domain.id, '%
(domainname)s' ),

*writable = False,*

),
Field( 'alias', 
'string',

label = 'Aliasz',

requires = IS_NOT_EMPTY()

),
signature,
migrate = 
settings.migrate,
)
--

controller:


def domain():
form = crud.update( db.mail_domain, request.args( 0 ) )
return dict( form = form )
def domainalias():
db.mail_domain_alias.mail_domain_id.default = session.domainname_id
form = crud.update( db.mail_domain_alias, request.args( 0 ) )
return dict( form = form )
def setdomain():
session.domainname_id = request.args( 0 )
session.domainname = db( db.mail_domain.id ==
session.domainname_id ).select( db.mail_domain.domainname ).first().domainname
redirect( URL( 'default', 'index' ) )
-

If the session.domainname_id is set to a valid mail_domain record ID,
than the crud in domainalias shows the reference field as number and
not as domainname string.

But if I remove the writable=False in mail_domain_alias table's
mail_domain_id field than I have a dropdown menu with the right record
selected as domainname and not as ID number.

I think the right behavior would be if I set the writable = True that
I would see the right record not as ID but as %(domainname)s


[web2py] Re: Setup Script: Ubuntu + Nginx + uWSGI

2011-03-27 Thread LightOfMooN
It needs something like
client_max_body_size 100M;
in nginx.conf to avoid error: 413 Request Entity Too Large
(for example, try to install app with  6mb or upload big file)

On 28 мар, 01:53, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 Let me know when you think this is a ready for inclusion. I agree with
 Anthony, it would be a valuable addition to scrips/

 On Mar 27, 2:29 pm, pbreit pbreitenb...@gmail.com wrote:







  I did a little more work on a setup script for Ubuntu + Nginx + uWSGI.
  Please let me know if you experience any problems or have any suggestions.
  I'm fairly new to this.

  + Tested on Ubuntu 10.04 (Rackspace Cloud)
  + Nginx 0.8.54
  + SSL (self-signed)
  + uWSGI 0.9.7.1
  + Postgres 8.4
  + Web2py Current
  + user=www-data
  + Hosted at BitBucket:https://bitbucket.org/pbreit/web2py-automation/src/

  $
  wgethttp://bitbucket.org/pbreit/web2py-automation/raw/tip/setup-ubuntu-ng...
  $ chmod +x setup-ubuntu-nginx.sh
  $ sudo ./setup-ubuntu-nginx.sh

  Note: the script runs almsot unattended. The only user input required is
  specifying web2py admin password.


[web2py] Re: How suitable would Web2Py be for building a federated search engine?

2011-03-27 Thread Massimo Di Pierro
Errata

consider this proof of concept:

db.define_table('document',Field('title'),Field('body'))
db.define_table('peer',Field('url'))
def index(): return dict(form=crud.create(db.document)
def search():
from gluon.dal import Rows
import xmlrpclib
form = SQLFORM.factory(Field('keyword'))
if form.accepts(request,session):
 rows =
db(db.document.title.contains(form.vars.keyword)).select()
 ### search at peers
 for peer in db(db.peer).select():
 records = xmlrpclib.ServerProxy(peer.url).find(keyword)
 ## merge responses
 rows = rows|Rows(db,records,rows.colnames)
else:
 rows = None
return dict(form=form,rows=rows)

## allow other peers to search this peer
@service.xmlrpc
def find(keywrod):
return db(db.document.title.contains(keyword)).select().as_list()
I did not try run it and it may need some debugging. I doubt you can
do this more efficiently with Django. Yet, there are lots of
complications depending on details that need to be addressed and are
not web2py or Django specific.
Massimo


On Mar 27, 2:51 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 consider this proof of concept:

 db.define_table('document',Field('title'),Field('body'))
 db.define_table('peer',Field('url'))

 def index(): return dict(form=crud.create(db.document)

 def search():
     from gluon.dal import Rows
     import xmlrpclib
     form = SQLFORM.factory(Field('keyword'))
     if form.accepts(request,session):
          rows =
 db(db.document.title.contains(form.vars.keyword)).select()
          ### search at peers
          for peer in db(db.peer).select():
              records = xmlrpclib.ServerProxy(peer.url).search(keyword)
              ## merge responses
              rows = rows|Rows(db,records,rows.colnames)
     else:
          rows = None
     return dict(form=form,rows=rows)

 ## allow other peers to search this peer
 @service.xmlrpc
 def search(keywrod):
     return db(db.document.title.contains(keyword)).select().as_list()

 I did not try run it and it may need some debugging. I doubt you can
 do this more efficiently with Django. Yet, there are lots of
 complications depending on details that need to be addressed and are
 not web2py or Django specific.

 Massimo

 On Mar 27, 1:49 pm, NoviceSortOf dljonsson2...@gmail.com wrote:







  I'm curious if anybody has built a federated search engine or a front
  end for a federated search engine with Web2py?

  Had  conversation about this with a client today who suggested Django
  as a possible framework. My initial reaction was that Django was more
  invested in content management  than complex query mechanisms. I'm
  wondering though if Web2Py might be a better tool for the job.

  Please advise


Re: [web2py] Re: What is the convention for using web2py/site-packages for GAE?

2011-03-27 Thread Jonathan Lundell
On Mar 25, 2011, at 3:53 PM, ChrisM wrote:
 
 wondering if this has  been resolved as i have copied a package into
 site packages using latest
 web2py and GAE dev_appserver cant find it.

Try logging sys.path and see if site-packages is there. You should see the 
web2py root, gluon, and site-packages.

 chrism
 
 On Feb 13, 11:46 am, Carl m...@carlroach.com wrote:
 On Feb 12, 4:03 pm, Jonathan Lundell jlund...@pobox.com wrote:
 
 
 
 On Feb 12, 2011, at 3:12 AM, Carl wrote:
 
 I've avoided editing oauth10a_account.py by moving the directory
 oauth2 to web2py (and keeping httplib2 inside oauth2.
 
 Not happy that I've put this in Web2py's root but I've avoided editing
 the framework source and don't need to worry about overwriting files
 when I upgrade Web2py.
 
 On Feb 11, 1:46 pm, Carl m...@carlroach.com wrote:
 I'm using OAuth/LinkedIn on GAE.
 
 To get oauth/LinkedIn to run on dev_appserver/GAE I had to copy
 directory oauth2 from web2py/site-packages to web2py/gluon/contrib and
 httplib2 from site-packages to web2py/gluon/contrib/oauth2
 
 Then in oauth10a_account.py change import oauth2 as oauth to import
 gluon.contrib.oauth2 as oauth.
 
 Bingo.
 
 But.. is there a convention that will make web2py upgrades
 straightforward?
 
 Two questions:
 
 1. What web2py version are you using?
 
 B. What happens when oauth2 is in site-packages?
 
 3. Where is your import? (OK, three questions.)
 
 Recently (and I'll have to do some research to find out exactly when), we 
 made some changes in this area. It used to be that the handling of web2py's 
 additions to sys.path were somewhat erratic, and dependent on which handler 
 was in use. The changes were to make it consistent across handlers. In 
 particular (at least in the trunk), both the web2py root and site-packages 
 should be at the beginning of sys.path by the time you do your import.
 
 Could you please log sys.path at the time you do your import (or save a 
 copy and display it later)? Thanks.
 
 1. I'm using Web2py 1.89.1. Have I been caught out by recent changes?
 In any case, I'll update to the latest (so much recent activity!)
 
 2. dev_appserver reports that there is an invalid character in 'site-
 packages'. I took that to be the hyphen.
 
 3. I have 2 imports.
 gluon/contrib/login_methods/oauth10a_account.py line 15 import oauth2
 as oauth
 applications/init/modules/user.py (my own file) import oauth2 as oauth
 So I need a solution that works from these two locations




Re: [web2py] web2py 1.94.6

2011-03-27 Thread Praneeth Bodduluri
Hello Massimo,

I can help maintain the PyPI uploading for every new revision.

--
Praneeth
IRC: lifeeth



On Sun, Mar 27, 2011 at 11:17 PM, Massimo Di Pierro
massimo.dipie...@gmail.com wrote:
 I can do it. Do you want to be in charge of it?

 Massimo

 On Mar 27, 2011, at 12:43 PM, Praneeth Bodduluri wrote:

 python setup.py sdist upload




[web2py] Re: Not sure of the etiquette for asking about an issue...

2011-03-27 Thread howesc
Mike,

asking is always a good thing.  lots of stuff flys by and sometimes things 
fall through the cracks.

i just looked at your bug report, and honestly am having trouble following 
it (which might be why it has not been addressed yet).  can you post the 
table definition and a post that fails?  A full example so we can reproduce 
the problem will help get an answer faster.

thanks,

christian


[web2py] Re: add single pseudo-field to SQLFORM

2011-03-27 Thread Brian Will
Thanks, everyone. That's what I was looking for.

On Mar 27, 9:50 am, villas villa...@gmail.com wrote:
 Thanks Denes. It is very frustrating when this kind of information is
 not readily available, so I have added this pearl of wisdom to the
 book.

 I appreciate that what I have written is not fully explained, but
 sometimes a simple example is worth a thousand words. If you feel this
 could or should be improved, please let me know.

 http://web2py.com/book/default/chapter/07#Adding-extra-form-elements-...

 On Mar 27, 3:16 pm, DenesL denes1...@yahoo.ca wrote:







  Just add

  form[0].insert(-2,TR(LABEL('I agree to
  terms'),INPUT(_name='agree',value=True,_type='checkbox')))

  after the form has been defined.
  On submission form.vars.agree will have the status of the checkbox,
  which you probably would check using onvalidation.

  Where do I collect my bonus points? ;)

  On Mar 27, 6:43 am, Brian Will brian.thomas.w...@gmail.com wrote:

   I have an insert SQLFORM of 8 fields, to which I'd like to add a
   single I agree to terms checkbox at the bottom. There are probably
   tons of ways to do this, but I'm hoping someone has a really simple
   method that doesn't require resorting to a manual FORM? Can I simply
   tack on another INPUT to the SQLFORM? (Bonus points for placing it
   after my last field but before the submit button). Here's the current
   code.

       form = SQLFORM(db.job_post, submit_button='Post Job',
   formstyle='table2cols',
           fields=['poster_name', 'poster_email', 'poster_phone',
   'zipcode', 'location_description', 'job_type', 'job_title',
   'job_description'],
           _id='postjob'
       )

       if form.accepts(request.vars, session):
           redirect(URL('post_email', vars={'id': form.vars.id,
   'poster_name': form.vars.poster_name, 'poster_email':
   form.vars.poster_email}))

   What's solution allows me to make the minimal change? The simplest
   solution that occurs to me is to use a SQLFORM.factory:

       form = SQLFORM(db.job_post.poster_name, db.job_post.poster_email,
   db.job_post.poster_phone, db.job_post.zipcode,
   db.job_post.location_description, db.job_post.job_type,
   db.job_post.job_title, db.job_post.job_description, FIELD('terms',
   'boolean', IS_EQUAL_TO(True)) submit_button='Post Job',
   formstyle='table2cols',
           _id='postjob'
       )

       if form.accepts(request.vars, session):
           form.vars.id =
   db.job_post.insert(**db.job_post._filter_fields(request.vars))
           redirect(URL('post_email', vars={'id': form.vars.id,
   'poster_name': form.vars.poster_name, 'poster_email':
   form.vars.poster_email}))

   I guess this isn't too onerous, but I don't really like having to
   manually do the insert, so I'm wondering about alternatives. BTW, why
   does _filter_fields begin with _ if it's used publicly? Shouldn't it
   just be filter_fields?


[web2py] Re: Not sure of the etiquette for asking about an issue...

2011-03-27 Thread Massimo Di Pierro
I am pretty sure I responded to this but my response disappeared!

My response was something like: I apologize this was overlooked. We
will take care of it asap.

Massimo

On Mar 26, 3:35 pm, tiny mikepe...@gmail.com wrote:
 Hi-

 I reported an issue on the Google projects issues list (#150) on Jan
 6, and I am wondering how to find out if/when the issue might be
 addressed.  I believe the issue is pretty simple (an esception occurs
 when a record is inserted into a table with a legacy primary key,
 which I unfortunately have quite a few of), but I have not proposed a
 solution because I do not know the logic around that area, and I
 suspect someone who knows that area of code will know quickly what
 needs to be done.

 I am about to deploy to a customer, and I cannot just have them
 download the latest stable version as the defect causes a fatal error
 in my system.  Right now, I have a hacked local version that does not
 return the right status info, but it works.

 I would welcome being told how best to query status like this, I did
 not see anything other than the ability to add a comment on the issues
 page, and was not sure that would get attention (monitoring all the
 issues might be difficult).  I have no intention of causing hassle,
 and will follow any directions given!

 Again, I will end by saying I have very much enjoyed using web2py, my
 compliments and gratitude go to Massimo and all others who maintain
 the project!

 --Mike


[web2py] Re: add single pseudo-field to SQLFORM

2011-03-27 Thread Brian Will
One small problem with this: my checkbox is now validated with
onvalidate which only runs when everything else validates. I want the
'must agree to terms' error to popup any time the form is submitted
without the checkbox checked, not just when it's the only think that
doesn't validate. If I could determine whether this is a postback the
way accepts does, I could just invoke my validation code manually.
Poking into the FORM.accepts code, though, I noticed onvalidate may be
a dict of {'onsuccess': func, 'onfailure': func}, so now I just have:

onvalidation={'onsuccess': validateTerms, 'onfailure': validateTerms}

...and that seems to do the trick.

BTW, I got confused by INPUT's value arg. I kept treating it like
_value until I realized that value is only meant to be set to True to
turn the checkbox on by default. Maybe deprecate 'value' in favor of
'prechecked' for this purpose to avoid the confusion.

On Mar 27, 2:28 pm, Brian Will brian.thomas.w...@gmail.com wrote:
 Thanks, everyone. That's what I was looking for.

 On Mar 27, 9:50 am, villas villa...@gmail.com wrote:







  Thanks Denes. It is very frustrating when this kind of information is
  not readily available, so I have added this pearl of wisdom to the
  book.

  I appreciate that what I have written is not fully explained, but
  sometimes a simple example is worth a thousand words. If you feel this
  could or should be improved, please let me know.

 http://web2py.com/book/default/chapter/07#Adding-extra-form-elements-...

  On Mar 27, 3:16 pm, DenesL denes1...@yahoo.ca wrote:

   Just add

   form[0].insert(-2,TR(LABEL('I agree to
   terms'),INPUT(_name='agree',value=True,_type='checkbox')))

   after the form has been defined.
   On submission form.vars.agree will have the status of the checkbox,
   which you probably would check using onvalidation.

   Where do I collect my bonus points? ;)

   On Mar 27, 6:43 am, Brian Will brian.thomas.w...@gmail.com wrote:

I have an insert SQLFORM of 8 fields, to which I'd like to add a
single I agree to terms checkbox at the bottom. There are probably
tons of ways to do this, but I'm hoping someone has a really simple
method that doesn't require resorting to a manual FORM? Can I simply
tack on another INPUT to the SQLFORM? (Bonus points for placing it
after my last field but before the submit button). Here's the current
code.

    form = SQLFORM(db.job_post, submit_button='Post Job',
formstyle='table2cols',
        fields=['poster_name', 'poster_email', 'poster_phone',
'zipcode', 'location_description', 'job_type', 'job_title',
'job_description'],
        _id='postjob'
    )

    if form.accepts(request.vars, session):
        redirect(URL('post_email', vars={'id': form.vars.id,
'poster_name': form.vars.poster_name, 'poster_email':
form.vars.poster_email}))

What's solution allows me to make the minimal change? The simplest
solution that occurs to me is to use a SQLFORM.factory:

    form = SQLFORM(db.job_post.poster_name, db.job_post.poster_email,
db.job_post.poster_phone, db.job_post.zipcode,
db.job_post.location_description, db.job_post.job_type,
db.job_post.job_title, db.job_post.job_description, FIELD('terms',
'boolean', IS_EQUAL_TO(True)) submit_button='Post Job',
formstyle='table2cols',
        _id='postjob'
    )

    if form.accepts(request.vars, session):
        form.vars.id =
db.job_post.insert(**db.job_post._filter_fields(request.vars))
        redirect(URL('post_email', vars={'id': form.vars.id,
'poster_name': form.vars.poster_name, 'poster_email':
form.vars.poster_email}))

I guess this isn't too onerous, but I don't really like having to
manually do the insert, so I'm wondering about alternatives. BTW, why
does _filter_fields begin with _ if it's used publicly? Shouldn't it
just be filter_fields?


[web2py] From cherokee (uwsgi) to nginx (uwsgi)

2011-03-27 Thread Jose
Hello,

Referring to the thread [1], I'm a bit lost.

My current setup in cherokee is as follows:

file /web2py/config.xml

uwsgi
pythonpath/home/web2py//pythonpath
modulewsgihandler/module
socket/tmp/web2py.sock/socket
master/
processes15/processes
socket-timeout45/socket-timeout
post-buffering4096/post-buffering
max-requests1000/max-requests
logto/tmp/uwsgi.log/logto
/uwsgi

Cherokee setting:

Information Sources
• Type: Local Interpreter
• Nick: web2py-uwsgi
• Connection: /tmp/web2py.sock
• Interpereter: /usr/local/bin/uwsgi -L -T -C -x /home/web2py/
config.xml

Then use this in my virtual server.

My OS is FreeBSD 8.2.
I have run nginx (spawn-fcgi + php). I have also installed
uwsgi-0.9.6.8

In nginx.conf only enable support for PHP. The rest is with the
original configuration.

The question is how to use the config.xml file in nginx

Thank.
Jose

[1] http://groups.google.com/group/web2py/browse_thread/thread/6a34283f6025f70c


[web2py] Re: add single pseudo-field to SQLFORM

2011-03-27 Thread DenesL

Actually the insert index depends on the formstyle.
It should be -2 for formstyle='table2cols' as above.
That has to be changed to -1 for formstyle='table3cols'.

I think this is explained somewhere else in the manual but
form[0] is the TABLE and form[0][0] would be the first row (TR), etc.

When 'table2cols' is used then there are two TRs per field,
hence the -2 index to get over the submit which is last.
While using the default 'table3cols' there is one TR per field,
so -1 does the job.
A different approach has to be used for other styles like 'divs' or
'ul'.

All this just to say that it is not easy to generalize,
you always have to know how things are built.
Playing with the objects in the shell, e.g. using dir on them,
and looking at the source code will help a lot.


On Mar 27, 12:50 pm, villas villa...@gmail.com wrote:
 Thanks Denes. It is very frustrating when this kind of information is
 not readily available, so I have added this pearl of wisdom to the
 book.

 I appreciate that what I have written is not fully explained, but
 sometimes a simple example is worth a thousand words. If you feel this
 could or should be improved, please let me know.

 http://web2py.com/book/default/chapter/07#Adding-extra-form-elements-...

 On Mar 27, 3:16 pm, DenesL denes1...@yahoo.ca wrote:







  Just add

  form[0].insert(-2,TR(LABEL('I agree to
  terms'),INPUT(_name='agree',value=True,_type='checkbox')))

  after the form has been defined.
  On submission form.vars.agree will have the status of the checkbox,
  which you probably would check using onvalidation.

  Where do I collect my bonus points? ;)

  On Mar 27, 6:43 am, Brian Will brian.thomas.w...@gmail.com wrote:

   I have an insert SQLFORM of 8 fields, to which I'd like to add a
   single I agree to terms checkbox at the bottom. There are probably
   tons of ways to do this, but I'm hoping someone has a really simple
   method that doesn't require resorting to a manual FORM? Can I simply
   tack on another INPUT to the SQLFORM? (Bonus points for placing it
   after my last field but before the submit button). Here's the current
   code.

       form = SQLFORM(db.job_post, submit_button='Post Job',
   formstyle='table2cols',
           fields=['poster_name', 'poster_email', 'poster_phone',
   'zipcode', 'location_description', 'job_type', 'job_title',
   'job_description'],
           _id='postjob'
       )

       if form.accepts(request.vars, session):
           redirect(URL('post_email', vars={'id': form.vars.id,
   'poster_name': form.vars.poster_name, 'poster_email':
   form.vars.poster_email}))

   What's solution allows me to make the minimal change? The simplest
   solution that occurs to me is to use a SQLFORM.factory:

       form = SQLFORM(db.job_post.poster_name, db.job_post.poster_email,
   db.job_post.poster_phone, db.job_post.zipcode,
   db.job_post.location_description, db.job_post.job_type,
   db.job_post.job_title, db.job_post.job_description, FIELD('terms',
   'boolean', IS_EQUAL_TO(True)) submit_button='Post Job',
   formstyle='table2cols',
           _id='postjob'
       )

       if form.accepts(request.vars, session):
           form.vars.id =
   db.job_post.insert(**db.job_post._filter_fields(request.vars))
           redirect(URL('post_email', vars={'id': form.vars.id,
   'poster_name': form.vars.poster_name, 'poster_email':
   form.vars.poster_email}))

   I guess this isn't too onerous, but I don't really like having to
   manually do the insert, so I'm wondering about alternatives. BTW, why
   does _filter_fields begin with _ if it's used publicly? Shouldn't it
   just be filter_fields?


[web2py] args(0) is always None??

2011-03-27 Thread niknok
I have this function that displays several fields from two databases.
but I couldn't get it to do the following:

1) the previous question button actually causes an error. how come
my session.item_id is always zero when I thought I was passing an
incrementing value session.item_id+1 .

2) when i select a value from the dropdown list get an error saying
that I chose the wrong value

3) i am thinking of collecting the answers in an array so i can check
the answers before storing them as a records in a database. how do i
do that?

i look forward to your suggestions to make this move forward.


def quiz():
item_id =int(request.args(0) or 0)

if item_id == 0:
False).select(orderby='random')
# Females = db(db.questionnaire.id0 
).select(orderby='random')
print request.args(0), item_id, 'retrieving'
query = db(db.questionnaire.id0).select(orderby='random')
query_t = db(db.questionnaire_fil.id0).select()

form = SQLFORM.factory(
Field('default', 'text', writable=False, default=query[item_id]
['dialog']),
Field('locale', 'text', writable=False,
default=query_t[int(query[item_id]['dialog_id']-1)]['dialog']),
Field('answer', 'list:string',

requires=IS_IN_SET(query_t[int(query[item_id]['dialog_id'])-1]
['choices'], zero=None, multiple=True)),
_style='width:400px'
)

form[0][-1][1].append(XML('nbsp;nbsp;'))
form[0][-1][1].append(INPUT (_type='button',_value=T('Previous
question'),

_onclick=window.location='%s';%URL(r=request,args=(item_id-1) or
0)))

if form.accepts(request.vars,session):
if item_id=len(query):
response.flash= request.vars, item_id, request.args(0)
URL(r=request,args=(item_id+1))
else: URL(r=request, f='quiz_check')

return dict(form=form, item_id=item_id)


[web2py] Re: add single pseudo-field to SQLFORM

2011-03-27 Thread DenesL


On Mar 27, 6:51 pm, Brian Will brian.thomas.w...@gmail.com wrote:

 BTW, I got confused by INPUT's value arg. I kept treating it like
 _value until I realized that value is only meant to be set to True to
 turn the checkbox on by default. Maybe deprecate 'value' in favor of
 'prechecked' for this purpose to avoid the confusion.

Note that the value parameter is used by all types of INPUT fields,
not just checkboxes, it would not make much sense to have
an INPUT of type text 'prechecked' for example.


[web2py] Re: add single pseudo-field to SQLFORM

2011-03-27 Thread Anthony
You can also use the .element and .elements methods of helper objects to 
find particular form elements without needing to know exactly where they 
are, as explained in 
http://web2py.com/book/default/chapter/05#Server-side-DOM-and-Parsing and 
http://www.web2pyslices.com/main/slices/take_slice/43.
 
Anthony

On Sunday, March 27, 2011 8:07:59 PM UTC-4, DenesL wrote:


 Actually the insert index depends on the formstyle. 
 It should be -2 for formstyle='table2cols' as above. 
 That has to be changed to -1 for formstyle='table3cols'. 

 I think this is explained somewhere else in the manual but 
 form[0] is the TABLE and form[0][0] would be the first row (TR), etc. 

 When 'table2cols' is used then there are two TRs per field, 
 hence the -2 index to get over the submit which is last. 
 While using the default 'table3cols' there is one TR per field, 
 so -1 does the job. 
 A different approach has to be used for other styles like 'divs' or 
 'ul'. 

 All this just to say that it is not easy to generalize, 
 you always have to know how things are built. 
 Playing with the objects in the shell, e.g. using dir on them, 
 and looking at the source code will help a lot. 


 On Mar 27, 12:50 pm, villas vill...@gmail.com wrote: 
  Thanks Denes. It is very frustrating when this kind of information is 
  not readily available, so I have added this pearl of wisdom to the 
  book. 
  
  I appreciate that what I have written is not fully explained, but 
  sometimes a simple example is worth a thousand words. If you feel this 
  could or should be improved, please let me know. 
  
  http://web2py.com/book/default/chapter/07#Adding-extra-form-elements-... 

  
  On Mar 27, 3:16 pm, DenesL dene...@yahoo.ca wrote: 
  
  
  
  
  
  
  
   Just add 
  
   form[0].insert(-2,TR(LABEL('I agree to 
   terms'),INPUT(_name='agree',value=True,_type='checkbox'))) 
  
   after the form has been defined. 
   On submission form.vars.agree will have the status of the checkbox, 
   which you probably would check using onvalidation. 
  
   Where do I collect my bonus points? ;) 
  
   On Mar 27, 6:43 am, Brian Will brian.th...@gmail.com wrote: 
  
I have an insert SQLFORM of 8 fields, to which I'd like to add a 
single I agree to terms checkbox at the bottom. There are probably 
tons of ways to do this, but I'm hoping someone has a really simple 
method that doesn't require resorting to a manual FORM? Can I simply 
tack on another INPUT to the SQLFORM? (Bonus points for placing it 
after my last field but before the submit button). Here's the current 

code. 
  
form = SQLFORM(db.job_post, submit_button='Post Job', 
formstyle='table2cols', 
fields=['poster_name', 'poster_email', 'poster_phone', 
'zipcode', 'location_description', 'job_type', 'job_title', 
'job_description'], 
_id='postjob' 
) 
  
if form.accepts(request.vars, session): 
redirect(URL('post_email', vars={'id': form.vars.id, 
'poster_name': form.vars.poster_name, 'poster_email': 
form.vars.poster_email})) 
  
What's solution allows me to make the minimal change? The simplest 
solution that occurs to me is to use a SQLFORM.factory: 
  
form = SQLFORM(db.job_post.poster_name, db.job_post.poster_email, 

db.job_post.poster_phone, db.job_post.zipcode, 
db.job_post.location_description, db.job_post.job_type, 
db.job_post.job_title, db.job_post.job_description, FIELD('terms', 
'boolean', IS_EQUAL_TO(True)) submit_button='Post Job', 
formstyle='table2cols', 
_id='postjob' 
) 
  
if form.accepts(request.vars, session): 
form.vars.id = 
db.job_post.insert(**db.job_post._filter_fields(request.vars)) 
redirect(URL('post_email', vars={'id': form.vars.id, 
'poster_name': form.vars.poster_name, 'poster_email': 
form.vars.poster_email})) 
  
I guess this isn't too onerous, but I don't really like having to 
manually do the insert, so I'm wondering about alternatives. BTW, why 

does _filter_fields begin with _ if it's used publicly? Shouldn't it 
just be filter_fields?



[web2py] Re: getting fields created by SQLFORM but which are not in the form

2011-03-27 Thread kawate
sorry if i misunderstand your question,
this can be your help.

http://web2py.com/book/default/chapter/07#SQLFORM-and-insert/update/delete
says

SQLFORM creates a new db record when the form is accepted. Assuming
1.
form=SQLFORM(db.test)
, then the id of the last-created record will be accessible in
myform.vars.id.



On 3月27日, 午前8:46, Brian Will brian.thomas.w...@gmail.com wrote:
 When using SQLFORM, I'd like to get the default/computed values of
 fields not included in the form. Can I do this without making another
 query? Can I get, say, the autogen'd id of the new record? For
 example:

 form = SQLFORM(db.job_post, submit_button='Post Job',
 formstyle='table2cols',
         fields=['poster_name', 'poster_email', 'poster_phone',
 'zipcode', 'location_description', 'job_type', 'job_title',
 'job_description'],
         _id='postjob'
 )
 if form.accepts(request.vars, session):
     # ...

 I want the 'id' and 'uuid' field values created when this form
 accepts. To be honest, I'm not even sure how to do this with a query
 except by matching on all provided fields (because none of the other
 fields are unique), and that just feels ugly.

 Should I have to resort to a manual FORM in this instance?

 Thanks.


[web2py] Re: Cherokee server locking while upload

2011-03-27 Thread Jose

Thank you very much.


[web2py] Pls Help. I can not change the background color of the flash message

2011-03-27 Thread Pystar
Hi,
I have tried to change the background image of response.flash, but no
matter what I do, its just not working. I have tinkered with the
base.css file, everything. No changes reflected.
Can anyone help out?
thanks
Pystar


[web2py] Re: add single pseudo-field to SQLFORM

2011-03-27 Thread villas
Hi Denes,

You are right, we should at least point out that this example depends
on the formstyle. I have altered the book accordingly.

Thanks, D

On Mar 28, 1:07 am, DenesL denes1...@yahoo.ca wrote:
 Actually the insert index depends on the formstyle.
 It should be -2 for formstyle='table2cols' as above.
 That has to be changed to -1 for formstyle='table3cols'.

 I think this is explained somewhere else in the manual but
 form[0] is the TABLE and form[0][0] would be the first row (TR), etc.

 When 'table2cols' is used then there are two TRs per field,
 hence the -2 index to get over the submit which is last.
 While using the default 'table3cols' there is one TR per field,
 so -1 does the job.
 A different approach has to be used for other styles like 'divs' or
 'ul'.

 All this just to say that it is not easy to generalize,
 you always have to know how things are built.
 Playing with the objects in the shell, e.g. using dir on them,
 and looking at the source code will help a lot.

 On Mar 27, 12:50 pm, villas villa...@gmail.com wrote:

  Thanks Denes. It is very frustrating when this kind of information is
  not readily available, so I have added this pearl of wisdom to the
  book.

  I appreciate that what I have written is not fully explained, but
  sometimes a simple example is worth a thousand words. If you feel this
  could or should be improved, please let me know.

 http://web2py.com/book/default/chapter/07#Adding-extra-form-elements-...

  On Mar 27, 3:16 pm, DenesL denes1...@yahoo.ca wrote:

   Just add

   form[0].insert(-2,TR(LABEL('I agree to
   terms'),INPUT(_name='agree',value=True,_type='checkbox')))

   after the form has been defined.
   On submission form.vars.agree will have the status of the checkbox,
   which you probably would check using onvalidation.

   Where do I collect my bonus points? ;)

   On Mar 27, 6:43 am, Brian Will brian.thomas.w...@gmail.com wrote:

I have an insert SQLFORM of 8 fields, to which I'd like to add a
single I agree to terms checkbox at the bottom. There are probably
tons of ways to do this, but I'm hoping someone has a really simple
method that doesn't require resorting to a manual FORM? Can I simply
tack on another INPUT to the SQLFORM? (Bonus points for placing it
after my last field but before the submit button). Here's the current
code.

    form = SQLFORM(db.job_post, submit_button='Post Job',
formstyle='table2cols',
        fields=['poster_name', 'poster_email', 'poster_phone',
'zipcode', 'location_description', 'job_type', 'job_title',
'job_description'],
        _id='postjob'
    )

    if form.accepts(request.vars, session):
        redirect(URL('post_email', vars={'id': form.vars.id,
'poster_name': form.vars.poster_name, 'poster_email':
form.vars.poster_email}))

What's solution allows me to make the minimal change? The simplest
solution that occurs to me is to use a SQLFORM.factory:

    form = SQLFORM(db.job_post.poster_name, db.job_post.poster_email,
db.job_post.poster_phone, db.job_post.zipcode,
db.job_post.location_description, db.job_post.job_type,
db.job_post.job_title, db.job_post.job_description, FIELD('terms',
'boolean', IS_EQUAL_TO(True)) submit_button='Post Job',
formstyle='table2cols',
        _id='postjob'
    )

    if form.accepts(request.vars, session):
        form.vars.id =
db.job_post.insert(**db.job_post._filter_fields(request.vars))
        redirect(URL('post_email', vars={'id': form.vars.id,
'poster_name': form.vars.poster_name, 'poster_email':
form.vars.poster_email}))

I guess this isn't too onerous, but I don't really like having to
manually do the insert, so I'm wondering about alternatives. BTW, why
does _filter_fields begin with _ if it's used publicly? Shouldn't it
just be filter_fields?




[web2py] Re: Pls Help. I can not change the background color of the flash message

2011-03-27 Thread Anthony
If you're using the 'welcome' app as the base, then in the 'web2py specific' 
section near the end of 'base.css', you can change the 'background' option 
of 'div.flash'. Note, you'll probably have to reload the page to see the 
change take effect.
 
Anthony

On Sunday, March 27, 2011 8:45:02 PM UTC-4, Pystar wrote:

 Hi, 
 I have tried to change the background image of response.flash, but no 
 matter what I do, its just not working. I have tinkered with the 
 base.css file, everything. No changes reflected. 
 Can anyone help out? 
 thanks 
 Pystar



[web2py] Re: How to build windows binary yourself?

2011-03-27 Thread Brian M
Massimo,

I'll be emailing you a revised script based off of Praneeth's 
standalone_exe.py shortly. I decided to make it a bit more interactive

Features:
1) Creates web2py.exe with py2exe
2) Offers to remove the Windows DLLs that py2exe includes but are likely to 
have licensing issues.
3) Offers to let user decide if they want to include their applications (if 
not still includes admin app)
4) Offers to let user decide if they want to include their site-packages  
scripts sub-folders (in case they've stuck needed modules there)
5) Offers to create a zip file of the build
6) If the zip file was make offers to clean up after itself (remove build, 
deposit  dist folders)

I've tested this on my Win7 box with Python 2.6 and it would appear to work 
as desired though I'll have to try running the resulting exe on some 
computers that have never seen python sometime next week.

As a side not, while doing a diff I noticed that the example app included in 
the official web2py_win.zip includes a bunch of extra files in 
applications/example/static that are not in the source distribution. They're 
almost all epydoc  sphinx files. Is there a reason for this or has 
something gotten out of sync?


[web2py] Re: How to build windows binary yourself?

2011-03-27 Thread Massimo Di Pierro
Fantastic. Yes something got out of sync. I will remove the unwanted files.

On Mar 27, 2011, at 8:23 PM, Brian M wrote:

 Massimo,
 
 I'll be emailing you a revised script based off of Praneeth's 
 standalone_exe.py shortly. I decided to make it a bit more interactive
 
 Features:
 1) Creates web2py.exe with py2exe
 2) Offers to remove the Windows DLLs that py2exe includes but are likely to 
 have licensing issues.
 3) Offers to let user decide if they want to include their applications (if 
 not still includes admin app)
 4) Offers to let user decide if they want to include their site-packages  
 scripts sub-folders (in case they've stuck needed modules there)
 5) Offers to create a zip file of the build
 6) If the zip file was make offers to clean up after itself (remove build, 
 deposit  dist folders)
 
 I've tested this on my Win7 box with Python 2.6 and it would appear to work 
 as desired though I'll have to try running the resulting exe on some 
 computers that have never seen python sometime next week.
 
 As a side not, while doing a diff I noticed that the example app included in 
 the official web2py_win.zip includes a bunch of extra files in 
 applications/example/static that are not in the source distribution. They're 
 almost all epydoc  sphinx files. Is there a reason for this or has something 
 gotten out of sync?



[web2py] Re: Pls Help. I can not change the background color of the flash message

2011-03-27 Thread Pystar
Did that, it didnt work.in previous version, it used to work for me. I
dont know what I am doing wrong. Disclaimer, I included blueprint css
framework into the page I am working on.

On Mar 28, 2:21 am, Anthony abasta...@gmail.com wrote:
 If you're using the 'welcome' app as the base, then in the 'web2py specific'
 section near the end of 'base.css', you can change the 'background' option
 of 'div.flash'. Note, you'll probably have to reload the page to see the
 change take effect.

 Anthony







 On Sunday, March 27, 2011 8:45:02 PM UTC-4, Pystar wrote:
  Hi,
  I have tried to change the background image of response.flash, but no
  matter what I do, its just not working. I have tinkered with the
  base.css file, everything. No changes reflected.
  Can anyone help out?
  thanks
  Pystar


[web2py] Re: Pls Help. I can not change the background color of the flash message

2011-03-27 Thread DenesL

Changing base.css has no effect.
I suspect the css is being modified by the jQuery effects applied to
the flash div but I have not been able to prove it.

On Mar 27, 9:21 pm, Anthony abasta...@gmail.com wrote:
 If you're using the 'welcome' app as the base, then in the 'web2py specific'
 section near the end of 'base.css', you can change the 'background' option
 of 'div.flash'. Note, you'll probably have to reload the page to see the
 change take effect.

 Anthony







 On Sunday, March 27, 2011 8:45:02 PM UTC-4, Pystar wrote:
  Hi,
  I have tried to change the background image of response.flash, but no
  matter what I do, its just not working. I have tinkered with the
  base.css file, everything. No changes reflected.
  Can anyone help out?
  thanks
  Pystar


[web2py] Re: Pls Help. I can not change the background color of the flash message

2011-03-27 Thread Pystar
Hope this isnt a bug ?

On Mar 28, 2:34 am, DenesL denes1...@yahoo.ca wrote:
 Changing base.css has no effect.
 I suspect the css is being modified by the jQuery effects applied to
 the flash div but I have not been able to prove it.

 On Mar 27, 9:21 pm, Anthony abasta...@gmail.com wrote:







  If you're using the 'welcome' app as the base, then in the 'web2py specific'
  section near the end of 'base.css', you can change the 'background' option
  of 'div.flash'. Note, you'll probably have to reload the page to see the
  change take effect.

  Anthony

  On Sunday, March 27, 2011 8:45:02 PM UTC-4, Pystar wrote:
   Hi,
   I have tried to change the background image of response.flash, but no
   matter what I do, its just not working. I have tinkered with the
   base.css file, everything. No changes reflected.
   Can anyone help out?
   thanks
   Pystar


[web2py] Re: args(0) is always None??

2011-03-27 Thread DenesL

The code is all messed up in the post above.
Could you repost to pastebin.com for example and copy the link here?.


On Mar 27, 8:09 pm, niknok nikolai...@gmail.com wrote:
 I have this function that displays several fields from two databases.
 but I couldn't get it to do the following:

 1) the previous question button actually causes an error. how come
 my session.item_id is always zero when I thought I was passing an
 incrementing value session.item_id+1 .

 2) when i select a value from the dropdown list get an error saying
 that I chose the wrong value

 3) i am thinking of collecting the answers in an array so i can check
 the answers before storing them as a records in a database. how do i
 do that?

 i look forward to your suggestions to make this move forward.

 def quiz():
         item_id =int(request.args(0) or 0)

         if item_id == 0:
 False).select(orderby='random')
                 # Females = db(db.questionnaire.id0 
 ).select(orderby='random')
                 print request.args(0), item_id, 'retrieving'
                 query = db(db.questionnaire.id0).select(orderby='random')
                 query_t = db(db.questionnaire_fil.id0).select()

         form = SQLFORM.factory(
                 Field('default', 'text', writable=False, 
 default=query[item_id]
 ['dialog']),
                 Field('locale', 'text', writable=False,
 default=query_t[int(query[item_id]['dialog_id']-1)]['dialog']),
                 Field('answer', 'list:string',
                         
 requires=IS_IN_SET(query_t[int(query[item_id]['dialog_id'])-1]
 ['choices'], zero=None, multiple=True)),
                 _style='width:400px'
                 )

         form[0][-1][1].append(XML('nbsp;nbsp;'))
         form[0][-1][1].append(INPUT (_type='button',_value=T('Previous
 question'),
                         
 _onclick=window.location='%s';%URL(r=request,args=(item_id-1) or
 0)))

         if form.accepts(request.vars,session):
                 if item_id=len(query):
                         response.flash= request.vars, item_id, request.args(0)
                         URL(r=request,args=(item_id+1))
                 else: URL(r=request, f='quiz_check')

         return dict(form=form, item_id=item_id)


[web2py] Re: Pls Help. I can not change the background color of the flash message

2011-03-27 Thread Anthony
Hmm, I just tried it in the current 'welcome' app (1.94.5), and changing the 
background color in div.flash in base.css works for me. Maybe you've got 
another div.flash defined somewhere else that's overriding the one in 
base.css. You could try adding '!important' to the declaration in base css 
(i.e., 'background: #your color !important').
 
Anthony

On Sunday, March 27, 2011 9:34:05 PM UTC-4, Pystar wrote:

 Did that, it didnt work.in previous version, it used to work for me. I 
 dont know what I am doing wrong. Disclaimer, I included blueprint css 
 framework into the page I am working on. 

 On Mar 28, 2:21 am, Anthony abas...@gmail.com wrote: 
  If you're using the 'welcome' app as the base, then in the 'web2py 
 specific' 
  section near the end of 'base.css', you can change the 'background' 
 option 
  of 'div.flash'. Note, you'll probably have to reload the page to see the 
  change take effect. 
  
  Anthony 
  
  
  
  
  
  
  
  On Sunday, March 27, 2011 8:45:02 PM UTC-4, Pystar wrote: 
   Hi, 
   I have tried to change the background image of response.flash, but no 
   matter what I do, its just not working. I have tinkered with the 
   base.css file, everything. No changes reflected. 
   Can anyone help out? 
   thanks 
   Pystar



[web2py] Re: Pls Help. I can not change the background color of the flash message

2011-03-27 Thread DenesL

Now it works... grrr.
Restarting web2py  the browser (set to clear all on closing) did it
for me.


On Mar 27, 9:34 pm, DenesL denes1...@yahoo.ca wrote:
 Changing base.css has no effect.
 I suspect the css is being modified by the jQuery effects applied to
 the flash div but I have not been able to prove it.

 On Mar 27, 9:21 pm, Anthony abasta...@gmail.com wrote:







  If you're using the 'welcome' app as the base, then in the 'web2py specific'
  section near the end of 'base.css', you can change the 'background' option
  of 'div.flash'. Note, you'll probably have to reload the page to see the
  change take effect.

  Anthony

  On Sunday, March 27, 2011 8:45:02 PM UTC-4, Pystar wrote:
   Hi,
   I have tried to change the background image of response.flash, but no
   matter what I do, its just not working. I have tinkered with the
   base.css file, everything. No changes reflected.
   Can anyone help out?
   thanks
   Pystar


[web2py] Re: Pls Help. I can not change the background color of the flash message

2011-03-27 Thread Pystar
Awesome!!!. it works, I actually had 2 base.css files, and one was
overiding the other. Thanks for the reponses, this community rocks.
Pystar,
Lagos, Nigeria, West Africa.

On Mar 28, 2:44 am, Anthony abasta...@gmail.com wrote:
 Hmm, I just tried it in the current 'welcome' app (1.94.5), and changing the
 background color in div.flash in base.css works for me. Maybe you've got
 another div.flash defined somewhere else that's overriding the one in
 base.css. You could try adding '!important' to the declaration in base css
 (i.e., 'background: #your color !important').

 Anthony







 On Sunday, March 27, 2011 9:34:05 PM UTC-4, Pystar wrote:
  Did that, it didnt work.in previous version, it used to work for me. I
  dont know what I am doing wrong. Disclaimer, I included blueprint css
  framework into the page I am working on.

  On Mar 28, 2:21 am, Anthony abas...@gmail.com wrote:
   If you're using the 'welcome' app as the base, then in the 'web2py
  specific'
   section near the end of 'base.css', you can change the 'background'
  option
   of 'div.flash'. Note, you'll probably have to reload the page to see the
   change take effect.

   Anthony

   On Sunday, March 27, 2011 8:45:02 PM UTC-4, Pystar wrote:
Hi,
I have tried to change the background image of response.flash, but no
matter what I do, its just not working. I have tinkered with the
base.css file, everything. No changes reflected.
Can anyone help out?
thanks
Pystar


[web2py] Re: Pls Help. I can not change the background color of the flash message

2011-03-27 Thread Pystar
This community really rocks!!! thanks guys, just tweeted about this.

On Mar 28, 2:55 am, Pystar aitoehi...@gmail.com wrote:
 Awesome!!!. it works, I actually had 2 base.css files, and one was
 overiding the other. Thanks for the reponses, this community rocks.
 Pystar,
 Lagos, Nigeria, West Africa.

 On Mar 28, 2:44 am, Anthony abasta...@gmail.com wrote:







  Hmm, I just tried it in the current 'welcome' app (1.94.5), and changing the
  background color in div.flash in base.css works for me. Maybe you've got
  another div.flash defined somewhere else that's overriding the one in
  base.css. You could try adding '!important' to the declaration in base css
  (i.e., 'background: #your color !important').

  Anthony

  On Sunday, March 27, 2011 9:34:05 PM UTC-4, Pystar wrote:
   Did that, it didnt work.in previous version, it used to work for me. I
   dont know what I am doing wrong. Disclaimer, I included blueprint css
   framework into the page I am working on.

   On Mar 28, 2:21 am, Anthony abas...@gmail.com wrote:
If you're using the 'welcome' app as the base, then in the 'web2py
   specific'
section near the end of 'base.css', you can change the 'background'
   option
of 'div.flash'. Note, you'll probably have to reload the page to see the
change take effect.

Anthony

On Sunday, March 27, 2011 8:45:02 PM UTC-4, Pystar wrote:
 Hi,
 I have tried to change the background image of response.flash, but no
 matter what I do, its just not working. I have tinkered with the
 base.css file, everything. No changes reflected.
 Can anyone help out?
 thanks
 Pystar


[web2py] Help needed on 3rd party authentication and links

2011-03-27 Thread Pystar
I have asked this question in the past but did not get an appropriate
response. I would like to know how a site like tenthrow.com, which was
built with web2py, incorporates third party authentication mechanisms
like Twitter, Facebook and Google and local authentication on the
site? If the tenthrow guys are seeing this, I would not mind hint or
tips from them.
Also I am having issues with links (i.e.built with A, URL helpers and
a) in my project. Although I included the blueprint css framework into
my project I dont seem to be sure if its the one causing this
behaviour:
Whenever I create links, its shows the normal link and the the link in
parenthesis. like this:
http://blahblah.com(/appname/controllername/functionname).
I have tried to debug this, but cant seem to get to the root of this.
I need hint, tips again
Thanks guys. You all rock!!!


[web2py] Re: How to build windows binary yourself?

2011-03-27 Thread Brian M
http://code.google.com/p/web2py/issues/detail?id=224 Issue created so this 
doesn't get lost. (script is attached if anyone wants it)


[web2py] ExtJS / qooxdoo - Python wrapper

2011-03-27 Thread Indra Gunawan
Hi, wondering is there exists ExtJS or Qooxdoo wrapper for Python?

I know some but its Pascal wrapper (take a look how they work/wrap), they
parse ExtJS classes source code and create ObjectPascal classes code, this
produced classes interface ability to produce JS code

http://code.google.com/p/extpascal/

This is enhanced works of ExPascal, see demo:
http://www.unigui.com/en/demo.html

-- 
coderbuzz


[web2py] Re: Help needed on 3rd party authentication and links

2011-03-27 Thread Anthony
On Sunday, March 27, 2011 10:18:42 PM UTC-4, Pystar wrote: 

 I have asked this question in the past but did not get an appropriate 
 response. I would like to know how a site like tenthrow.com, which was 
 built with web2py, incorporates third party authentication mechanisms 
 like Twitter, Facebook and Google and local authentication on the 
 site?

 
Go to 
http://web2py.com/book/default/chapter/08#Other-Login-Methods-and-Login-Forms 
and 
scroll down to the Multiple Login Forms subsection near the end of the 
section. Also, there's this slice: 
http://www.web2pyslices.com/main/slices/take_slice/124. Hopefully that will 
get you started.
 

 If the tenthrow guys are seeing this, I would not mind hint or 
 tips from them. 
 Also I am having issues with links (i.e.built with A, URL helpers and 
 a) in my project. Although I included the blueprint css framework into 
 my project I dont seem to be sure if its the one causing this 
 behaviour: 
 Whenever I create links, its shows the normal link and the the link in 
 parenthesis. like this: 
 http://blahblah.com(/appname/controllername/functionname). 
 I have tried to debug this, but cant seem to get to the root of this. 
 I need hint, tips again

 
Can you show the code from your controller and/or view where you are 
building and inserting the links?
 
Anthony


[web2py] My little Python projects

2011-03-27 Thread pierreth
Hello,

I updated my blog to talk about some Python projects I started. So
take a look and don't be afraid to comment. If you think these
projects can be integrated in another bigger project, suggestions are
welcome.

Note that Python script project to create Eclipse project from web2py
applications has now moved. The web2py recipe to integrate web2py,
Eclipse and Google Code is also on my blog.

See my blogs for all details.

http://pierrethibault.posterous.com/my-little-python-projects

--


A+

-
Pierre
My blog (http://pierrethibault.posterous.com)
YouTube page (http://www.youtube.com/user/tubetib)
Twitter (http://twitter.com/pierreth2)
Google profile (http://www.google.com/profiles/pierre.thibault1)


[web2py] Re: Help needed on 3rd party authentication and links

2011-03-27 Thread pbreit
tenthrow.com appears to be down. It looks like you were not interested in 
Janrain. There are some other 
approaches: 
http://web2py.com/book/default/chapter/08#Integration-with-OpenID,-Facebook,-etc.

Although it was not clear to me from any docs or gluon code how you could, 
for example, code your own Facebook Connect login. I'd like to find this out 
as well as I plan to code some alternative login methods.

For the URL issue, please provide some code.


[web2py] Re: Pls Help. I can not change the background color of the flash message

2011-03-27 Thread pbreit
Isn't it this CSS in static/css/base.css? Also, If you have any interest in 
CSS, Chrome/Safari have an Inspect Element command and Firefox has the 
terrific Firebug add on. These are all must-have tools for working with web 
page styles.


/*** web2py specific ***/
div.flash {
font-weight: bold;
display: none;
position: fixed;
padding: 10px;
top: 40px;
right: 10px;
min-width: 280px;
opacity: 0.85;
margin: 0px 0px 10px 10px;
color: #fff;
vertical-align: middle;
cursor: pointer;
background: #000;
border: 2px solid #fff;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
z-index: 2;
}
div.error {
background-color: red;
color: white;
padding: 3px;
}


[web2py] Re: args(0) is always None??

2011-03-27 Thread pbreit
Yeah, it looks like the code didn't come through very well. Pastebin would 
be good or go to groups.google.com where you can paste it and format it as 
Courier New font.

I'd try to stay away from using 0 in your business logic. It might not 
always do what you expect since it can have different meanings in different 
contexts. The one place where you *do* use it is when checking the length of 
an object (ie if len(request.args(0))0:). For example, to retrieve all rows 
in a table, you can do something like this: rows = db().select(db.
questionaire.ALL, orderby='random')
*
*
Another tactic I would recommend is to get one component working well before 
integrating it with something else. You've got some complicated things going 
on such as appending to forms, checking IS_IN_SET against a query, and some 
complex query mashing in general.

For checking the form before it gets processed, onvalidation might 
work: http://web2py.com/book/default/chapter/07#onvalidation