[web2py] forms and lists

2011-03-26 Thread niknok
I'm trying to go through two lists using a form but I could make the form move "forward" and "backward" through the list. The tables are essentially the same except for the language used. Could someone give me a nudge to the right direction? :) Here's my code: db.define_table('questionnaire',

Re: [web2py] recent web2py contributors

2011-03-26 Thread Ovidio Marinho
Tests: http://web2pyslices.com/main/slices/take_slice/99 - simple pdf report - Yamandu http://web2pyslices.com/main/slices/take_slice/93 - Auto tooltip - Yamandu Ovidio Marinho Falcao Neto ovidio...@gmail.com 88269088 Paraiba-Brasil

[web2py] Uploading Excel and reading from it

2011-03-26 Thread Mariusz Zieliński
Hello, I got problem with reading from uploaded xls just after forms.accept. Code looks like this: program.py --- db.define_table('files', SQLField('file', 'upload'), SQLField('filename') ) default.py def upload(): # first form - working # form = FORM('Upload file: ', # I

[web2py] specifying controller

2011-03-26 Thread james c.
Hi I'm new to web2py. I've made great progress in a few days with my project. SUMMARY: for every view I call, I get default.py as the controller. Even if I specify app/view/view or app/namediffernt/view I still get default.py as the controller. I appreciate any ideas or pointers on what to try. th

[web2py] Re: Uploading Excel and reading from it

2011-03-26 Thread Massimo Di Pierro
SQLFORM automatically uploads the db.files.file to a file in uploads/ that means the input stream is empty after the load. Do you want this to happen or just want it to pass to load_to_db? Here are some options and one may be the one that you want: Instead of: form = SQLFORM(db.files, fields

[web2py] question from stackoverflow - DB transactions

2011-03-26 Thread AdamF
Hi, Since I am still learning Web2py i used to search for knowledge here and there.. I found quite interesting question on stackoverflow that for my understanding is not answered yet.. The question: http://stackoverflow.com/questions/4979392/web2py-and-db-transactions As I understand the probl

Re: [web2py] specifying controller

2011-03-26 Thread Jonathan Lundell
On Mar 25, 2011, at 9:15 PM, james c. wrote: > > Hi I'm new to web2py. I've made great progress in a few days with my > project. > > SUMMARY: for every view I call, I get default.py as the controller. > Even if I specify app/view/view or app/namediffernt/view I still get > default.py as the contr

[web2py] Re: Uploading Excel and reading from it

2011-03-26 Thread Mariusz Zieliński
On 26 Mar, 15:34, Massimo Di Pierro wrote: > SQLFORM automatically uploads the db.files.file to a file in uploads/ > that means the input stream is empty after the load. That would make a sense. Didn't think about it actually that input stream might be emptied after saving file. > Do you want th

[web2py] Re: specifying controller

2011-03-26 Thread Anthony
Hi James, It sounds like you might be thinking of how a PHP app might work, where your URL points to a particular .php file, and that file is then processed to generate the returned web page. web2py does not work that way. To get a better understanding of how web2py does it, I recommend lookin

[web2py] question about tags in plugin_wiki

2011-03-26 Thread danto
hi, the tags widget in plugin_wiki are supposed to make posible to list pages with same tag between same tables? that seems yet not posible, at least for me, but I don't know if I missing something or not understanding well how plugin_wiki_tag works. can you give an advice for this? thanks in adv

[web2py] Re: plugins

2011-03-26 Thread Arun K.Rajeevan
Yes and no. You can post the code there, if that's fine. Yes, you can't upload a plugin as a zip, w2p or anything such. It'll be a good idea to upload the code to github or bitbucket and link to the repo in web2pyclices along with some examples on how to put your plugin to any use. Hope, this h

[web2py] Re: Lacking nginx deployment guide

2011-03-26 Thread VP
I followed the steps here but got a 502 Bad Gateway error from nginx. On Mar 17, 5:25 am, minux wrote: > pbreit, please ignore my last post. Actually I could make nginx+uwsgi > up and running by reading carefully your posts above. I have sum up > the instructions here: > > http://stackoverflow.c

[web2py] Re: Lacking nginx deployment guide

2011-03-26 Thread pbreit
Ok, let me double check the steps. I think that's an issue with nginx finding uWSGI or uWSGI finding web2py. You might dig through the nginx or uWSGI logs. Are your static files getting served ok? Is it a clean install of 10.04 or did the server already exist?

[web2py] specifying controller

2011-03-26 Thread pbreit
I think there is some confusion here about how it all comes together. I'd suggest following closely the overview chapter in the web2py book and make sure to get a good grasp for how all the files work together when a URL is requested. Basically, http://127.0.0.1:8000/myapp/default/index will loo

Re: [web2py] Re: Lacking nginx deployment guide

2011-03-26 Thread Vasile Ermicioi
What about my solution ? On Sat, Mar 26, 2011 at 7:41 PM, VP wrote: > I followed the steps here but got a 502 Bad Gateway error from nginx. > > > On Mar 17, 5:25 am, minux wrote: > > pbreit, please ignore my last post. Actually I could make nginx+uwsgi > > up and running by reading carefully yo

[web2py] Re: Lacking nginx deployment guide

2011-03-26 Thread VP
I tried minux's solution above. By the way, I have Debian squeeze and I run web2py as my own user (not as www-data). It seems I couldn't get uwsgi to start.

[web2py] Cherokee server locking while upload

2011-03-26 Thread LightOfMooN
I have web2py + uWSGI + Cherokee When I upload file, server is locking for all users. Does somebody khow how to fix it?

[web2py] Re: Cherokee server locking while upload

2011-03-26 Thread Marin
I hope this helps. http://groups.google.com/group/web2py/browse_thread/thread/62bece6a8c3b7524/e3289b402455758d On Mar 26, 7:52 pm, LightOfMooN wrote: > I have web2py + uWSGI + Cherokee > > When I upload file, server is locking for all users. > Does somebody khow how to fix it?

[web2py] Re: Lacking nginx deployment guide

2011-03-26 Thread VP
>>         location /static { >>             root /var/web2py/applications/init/; >>         } Slowly, i'm getting it to work. Current problem: can't serve static files (e.g. style css files). Is this configuration above correct? I tried to point to my app static folder and didn't work either.

[web2py] Re: Cherokee server locking while upload

2011-03-26 Thread LightOfMooN
Thx, 4 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 1000? Sounds bad

Re: [web2py] Cherokee server locking while upload

2011-03-26 Thread Roberto De Ioris
> I have web2py + uWSGI + Cherokee > > When I upload file, server is locking for all users. > Does somebody khow how to fix it? > You have to increase the number of workers (or threads). Cherokee is a streaming server so it will pass POST data to uWSGI as soon as they arrive leaving it blocked f

[web2py] Re: Cherokee server locking while upload

2011-03-26 Thread LightOfMooN
Just testing set 10 but on the 4nd upload server locked On 27 мар, 00:22, LightOfMooN wrote: > Thx, 4 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 1000? > Sounds bad

[web2py] Re: question from stackoverflow - DB transactions

2011-03-26 Thread Kevin Ivarsen
I'm not sure if carrying a transaction across multiple requests is possible, mainly because you can't be assured of getting the same connection to the database across requests. Looking through the code, it does appear to be possible to override the default commit behavior at the end of a succes

[web2py] Re: Converting legacy MySQL databases to web2py DAL

2011-03-26 Thread Kevin Ivarsen
Yes, this is a replacement. Trivial differences - just replaced MySQLdb references to gluon.contrib.pymysql, removed the comment up top about depending on MySQLdb, and added ".." to the python path so that it can find gluon.contrib even if the web2py directory isn't in your system pythonpath.

[web2py] Re: Proposals for New Tagline

2011-03-26 Thread JorgeRpo
I like your number 4, with a tweak: "*CODE LESS, ACCOMPLISH MOR*E"

[web2py] Problem slicing dal Rows

2011-03-26 Thread Gene Chow
I think I found a difference in the behavior of Rows slices versus regular list slices: Python 2.7.1 (r271:86882M, Nov 30 2010, 10:35:34) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from gluon.dal import Rows >>> l=range(

[web2py] Re: Problem slicing dal Rows

2011-03-26 Thread Kevin Ivarsen
It appears that Python's __getslice__(self, a, b) overload has a surprising behavior. From http://docs.python.org/reference/datamodel.html#object.__getslice__: "If negative indexes are used in the slice, the length of the sequence is added to that index." So when you evaluate rows[-20:], Pytho

[web2py] Passing Your Own Dictionary to form.accepts

2011-03-26 Thread Lennon
I was under the impression that you could pass your own dictionary to form.accepts but in the code below it neither accepts correct values nor returns any errors with incorrect ones. Am I mistaken about being able to do this or am I doing something wrong with my approach? Thanks for any help. fie

[web2py] in-line select for counting purpose

2011-03-26 Thread Joaquin Orbe
Hi all, I'm trying to get a result for this query: select vendor.id, vendor.Name, (select count(*) from sales_order where [Status] = 1 and vendor.id = sales_order.VendorID), (select count(*) from sales_order where [Status] = 2 and vendor.id = sales_order.VendorID), (select count(*) from sales_ord

[web2py] default URL for requires_login

2011-03-26 Thread VP
I think requires_login() -- and possilbly requires() -- assumes that the login page is in the default/user. Should this URL be auth.settings.login_url ? I don't have authentication in default/user, so I have to redirect to the appropriate place if a user tries to access a page that requires login

[web2py] Re: Lacking nginx deployment guide

2011-03-26 Thread Dale DeWitt
There's a checkbox to turn the marketplace off. "Receive insight from the actual people who conceived Cherokee and are the core committers of such technology." From Enterprise Support Services, Octality I imagine the ideas and money go both ways. Guessing of course. On Mar 10, 11:17 am, pbreit

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

2011-03-26 Thread tiny
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 ha

[web2py] Re: web2py cherokee vanilla

2011-03-26 Thread Dale DeWitt
Internal error Ticket issued: admin disabled because unable to access password file Doing: http://web2pyslices.com/main/slices/take_slice/110 Using ISP IP. On Mar 26, 12:27 am, pbreit wrote: > The uWSGI is required as far as I know. It's an alternative to fastcgi. > Cherokee is fully aware of

[web2py] Re: Problem slicing dal Rows

2011-03-26 Thread Massimo Di Pierro
Can you please send me a patch as an attachment? On Mar 26, 3:13 pm, Kevin Ivarsen wrote: > It appears that Python's __getslice__(self, a, b) overload has a surprising > behavior. > Fromhttp://docs.python.org/reference/datamodel.html#object.__getslice__: > > "If negative indexes are used in the

[web2py] Re: Passing Your Own Dictionary to form.accepts

2011-03-26 Thread Massimo Di Pierro
use if form.accepts(formvars,dbio=False,formname-None) else iit expects a formname key in the formvars. On Mar 26, 3:36 pm, Lennon wrote: > I was under the impression that you could pass your own dictionary to > form.accepts but in the code below it neither accepts correct values > nor returns

[web2py] Re: in-line select for counting purpose

2011-03-26 Thread Massimo Di Pierro
You an have a nested select in place of a field. I think you want: count = db.sales_order.id.count() query = db.sales_order.VendorID == db.vendor.id rows1 = db(query) (db.sales_order.Status==1).select(db.vendor.id,db.vendor.Name,count) rows2 = db(query) (db.sales_order.Status==2).select(db.vendor.

[web2py] Re: question about tags in plugin_wiki

2011-03-26 Thread Massimo Di Pierro
yes and not. Plugin wiki simply allows to tag objects, ids but (tablename, record_id). plugin_wiki does not keep track of which pages contain which widgets. If you tag the page, instead of the objects they contain, than you get pages by tags. Anywa, you just gave me a suggestion for improvement

[web2py] Re: Passing Your Own Dictionary to form.accepts

2011-03-26 Thread Lennon
Yup, that fixed it. Thanks! On Mar 26, 5:26 pm, Massimo Di Pierro wrote: > use > > if form.accepts(formvars,dbio=False,formname-None) > > else iit expects a formname key in the formvars. > > On Mar 26, 3:36 pm, Lennon wrote: > > > > > > > > > I was under the impression that you could pass your

[web2py] Re: plugins

2011-03-26 Thread Will Stevens
Alright, I will set something up for sharing code with you guys... Thanks... On Sat, Mar 26, 2011 at 1:35 PM, Arun K.Rajeevan wrote: > Yes and no. > You can post the code there, if that's fine. > > Yes, you can't upload a plugin as a zip, w2p or anything such. > It'll be a good idea to upload th

[web2py] Re: Lacking nginx deployment guide

2011-03-26 Thread LightOfMooN
Hi I follow this guide http://stackoverflow.com/questions/5335153/how-to-deply-web2py-using-nginx I have ubuntu 10.4 + nginx + web2py, installed in var And the result is 502 Bad Gateway. Any suggestions?

Re: [web2py] Re: question about tags in plugin_wiki

2011-03-26 Thread danto
2011/3/26 Massimo Di Pierro > yes and not. Plugin wiki simply allows to tag objects, ids but > (tablename, record_id). plugin_wiki does not keep track of which pages > contain which widgets. If you tag the page, instead of the objects > they contain, than you get pages by tags. Anywa, you just ga

[web2py] run web2py daemon

2011-03-26 Thread LightOfMooN
I have Ubuntu 10.04 and web2py in var I try to run it as a daemon such as in http://web2py.com/book/default/chapter/11#Start-as-Linux-Daemon but seems, that when I type "sudo /etc/init.d/web2py start", it's nothing happens. No errors and no web2py daemon run

[web2py] Re: Lacking nginx deployment guide

2011-03-26 Thread VP
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 wrote: > Hi > I follow this > guidehttp://stackoverflow.com/que

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

2011-03-26 Thread Brian Will
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', fie

[web2py] Web2py & GAE integration

2011-03-26 Thread Shark
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: getting fields created by SQLFORM but which are not in the form

2011-03-26 Thread DenesL
The new record id will be in form.vars.id after the accepts. On Mar 26, 7:46 pm, Brian Will 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 rec

[web2py] Re: Problem slicing dal Rows

2011-03-26 Thread DenesL
Note that __getslice__ is used in: dal.py (3 times), html.py and languages.py On Mar 26, 5:25 pm, Massimo Di Pierro wrote: > Can you please send me a patch as an attachment?

[web2py] resetting the DB query

2011-03-26 Thread fib
Hi all I am learning the ropes so to speak and am using a remote mysql as a db I have sorted out the tables from legacy db to be generated by web2py along with the auth tables I need to know what the quick way is to reset the db - as i learn and make mistakes in previous times I would just drop a

[web2py] Re: Web2py & GAE integration

2011-03-26 Thread Anthony
I'm sure someone here can help you, but you'll have to provide more detail regarding what you've done so far and exactly what errors or problems you are seeing. On Saturday, March 26, 2011 7:10:55 PM UTC-4, Shark wrote: > > We have troubles in GAE and web2py integration in our graduation > pro

Re: [web2py] resetting the DB query

2011-03-26 Thread Kenneth Lundström
Drop the database and create it. Remove all files in /databases That way web2py loses the old state of the database and recreates all tables. If you only want to reset a table, drop that table and remove responding file under databases Kenneth Hi all I am learning the ropes so to speak

[web2py] Re: resetting the DB query

2011-03-26 Thread Anthony
Check the sections in the book about Migrations ( http://web2py.com/book/default/chapter/06#Migrations) and "Fixing Broken Migrations" ( http://web2py.com/book/default/chapter/06#Fixing-Broken-Migrations). web2py stores migration information for each table in files in the 'databases' folder (so

[web2py] Re: resetting the DB query

2011-03-26 Thread fib
Thank you both the migrate was set to false on the table I was on excellent I had tried deleting stuff in /databases but was not sure on the file name which should go sorting the migrate has fixed the immediate annoyance much appreciated and great response time thank you On Mar 27, 12:47 am, Ant

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

2011-03-26 Thread Brian Will
Thanks, that's a start, but how now do I get 'uuid' which I've set as a default field in the model. Is there a way I can manually set the value in the controller before invoking form.accepts? Simplest I can think of is: value = computevalue() db.table.field.default = lambda: value # effectively

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

2011-03-26 Thread Brian Will
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. The problem this then introduces is how to set the enclosing variable from the function without use of nonlocal. Guess I can just create a dict for the

Re: [web2py] Re: Lacking nginx deployment guide

2011-03-26 Thread David J.
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.s

[web2py] Re: Performance of web2py's hello world

2011-03-26 Thread VP
Same test with nginx (4 workers). It's actually about 3ms/request slower than with the Apache set up. On the other hand, nginx uses about 200-300MB fewer in RAM. During the stress test, it also opens much fewer files. I think I will use nginx for a while to see if it is as stable as Apache. =

[web2py] Re: Lacking nginx deployment guide

2011-03-26 Thread LightOfMooN
That is what I have in /etc/init.d/uwsgi: PATH=/opt/uwsgi:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/bin/uwsgi OWNER=uwsgi Should I modify it to: PATH=/opt/uwsgi:/sbin:/bin:/usr/sbin:/usr/local/bin DAEMON=/usr/local/bin/uwsgi OWNER=www-data ? On 27 мар, 05:55, VP wrote: > Make sure uwsgi has t

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

2011-03-26 Thread Roberto De Ioris
> Thx, 4 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 1000? > 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 pro

[web2py] Re: Cherokee server locking while upload

2011-03-26 Thread LightOfMooN
Thx, but what is the best solution for now to deploy web2py with more than 3k users online, which can upload and download files? On 27 мар, 11:46, "Roberto De Ioris" wrote: > > Thx, 4 helps. > > But so if 4 users go to page with image, or upload some file, all will > > be crashed again. > > Is it