[web2py] Re: MongoDB and Web2py
On Oct 12, 12:07 pm, David Marko dma...@tiscali.cz wrote: Massimo adviced me to use something like this previsously: def make_connection(): from pymongo import Connection connection = Connection('localhost', 27017) return connection connection = cache.ram('mongodb',make_connection,None) Where do you put the make_connection function? And what about the connection variable?
[web2py] Re: Tiny example on uwsgidecorators+web2py
thks Roberto, tiago@tiago:~$ cd /opt/web2py/ tiago@tiago:/opt/web2py$ mkdir myspool tiago@tiago:/opt/web2py$ uwsgi --socket :3031 --spooler myspool -- master --processes 4 --import mytasks --module web2py.wsgihandler uwsgi: unrecognized option '--import' On Jul 22, 5:47 am, Roberto De Ioris robe...@unbit.it wrote: How can i create the spoller directory? mkdir myspool It is a normal, empty directory thks in advance On Jul 21, 6:06 pm, Roberto De Ioris robe...@unbit.it wrote: Hello Roberto, I've tried to start web2py has you demonstrated: uwsgi --socket :3031 --spooler myspool --master --processes 4 -- import mytasks --module web2py.wsgihandler but I got this error: [spooler directory] access(): No such file or directory [uwsgi.c line 2994] What is wrong? the spooler directory must exists (it is a security measure) -- Roberto De Iorishttp://unbit.it -- Roberto De Iorishttp://unbit.it
[web2py] Re: Tiny example on uwsgidecorators+web2py
I using 0.9.8.1. How can i update to 0.9.8.2 thks in advance On Jul 22, 10:15 am, Roberto De Ioris robe...@unbit.it wrote: Il giorno 22/lug/2011, alle ore 11:09, Tiago Moutinho ha scritto: thks Roberto, tiago@tiago:~$ cd /opt/web2py/ tiago@tiago:/opt/web2py$ mkdir myspool tiago@tiago:/opt/web2py$ uwsgi --socket :3031 --spooler myspool -- master --processes 4 --import mytasks --module web2py.wsgihandler uwsgi: unrecognized option '--import' Are you using the latest stable release ? --import was added in 0.9.8.2 (there are other ways to implement this in 0.9.8.1 but --import is so handy that the upgrade is worthy :) ) -- Roberto De Iorishttp://unbit.it
[web2py] Re: Tiny example on uwsgidecorators+web2py
I'M sorry Roberto for this boring question, but it gives an error in web2py when i try to run the controller, and i don't know ao to solve this. Exception: you have to enable the uWSGI spooler to use the @spool decorator Thks in advance On Jul 22, 5:39 pm, Roberto De Ioris robe...@unbit.it wrote: I using 0.9.8.1. How can i update to 0.9.8.2 thks in advance pip install uwsgi (or pip install -U uwsgi) Or download the sources from the official site and recompile them. BTW we are getting a bit Off-topic i suppose we can move the discussion to the uWSGI list (or the irc channel) and come back here when you have a working setup :) On Jul 22, 10:15 am, Roberto De Ioris robe...@unbit.it wrote: Il giorno 22/lug/2011, alle ore 11:09, Tiago Moutinho ha scritto: thks Roberto, tiago@tiago:~$ cd /opt/web2py/ tiago@tiago:/opt/web2py$ mkdir myspool tiago@tiago:/opt/web2py$ uwsgi --socket :3031 --spooler myspool -- master --processes 4 --import mytasks --module web2py.wsgihandler uwsgi: unrecognized option '--import' Are you using the latest stable release ? --import was added in 0.9.8.2 (there are other ways to implement this in 0.9.8.1 but --import is so handy that the upgrade is worthy :) ) -- Roberto De Iorishttp://unbit.it -- Roberto De Iorishttp://unbit.it
[web2py] Re: Tiny example on uwsgidecorators+web2py
How can i enable the spooler? I have pass target='spooler' to the decorator args but it gives the same error. On Jul 22, 7:44 pm, Tiago Moutinho tiago...@gmail.com wrote: I'M sorry Roberto for this boring question, but it gives an error in web2py when i try to run the controller, and i don't know ao to solve this. Exception: you have to enable the uWSGI spooler to use the @spool decorator Thks in advance On Jul 22, 5:39 pm, Roberto De Ioris robe...@unbit.it wrote: I using 0.9.8.1. How can i update to 0.9.8.2 thks in advance pip install uwsgi (or pip install -U uwsgi) Or download the sources from the official site and recompile them. BTW we are getting a bit Off-topic i suppose we can move the discussion to the uWSGI list (or the irc channel) and come back here when you have a working setup :) On Jul 22, 10:15 am, Roberto De Ioris robe...@unbit.it wrote: Il giorno 22/lug/2011, alle ore 11:09, Tiago Moutinho ha scritto: thks Roberto, tiago@tiago:~$ cd /opt/web2py/ tiago@tiago:/opt/web2py$ mkdir myspool tiago@tiago:/opt/web2py$ uwsgi --socket :3031 --spooler myspool -- master --processes 4 --import mytasks --module web2py.wsgihandler uwsgi: unrecognized option '--import' Are you using the latest stable release ? --import was added in 0.9.8.2 (there are other ways to implement this in 0.9.8.1 but --import is so handy that the upgrade is worthy :) ) -- Roberto De Iorishttp://unbit.it -- Roberto De Iorishttp://unbit.it
[web2py] Re: Tiny example on uwsgidecorators+web2py
How can i create the spoller directory? thks in advance On Jul 21, 6:06 pm, Roberto De Ioris robe...@unbit.it wrote: Hello Roberto, I've tried to start web2py has you demonstrated: uwsgi --socket :3031 --spooler myspool --master --processes 4 -- import mytasks --module web2py.wsgihandler but I got this error: [spooler directory] access(): No such file or directory [uwsgi.c line 2994] What is wrong? the spooler directory must exists (it is a security measure) -- Roberto De Iorishttp://unbit.it
[web2py] Re: default function of a controller
I also want to know that.. its in the routes?? On Jun 14, 11:55 am, Francisco Costa m...@franciscocosta.com wrote: Hello, I have this controller (not the default one) that I would like to have a default function (not index) How can I do that?
[web2py] Re: Using the REST API with Auth.
i think this might help you out: http://comments.gmane.org/gmane.comp.python.web2py/39225
[web2py] Duvida restful()
Hi, I have in my databse 2 tables: blog_post(id, name, slug, description) and blog_comments(id, post_id, comment). I want to use the restful api to for example list all comments for a given slug from blog_post. It is possible? With patterns i can not do that. Other question: Can i do a pattern in restful api thar list me all users, for example, with id 30??
[web2py] restful api
Hi, I have in my databse 2 tables: blog_post(id, name, slug, description) and blog_comments(id, post_id, comment). I want to use the restful api to for example list all comments for a given slug from blog_post. It is possible? With patterns i can not do that. Other question: Can i do a pattern in restful api thar list me all users, for example, with id 30??
[web2py] Re: Help about the restful api
I created this controller named api, as seen in you video. @request.restful() def place(): def GET(id): place = db.place(id) return place.as_dict() if place else None def POST(name, description): return db.place.validate_and_insert( name = name, description = description) def PUSH(place,name): db.place[place].update_record(name = name) return dict() #delete place by name def DELETE(name): del db.place(name) return dict() return locals() when i call in url localhost/appname/api/place/1, it only makes the GET method for the id=1 of the place, and then for the POST method i did this script on the default controler: def post(): import urllib import urllib2 api_params = { 'name': request.args(0), 'description' : request.args(1), } http_response = urllib2.urlopen('http://localhost/api/place', urllib.urlencode(api_params)) return http_response I put this: http://localhost/appname/post/name_example/description_exampleand it add another place with that name and that description. And this script work perfectly. But i can not find any support for the DELETE and PUSH methods. I think i will have to do another script, but i can not find support about that on the web.
[web2py] Help about the restful api
Hi, I have some difficulties on using @resquest.restful(). I want to do some experiments using GET, POST, PUSH and DELETE, but i can not make it work. Only GET works for me. How can i do for example a def POST(name): ?? I did this: def POST(name): return db.blog.validate_and_insert(name = name) cumps, Tiago
[web2py] Re: Help about the restful api
I just make POST method work with an script, but i still have some doubts about PUSH, and DELETE. def testing(): import urllib import urllib2 params = { 'name': request.args(0), 'birth': request.args(1) } http_response = urllib2.urlopen('http://localhost/post/post_test', urllib.urlencode(params)) return http_response Does anyone have some ideas in makinh PUSH AND DELETE work??? On May 18, 10:31 am, Tiago Moutinho tiago...@gmail.com wrote: Hi, I have some difficulties on using @resquest.restful(). I want to do some experiments using GET, POST, PUSH and DELETE, but i can not make it work. Only GET works for me. How can i do for example a def POST(name): ?? I did this: def POST(name): return db.blog.validate_and_insert(name = name) cumps, Tiago
[web2py] HELP IN DELETE AND PUSH METHODS USING RESTFUL API
Hi, I need some help about the delete and push methods using restful api. I made POST method work using urllib2, but i can not find anything on the web about DELETE AND PUSH Please help Thks in advance
[web2py] App blog as subdomain of another app
Hello, How can I change this http://www.test.com/blog to this blog.test.com ?? I know that ia have to change in routes.py but i do not know how. i tried this in routes.py: (r'.*blog.test.com*', r'http://www.test.com/blog'), but it still does not work. Many thaks in advance.
[web2py] Re: HELP IN DELETE AND PUSH METHODS USING RESTFUL API
I created this controller named api, as seen in you video. @request.restful() def place(): def GET(id): place = db.place(id) return place.as_dict() if place else None def POST(name, description): return db.place.validate_and_insert(name = name, description = description) def PUSH(place,name): db.place[place].update_record(name = name) return dict() #delete place by name def DELETE(name): del db.place(name) return dict() return locals() when i call in url localhost/appname/api/place/1, it only makes the GET method for the id=1 of the place, and then for the POST method i did this script on the default controler: def post(): import urllib import urllib2 api_params = { 'name': request.args(0), 'description' : request.args(1), } http_response = urllib2.urlopen('http://localhost/api/place', urllib.urlencode(api_params)) return http_response I put this: http://localhost/appname/post/name_example/description_example and it add another place with that name and that description. And this script work perfectly. But i can not find any support for the DELETE and PUSH methods. I think i will have to do another script, but i can not find support about that on the web.
[web2py] Re: Help about the restful api
Hi, i answer it the other post. But my problem is in the client.
Re: [web2py] PowerTable editable callback
Hi Bruno, Is there any possibility to edit only one column? cumps, Tiago
[web2py] PowerTable editable callback
Hello, I'm using PowerTable and I love it! But I have an issue: I want to edit a column named status, but only that column. And i want to alter de value of that column (status) on the databse, with an update. I've made an editable function, but something is missing, i guess, because it does not work. def editablefunction(): db(db.report.id == row_id).update(status = value)
[web2py] PowerTable editable callback
Hello, I'm using PowerTable and I love it! But I have an issue: I want to edit a column named status, but only that column. And i want to alter de value of that column (status) on the databse, with an update. I've made an editable function, but something is missing, i guess, because it does not work. def editablefunction(): db(db.report.id == row_id).update(status = value)