Re: [web2py] Re: reCaptcha in forms
ok, thank you Massimo, your support is outstanding
[web2py] Re: Function is evaluated twice?
Thanks for the advice. The problem does indeed not occur with another plugin layout (I used Whitelight before). I am just testing some functionality and will add a form statement soon. On Apr 3, 3:56 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Add a print statement. You find that the function is being called twice. A broken link in the page like img src=broken/ make cause that. Mind that a function that inserts without a form posting is vulnerable to URL redirection attacks. On Apr 2, 4:55 pm, Serbitar rserbi...@googlemail.com wrote: I have the controller: @auth.requires_login() def roll(): if request.args(0): step = int(request.args(0)) else: return dict(message = Roll it!) if request.args(1): visible = False else: visible = True result = util.roll_step(step) db.live.insert(username=auth.user.username, value=result, step=step, visible=visible) return dict(message = result) the util.step function just generates some random numbers. when I call: application/controller/roll/5 the roll() function inserts ONE entry into the db with visible is True (just like intended) when I call: application/controller/roll/5/1 or application/controller/roll/10/3/10 or application/controller/roll/7/whatever the function inserts TWO entries into the db (with visible = False, like intended). Why does it insert two? Thanks in advance.
[web2py] Issues with python in the menu.py
So I have been playing with the idea of having some dynamic menus and I am a bit stuck... If a user is logged in and has created a conference then they should see an extra menu item with all of the conferences they are currently organizing. I have this in the menu.py file... if auth.is_logged_in(): users_conferences = db(db.conference.creator == auth.user.id).select(orderby = db.conference.name) if users_conferences: users_conferences_list = [] for event in users_conferences: users_conferences_list.append((event.name, False, URL( 'conference', 'enter', args = event.id), []) ) response.menu += [(T('My Conferences'), False, URL('default','my_conferences'), [ users_conferences_list ])] But I get a menu like this instead. It's almost as if the menu item code is not executed but taken as an almost literal string. Must be something simple I am missing. --- Best Regards, Jason Brower inline: Screenshot-2.png
Re: [web2py] Issues with python in the menu.py
On 3.4.2011 14:03, Jason Brower wrote: So I have been playing with the idea of having some dynamic menus and I am a bit stuck... If a user is logged in and has created a conference then they should see an extra menu item with all of the conferences they are currently organizing. I have this in the menu.py file... if auth.is_logged_in(): users_conferences = db(db.conference.creator == auth.user.id).select(orderby = db.conference.name) if users_conferences: users_conferences_list = [] for event in users_conferences: users_conferences_list.append((event.name, False, URL( 'conference', 'enter', response.menu += [(T('My Conferences'), False, URL('default','my_conferences'), [ users_conferences_list ])] I think the if users_conferences is not needed as if the users_conferences is empty the for loop is not executed. But thats not the reason why this fails. I don´t get the logic of the for list, why are you creating a list first, shouldn´t you just call the response_menu += for every event. I create the meny with pages like this: pages = db((db.t_page.id 3)(db.t_page.f_public == True)).select(orderby=db.t_page.id) for page in pages: response.menu += [((page.f_menu), False, URL('default', 'index', args=[page.id]), []),] Kenneth But I get a menu like this instead. It's almost as if the menu item code is not executed but taken as an almost literal string. Must be something simple I am missing. --- Best Regards, Jason Brower image/png
Re: [web2py] Issues with python in the menu.py
Oh shit, no I undestand why you created the list, it was a submenu you tried to create and my was for creating the main menu. Why yours is failing I have no idea. Sorry. Kenneth So I have been playing with the idea of having some dynamic menus and I am a bit stuck... If a user is logged in and has created a conference then they should see an extra menu item with all of the conferences they are currently organizing. I have this in the menu.py file... if auth.is_logged_in(): users_conferences = db(db.conference.creator == auth.user.id).select(orderby = db.conference.name) if users_conferences: users_conferences_list = [] for event in users_conferences: users_conferences_list.append((event.name, False, URL( 'conference', 'enter', args = event.id), []) ) response.menu += [(T('My Conferences'), False, URL('default','my_conferences'), [ users_conferences_list ])] But I get a menu like this instead. It's almost as if the menu item code is not executed but taken as an almost literal string. Must be something simple I am missing. --- Best Regards, Jason Brower image/png
[web2py] web2py Ajax and ajaxClick()
I have the following I have the ajax function returning html depending on logic from a controller. one the html elements is a link to a google map, it is possible to automate page transition in jquery using ajaxClick() but i cant get it to work using the response.js method. if request.vars.t1 == map1 : response.js = $('a href=#gmap-4 data- transition=pop').ajaxClick(); elif request.vars.t1 == map : response = DIV(DIV(request.vars.t1,_style=color: #AA; font-size: 12px; font-family: Lucdia Grande,arial,sans- serif;),DIV(...and here's your map:,_style=color: #33; font- size: 16px; font-family: Lucdia Grande,arial,sans-serif;),LI(A('Your Map',_href='#gmap-4'))) return response any ideas how to get this working? Regards Chrism
[web2py] Re: jquery mobile, google maps and routes.py
update - seems to only work if you have multiple page definitions in same html file. On Apr 2, 1:02 pm, ChrisM cjjmur...@gmail.com wrote: i am using the examples from; I have a incoming request at http://localhost:8000/#/init/default/map_geoloc in routes.py i have: routes_in = ((r'.*:/favicon.ico', r'/examples/static/favicon.ico'), (r'.*:/robots.txt', r'/examples/static/robots.txt'), (r'.*:/#/init/default/map_geoloc', r'/init/default/ map_geoloc'), ((r'.*http://otherdomain.com.*(?Pany.*)', r'/app/ctr \gany'))) doesn't seem to work as i have a google map which will load at http://localhost:8000/init/default/map_geoloc but through a jquery link http://localhost:8000/#/init/default/map_geoloc with the additional # google map will not load, anyone else solved this one? Regards Chrism
Re: [web2py] Issues with python in the menu.py
On 04/03/2011 02:36 PM, Kenneth Lundström wrote: On 3.4.2011 14:03, Jason Brower wrote: So I have been playing with the idea of having some dynamic menus and I am a bit stuck... If a user is logged in and has created a conference then they should see an extra menu item with all of the conferences they are currently organizing. I have this in the menu.py file... if auth.is_logged_in(): users_conferences = db(db.conference.creator == auth.user.id).select(orderby = db.conference.name) if users_conferences: users_conferences_list = [] for event in users_conferences: users_conferences_list.append((event.name, False, URL( 'conference', 'enter', response.menu += [(T('My Conferences'), False, URL('default','my_conferences'), [ users_conferences_list ])] I think the if users_conferences is not needed as if the users_conferences is empty the for loop is not executed. But thats not the reason why this fails. I don´t get the logic of the for list, why are you creating a list first, shouldn´t you just call the response_menu += for every event. I create the meny with pages like this: pages = db((db.t_page.id 3)(db.t_page.f_public == True)).select(orderby=db.t_page.id) for page in pages: response.menu += [((page.f_menu), False, URL('default', 'index', args=[page.id]), []),] Kenneth The pages are to be subpages in the my conferences drop down. So a simple += won't do as it doesn't get inside of the menu. BR, Jason Brower But I get a menu like this instead. It's almost as if the menu item code is not executed but taken as an almost literal string. Must be something simple I am missing. --- Best Regards, Jason Brower image/png
[web2py] [SOLVED] cannot import name DateTime
It was due to package dependency in kinterbasdb. I always seem to have such a struggle setting up Firebird and Kinterbasdb. I've tried to retrace my steps and look at how I solved the problem in case anyone else gets it. Hopefully hereunder will be a clue for you :) ### Ubuntu 10.04 LTS Lucid Lynx - Add Firebird and kinterbasdb #add Universe and Multiverse repositories sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup echo 'deb http://us.archive.ubuntu.com/ubuntu/ lucid universe deb-src http://us.archive.ubuntu.com/ubuntu/ lucid universe deb http://us.archive.ubuntu.com/ubuntu/ lucid-updates universe deb-src http://us.archive.ubuntu.com/ubuntu/ lucid-updates universe deb http://us.archive.ubuntu.com/ubuntu/ lucid multiverse deb-src http://us.archive.ubuntu.com/ubuntu/ lucid multiverse deb http://us.archive.ubuntu.com/ubuntu/ lucid-updates multiverse deb-src http://us.archive.ubuntu.com/ubuntu/ lucid-updates multiverse ' /etc/apt/sources.list apt-get install firebird2.1-super dpkg-reconfigure firebird2.1-super apt-get install firebird2.1-dev apt-get install firebird2.1-common wget https://launchpad.net/ubuntu/lucid/+source/python-kinterbasdb/3.3.0-2/+files/python-kinterbasdb_3.3.0.orig.tar.gz tar -zxvf python-kinterbasdb_3.3.0.orig.tar.gz cd kinterbasdb-3.3.0 python setup.py install python setup.py build python -c import kinterbasdb /etc/init.d/apache2 restart
[web2py] Re: web2py Ajax and ajaxClick()
Hi CrisM. The response.js works only in components loaded by =LOAD() function. You can find some documetation in http://www.web2py.com/book/default/chapter/13#Components Its very easy to use.
Re: [web2py] Re: jquery mobile, google maps and routes.py
On Apr 3, 2011, at 4:58 AM, ChrisM wrote: update - seems to only work if you have multiple page definitions in same html file. I'd avoid using # in a URL, because a browser is likely to parse it as a fragment (anchor) identifier. On Apr 2, 1:02 pm, ChrisM cjjmur...@gmail.com wrote: i am using the examples from; I have a incoming request at http://localhost:8000/#/init/default/map_geoloc in routes.py i have: routes_in = ((r'.*:/favicon.ico', r'/examples/static/favicon.ico'), (r'.*:/robots.txt', r'/examples/static/robots.txt'), (r'.*:/#/init/default/map_geoloc', r'/init/default/ map_geoloc'), ((r'.*http://otherdomain.com.*(?Pany.*)', r'/app/ctr \gany'))) doesn't seem to work as i have a google map which will load at http://localhost:8000/init/default/map_geoloc but through a jquery link http://localhost:8000/#/init/default/map_geoloc with the additional # google map will not load, anyone else solved this one? Regards Chrism
[web2py] Re: psycopg2 on macos
psycopg2 (and postgres in general) on mac can be tricky. it's been a while since i did this, but the obvious thing to double check is that the web2py is using the same version of python that psycopg2 got installed to. chances are there are multiple python installs on your machine (this is not uncommon) and psycopg2 is not in the same one as web2py is using. cfh
[web2py] Re: DAL: all database connections should be made by using the credentials of the authenticated user?!?!
in have an app that has 2 connections - one for core data, and one for statistical data. no problem at all. the conditional authorization requirement in your app might make it a little tricky but should be doable. cfh
[web2py] Re: Uploaded file content issue.
Nobody can help me on this issue ? Limesle
[web2py] Re: Issues with python in the menu.py
Hi Jason This line response.menu += [(T('My Conferences'), False, URL('default','my_conferences'), [ users_conferences_list ])] I think should be response.menu += [(T('My Conferences'), False, URL('default','my_conferences'), users_conferences_list )] users_conferences is already a list, wrapping it in [] makes a one element list containing the users_conferences list which is not what menu expects. Ron
[web2py] extra arguments for Table and Field
Hello. I'm trying to implement common grid operations (with Ext JS, GridPanel) for all tables in my app. Now I would need some extra info on table and field levels as hints, ex. default sort order of a table, column width of a field. The easiest way would be to have a extra argument in gluon.dal.Table and gluon.dal.Field in which I could store all the associated info. Otherwise I have to store it in separate place, not directly related to the tables fields. What do you think about this? Good or not necessary? Thanks for your feedback! Regards, Marcel
[web2py] Re: DAL: all database connections should be made by using the credentials of the authenticated user?!?!
Mind that if you do this connection pooling will not work and you it will result in shower response time.
[web2py] mod_wsgi + CentOS + web2py in subdirectory = possible?
I spent 6 fruitless hours yesterday trying to get Web2py working on my hosting service: a CentOS VPS running Apache 2.0.52, Python 2.7, mod_wsgi 3.3 (latest), and web2py 1.94.6 (latest stable). I need it to run in a subdirectory since I use the server for other things. After trying everything within reason and reading everything I can find, I'm rapidly coming to the conclusion that web2py just doesn't work in this configuration. If somebody can get me unstuck, I would be *very* appreciative. If there is a reason why this is impossible or if there is some needed modification to the instructions, maybe it would be good to document that in order to save others from the same frustration. I'd be happy to help with that. ERRORS SEEN: - 503 : (13)Permission denied: mod_wsgi (pid=10472): Unable to connect to WSGI daemon process 'web2py' on '/etc/httpd/logs/wsgi. 7370.102.1.sock' after multiple attempts. ... received when visiting http://example.com/web2py-apps/ - 403 : client denied by server configuration: /home/siteadmin/web2py/ wsgihandler.pywelcome ... received when visiting http://example.com/web2py-apps/welcome/default/index/ WHAT WORKS: - mod_wsgi works with a simple hello.py WSGI script. - Running web2py by running python web2py.py works. - Running web2py via wsgiref.simple_server.WSGIServer, started by my own script, works. ALREADY TRIED: - I started with the Apache configuration in the book ( http://web2py.com/book/default/chapter/11#mod_wsgi ) modified so that it runs in a subdirectory (i.e., /web2py-apps/ instead of /). That gave me the above errors. - Verified that mod_wsgi is getting Python 2.7. - Tried temporarily setting it to live in the server's root. Same errors. - Checked that Apache can read the directory where web2py lives. - Verified that mod_wsgi works and web2py works. I just can't make them work together. - Looked at Graham Dumpleton's blog posts and other pages about this. CONFIGURATION: WSGIPythonHome /usr/local/python/python2.7 # ... VirtualHost ###.###.###.###:80 # ... WSGIDaemonProcess web2py user=siteadmin group=siteadmingroup display- name=%{GROUP} WSGIProcessGroup web2py WSGIScriptAlias /web2py-apps/ /home/siteadmin/web2py/wsgihandler.py Directory /home/siteadmin/web2py AllowOverride None Order Allow,Deny Deny from all Files wsgihandler.py Allow from all /Files /Directory # (and also the stuff about static directories and admin panels) # ... /VirtualHost QUESTIONS: - Has anybody ever gotten web2py working in a subdirectory (i.e., http://example.com/web2py-apps/welcome) with mod_wsgi? Some things I read while searching indicated this isn't possible without intensive customization. - Has anybody ever gotten web2py working with CentOS? Some things I read while searching indicated web2py doesn't work well with CentOS. One person changed providers for that reason. - Would mod_proxy be more fool-proof? Given the time and frustration spent trying to make it work with mod_wsgi, I am reluctant to try a totally different strategy unless there's reason to believe it would be easier. I am totally new to Web2py and I was very impressed when running locally. Right now, I'm frustrated. When I got started, it looked like this was going to be much easier. Maybe just bad luck that I happen to be on a CentOS server. I don't know. Anyway, if anybody could give me a pointer, I'd really appreciate it. If I ever get it working, I'll definitely write back with a HOWTO. Thanks, Alex
[web2py] PostgreSQL Error SELECT DISTINCT, ORDER BY expressions must appear in select list
web2py generate SQL that PostgreSQL doesn't accept. For instance, SELECT DISTINCT a.id, a.uid, a.name FROM a, b WHERE a.deleted 'T') AND (a.id 0)) AND (((b.deleted 'T') AND (b.id 0)) AND (b.id = 1))) AND (b.uid = a.uid)) ORDER BY b.id, a.id LIMIT 1 OFFSET 0; It fails because select list is not contain b.id. I change gluon/dal.py(Version 1.94.5) as follows. It is work well. But I am not sure that it is a good practice. === modified file 'gluon/dal.py' Version 1.94.5 @@ -1039,2 +1039,6 @@ -- if not orderby and tablenames: -sql_o += ['%s.%s'%(t,x) for t in tablenames for x in ((hasattr(self.db[t],'_primarykey') and self.db[t]._primarykey) or [self.db[t]._id.name])] +orderby_fields = ['%s.%s'%(t,x) for t in tablenames for x in ((hasattr(self.db[t],'_primarykey') and self.db[t]._primarykey) or [self.db[t]._id.name])] +sql_o += ' ORDER BY %s' % ', '.join(orderby_fields) +for orderby_field in orderby_fields: +if orderby_field not in self._colnames: +sql_f += ', %s' % orderby_field Your opinion will be much appreciated, Cheers,
[web2py] Re: extra arguments for Table and Field
You can already do: db.table.field.extra = {} extra is not a keyword but you can attach attributes to a field object. You can do it with tables too but they must be preceded by and underscore to avoid naming conflicts with fields: db.table._extra = {} Massimo On Apr 3, 10:51 am, Marcel Luethi marcel.lue...@gmail.com wrote: Hello. I'm trying to implement common grid operations (with Ext JS, GridPanel) for all tables in my app. Now I would need some extra info on table and field levels as hints, ex. default sort order of a table, column width of a field. The easiest way would be to have a extra argument in gluon.dal.Table and gluon.dal.Field in which I could store all the associated info. Otherwise I have to store it in separate place, not directly related to the tables fields. What do you think about this? Good or not necessary? Thanks for your feedback! Regards, Marcel
[web2py] Re: extra arguments for Table and Field
Wow! Great! And many thanks for the superfast reply! On 3 Apr., 17:57, Massimo Di Pierro massimo.dipie...@gmail.com wrote: You can already do: db.table.field.extra = {} extra is not a keyword but you can attach attributes to a field object. You can do it with tables too but they must be preceded by and underscore to avoid naming conflicts with fields: db.table._extra = {} Massimo On Apr 3, 10:51 am, Marcel Luethi marcel.lue...@gmail.com wrote: Hello. I'm trying to implement common grid operations (with Ext JS, GridPanel) for all tables in my app. Now I would need some extra info on table and field levels as hints, ex. default sort order of a table, column width of a field. The easiest way would be to have a extra argument in gluon.dal.Table and gluon.dal.Field in which I could store all the associated info. Otherwise I have to store it in separate place, not directly related to the tables fields. What do you think about this? Good or not necessary? Thanks for your feedback! Regards, Marcel
[web2py] Re: Uploaded file content issue.
I do not fully understand the workflow. I assume the problem is that exposecsv() cannot find the file. Correct? What is in request.args(0)? How were the files uploaded? massimo On Apr 1, 7:14 am, Limesle jbsoube...@gmail.com wrote: Hello, as you know, Web2py transform the content and the name of a file when uploaded. I tried several time to expose the real content of the file But I always have Fieldstorage and other information at the begining. I can't get rid of this. The file content are like: FieldStorage('file_path', 'C:\\Documents and Settings\\w7774455\ \Desktop\\test.csv', 'contentline1\r\ncontentline2\r\n') I just want to be able to expose : contentline1 contentline2 Used controllers : def listfile(): files = db().select(db.Files.ALL) return dict (files=files) def exposecsv(): import csv filename=request.args[0] content = os.path.join(request.folder,'uploads/','%s' % filename) content1 = open(content, 'r') content2 = csv.reader(content1, delimiter=',') return dict(content2=content2) It would be very helpful if someone have an idea. Thank for reading me. Limesle
[web2py] url rewriting
Hello I am asking about url rewriting in web2py withGAE I want to make our site page www.site.com/init/login to www.site,com/login can you help me ? someone tell me change app,yaml others say change routers.py so I need your help Thanks
Re: [web2py] url rewriting
On Apr 3, 2011, at 9:01 AM, Shark wrote: Hello I am asking about url rewriting in web2py withGAE I want to make our site page www.site.com/init/login to www.site,com/login can you help me ? someone tell me change app,yaml others say change routers.py Change (create) routes.py (note the name). With your configuration, the default case should work fine: routers = dict( # base router BASE = dict( default_application = 'init', ), ) so I need your help Thanks
Re: [web2py] Re: Issues with python in the menu.py
On 04/03/2011 06:26 PM, ron_m wrote: Hi Jason This line response.menu += [(T('My Conferences'), False, URL('default','my_conferences'), [ users_conferences_list ])] I think should be response.menu += [(T('My Conferences'), False, URL('default','my_conferences'), users_conferences_list )] users_conferences is already a list, wrapping it in [] makes a one element list containing the users_conferences list which is not what menu expects. Ron Too many, brackets... feels like lisp!!! Thanks, that didn't. Once again, it was just a little python hickup from me. :D Your solution did the trick. --- Best Regards, Jason Brower
[web2py] Re: web2py joins Pylons project
Thanks, Pyramid. http://twitter.com/#!/amarandon/status/54413227936854016
[web2py] Making my own decorator...
I am making my first decorator and I want to make sure I do it right... def is_in_conference(): if not session.current_conference: redirect(URL('default', 'index')) @is_in_conference() def index(): INFO: This page takes all the various things of the conference on to one page. return dict() Is this correct? Also can I use two docorators? For example: @is_in_conference() @auth.is_logged_in() def index(): INFO: This page takes all the various things of the conference on to one page. return dict() Best Regards, Jason
[web2py] Re: IS_IN_DB no dropdown list
Hi, Is there a nice place to figure out what's out of date in the book? (I recently bought a copy and was assuming it was a bit more up-to-date.) I'm just beginnings of web2py, having fought with and been defeated by other frameworks. ;-) Having beat my head against this very problem I had assumed it was my problem dealing with frameworks that was the trouble. Following your example solved the trouble, thanks muchly. I'm hoping to avoid the bruises on the forehead in the future. Is there a good single source of road closed / under construction / detour ahead signs? Thanks!
[web2py] Re: IS_IN_DB no dropdown list
There is nothing really outdated in the 3rd edition of the book. There are a few typos (fixed online) and it missed a description of some of the new features (mostly new router, restful services). On Apr 3, 2:19 pm, Kevin Cole dc.l...@gmail.com wrote: Hi, Is there a nice place to figure out what's out of date in the book? (I recently bought a copy and was assuming it was a bit more up-to-date.) I'm just beginnings of web2py, having fought with and been defeated by other frameworks. ;-) Having beat my head against this very problem I had assumed it was my problem dealing with frameworks that was the trouble. Following your example solved the trouble, thanks muchly. I'm hoping to avoid the bruises on the forehead in the future. Is there a good single source of road closed / under construction / detour ahead signs? Thanks!
[web2py] Re: IS_IN_DB no dropdown list
The online version of the book is continually edited, so it will be more up-to-date than the printed copy. I doubt there's much (or anything) in the printed book that is out-of-date (i.e., no longer correct), particularly given that web2py maintains backward compatibility of the API. However, there may be a few new features that are not in the printed book (and may not even be in the online book yet). To help identify newer features that may not be in the book, you can look at the change log at http://web2py.com/examples/default/changelog (link accessible from the download page). I think the printed copy of the book was up-to-date as of somewhere around version 1.81 (maybe a little later). Anthony On Sunday, April 3, 2011 3:19:57 PM UTC-4, Kevin Cole wrote: Hi, Is there a nice place to figure out what's out of date in the book? (I recently bought a copy and was assuming it was a bit more up-to-date.) I'm just beginnings of web2py, having fought with and been defeated by other frameworks. ;-) Having beat my head against this very problem I had assumed it was my problem dealing with frameworks that was the trouble. Following your example solved the trouble, thanks muchly. I'm hoping to avoid the bruises on the forehead in the future. Is there a good single source of road closed / under construction / detour ahead signs? Thanks!
[web2py] Re: web2py joins Pylons project
I have run some tests and reddit.com/r/Python pays no role in web2py popularity (positive or negative). Here are some statistics: Number of http requests: 29/Mar/2011 82379 30/Mar/2011 81757 31/Mar/2011 88105 01/Apr/2011 72613 nothing happened 02/Apr/2011 51305 Number of requests from distinct users: 29/Mar/2011 2245 30/Mar/2011 2192 31/Mar/2011 2136 01/Apr/2011 2044 02/Apr/2011 1526 Number of downloads from distinct users: 29/Mar/2011 188 30/Mar/2011 170 31/Mar/2011 162 01/Apr/2011 150 02/Apr/2011 97 These numbers are typical. Weekends are 30% down. While news posted on reddit.com/r/Python do not cause us any spike (up or down), news on the front page of reddit.com/r/Programming did cause our numbers to spike, recently. That is because the number of people who read /r/Python is very small and many accounts are probably created by the same few people. And they all seem to have made their mind (one way or another). /r/Programming has a much larger community. Massimo
[web2py] Re: IS_IN_DB no dropdown list
Ah. My misreading. You said cookbook and I read it as book. I thought you were saying your examples in your book were out of date, which seemed odd. In the immortal words of Emily Litella, Oh... Never mind... [1] 1. http://en.wikipedia.org/wiki/Emily_Litella
Re: [web2py] Re: Making my own decorator...
Thanks... that cleared some things up. :) BR, Jason On 04/03/2011 10:48 PM, Massimo Di Pierro wrote: I think you want: def is_in_conference(f): if not session.current_conference: redirect(URL('default', 'index')) return f @is_in_conference() def index(): INFO: This page takes all the various things of the conference on to one page. return dict() On Apr 3, 1:20 pm, Jason Browerencomp...@gmail.com wrote: I am making my first decorator and I want to make sure I do it right... def is_in_conference(): if not session.current_conference: redirect(URL('default', 'index')) @is_in_conference() def index(): INFO: This page takes all the various things of the conference on to one page. return dict() Is this correct? Also can I use two docorators? yes but mind that the order does matter. For example: @is_in_conference() @auth.is_logged_in() def index(): INFO: This page takes all the various things of the conference on to one page. return dict() Best Regards, Jason
[web2py] Re: PostgreSQL Error SELECT DISTINCT, ORDER BY expressions must appear in select list
Can you show us the web2py dal expression that caused the invalid query? Thanks! On Apr 3, 8:19 am, fuga fug...@gmail.com wrote: web2py generate SQL that PostgreSQL doesn't accept. For instance, SELECT DISTINCT a.id, a.uid, a.name FROM a, b WHERE a.deleted 'T') AND (a.id 0)) AND (((b.deleted 'T') AND (b.id 0)) AND (b.id = 1))) AND (b.uid = a.uid)) ORDER BY b.id, a.id LIMIT 1 OFFSET 0; It fails because select list is not contain b.id. I change gluon/dal.py(Version 1.94.5) as follows. It is work well. But I am not sure that it is a good practice. === modified file 'gluon/dal.py' Version 1.94.5 @@ -1039,2 +1039,6 @@ -- if not orderby and tablenames: - sql_o += ['%s.%s'%(t,x) for t in tablenames for x in ((hasattr(self.db[t],'_primarykey') and self.db[t]._primarykey) or [self.db[t]._id.name])] + orderby_fields = ['%s.%s'%(t,x) for t in tablenames for x in ((hasattr(self.db[t],'_primarykey') and self.db[t]._primarykey) or [self.db[t]._id.name])] + sql_o += ' ORDER BY %s' % ', '.join(orderby_fields) + for orderby_field in orderby_fields: + if orderby_field not in self._colnames: + sql_f += ', %s' % orderby_field Your opinion will be much appreciated, Cheers,
[web2py] Re: mod_wsgi + CentOS + web2py in subdirectory = possible?
There nothing wrong in principle with your configuration and we know of users who use it in a similar configurations. two things can be wrong: permissions, url rewriting. When you say it does not work, what do you see? What kind of problems do you experience? Massimo On Apr 3, 10:14 am, Alex Quinn alexanderjqu...@gmail.com wrote: I spent 6 fruitless hours yesterday trying to get Web2py working on my hosting service: a CentOS VPS running Apache 2.0.52, Python 2.7, mod_wsgi 3.3 (latest), and web2py 1.94.6 (latest stable). I need it to run in a subdirectory since I use the server for other things. After trying everything within reason and reading everything I can find, I'm rapidly coming to the conclusion that web2py just doesn't work in this configuration. If somebody can get me unstuck, I would be *very* appreciative. If there is a reason why this is impossible or if there is some needed modification to the instructions, maybe it would be good to document that in order to save others from the same frustration. I'd be happy to help with that. ERRORS SEEN: - 503 : (13)Permission denied: mod_wsgi (pid=10472): Unable to connect to WSGI daemon process 'web2py' on '/etc/httpd/logs/wsgi. 7370.102.1.sock' after multiple attempts. ... received when visitinghttp://example.com/web2py-apps/ - 403 : client denied by server configuration: /home/siteadmin/web2py/ wsgihandler.pywelcome ... received when visitinghttp://example.com/web2py-apps/welcome/default/index/ WHAT WORKS: - mod_wsgi works with a simple hello.py WSGI script. - Running web2py by running python web2py.py works. - Running web2py via wsgiref.simple_server.WSGIServer, started by my own script, works. ALREADY TRIED: - I started with the Apache configuration in the book (http://web2py.com/book/default/chapter/11#mod_wsgi) modified so that it runs in a subdirectory (i.e., /web2py-apps/ instead of /). That gave me the above errors. - Verified that mod_wsgi is getting Python 2.7. - Tried temporarily setting it to live in the server's root. Same errors. - Checked that Apache can read the directory where web2py lives. - Verified that mod_wsgi works and web2py works. I just can't make them work together. - Looked at Graham Dumpleton's blog posts and other pages about this. CONFIGURATION: WSGIPythonHome /usr/local/python/python2.7 # ... VirtualHost ###.###.###.###:80 # ... WSGIDaemonProcess web2py user=siteadmin group=siteadmingroup display- name=%{GROUP} WSGIProcessGroup web2py WSGIScriptAlias /web2py-apps/ /home/siteadmin/web2py/wsgihandler.py Directory /home/siteadmin/web2py AllowOverride None Order Allow,Deny Deny from all Files wsgihandler.py Allow from all /Files /Directory # (and also the stuff about static directories and admin panels) # ... /VirtualHost QUESTIONS: - Has anybody ever gotten web2py working in a subdirectory (i.e.,http://example.com/web2py-apps/welcome) with mod_wsgi? Some things I read while searching indicated this isn't possible without intensive customization. - Has anybody ever gotten web2py working with CentOS? Some things I read while searching indicated web2py doesn't work well with CentOS. One person changed providers for that reason. - Would mod_proxy be more fool-proof? Given the time and frustration spent trying to make it work with mod_wsgi, I am reluctant to try a totally different strategy unless there's reason to believe it would be easier. I am totally new to Web2py and I was very impressed when running locally. Right now, I'm frustrated. When I got started, it looked like this was going to be much easier. Maybe just bad luck that I happen to be on a CentOS server. I don't know. Anyway, if anybody could give me a pointer, I'd really appreciate it. If I ever get it working, I'll definitely write back with a HOWTO. Thanks, Alex
[web2py] Re: Making my own decorator...
Yes, I think a decorator is supposed to take a function (or callable) as an argument and return a callable. In general, you should be able to chain decorators. Also, I assume you don't actually want to decorate your 'index' function with your 'is_in_conference' decorator -- otherwise, it looks like it could generate an infinite loop of redirects when 'current_conference' is not in the session (because it will keep redirecting back to 'index', which will prompt another redirect via the decorator). Anthony On Sunday, April 3, 2011 3:48:05 PM UTC-4, Massimo Di Pierro wrote: I think you want: def is_in_conference(f): if not session.current_conference: redirect(URL('default', 'index')) return f @is_in_conference() def index(): INFO: This page takes all the various things of the conference on to one page. return dict() On Apr 3, 1:20 pm, Jason Brower enco...@gmail.com wrote: I am making my first decorator and I want to make sure I do it right... def is_in_conference(): if not session.current_conference: redirect(URL('default', 'index')) @is_in_conference() def index(): INFO: This page takes all the various things of the conference on to one page. return dict() Is this correct? Also can I use two docorators? yes but mind that the order does matter. For example: @is_in_conference() @auth.is_logged_in() def index(): INFO: This page takes all the various things of the conference on to one page. return dict() Best Regards, Jason
[web2py] Re: Help need on links
Thanks for your responses to my question. Like I suspected, it was the Blueprint CSS framework in my app that was the cause of the error, i.e. the print.css file. I swiped it out and my links look and act according to expectations. Thanks Pystar On Apr 2, 10:25 pm, Pystar aitoehi...@gmail.com wrote: @pbreit Links work ok in a fresh app like welcome since the CSS framework is only in the static/css folder of the app in question On Apr 2, 10:06 pm, pbreit pbreitenb...@gmail.com wrote: Seems unlikely that CSS could cause that problem. Shouldn't make a difference but you could try: {{=A('hello', _href=URL(c='default', f='index'))}} To figure out if the CSS is to blame, if you are on Chrome or Safari, right-click on the text and select Inspect Element (or use Firebug on Firefox). Finally, does that link work OK in a fresh app like welcome?
[web2py] Another beginner looking for AJAX-y help
Hi, I'm trying to design an application to manage a wine-tasting party. Each invitee can bring guests. They're in a tasters table. Each invitee and guest(s) brings a bottle of wine. The details of each wine are in a wines table. Many tasters to one wine. And finally a scores table with rows consisting of a taster ID, a wine ID and a score. (I may implement a regions table as well.) For the registration, I'd like to have a form that asks for a taster (name only) and the wine they're bringing (wine name, vintage, etc, etc). But I want a [+] icon next to the taster that adds another taster to be linked to the same wine being entered into the form... So far, I don't have much beyond a working model, listed below. Any suggestions of how to speed up my learning, assuming that I've not worked with frameworks at all and am not much of an OOP guy? (I'm working on it...) Thanks! Tables definitions below: ___ db.define_table(wines, Field(wine_entered, datetime, writable=False,readable=False, default=request.now), Field(tag, string, length=4, unique=True, required=True, notnull=True, comment=Wine Tag ID), Field(color, string, length=5, required=True, notnull=True, comment=Color (White or Red)), Field(wine, string, required=True, notnull=True, comment=Wine name), Field(varietal, string, required=True, notnull=True, comment=Varietal), Field(vintage, integer, required=True, notnull=True, comment=Year), Field(region, string, required=True, notnull=True, comment=Region (Country or State)), Field(cost, decimal(2,2), required=True, notnull=True, comment=Wine cost), Field(vintner, string, comment=Vintner), format=%(tag)s) db.wines.color.requires= [IS_IN_SET([Red, White], zero=T(Color?), error_message=T(Must be Red or White))] db.wines.vintage.requires = [IS_INT_IN_RANGE(1910, 2012)] db.wines.cost.requires = [IS_DECIMAL_IN_RANGE(0, 30)] db.define_table(tasters, Field(taster_entered, datetime, writable=False,readable=False, default=request.now), Field(taster, string, unique=True, required=True, notnull=True, comment=Taster (last name, first name)), Field(wine_id, db.wines, # required=True, notnull=True, # writable=False,readable=False, comment=Wine ID), format=%(taster)s) db.define_table(scores, Field(score_entered, datetime, writable=False,readable=False, default=request.now), Field(scorer_id, db.tasters, required=True, notnull=True, writable=False,readable=False, comment=Taster ID), Field(wine_id, db.wines, required=True, notnull=True, writable=False,readable=False, comment=Wine ID), Field(score, integer, required=True, notnull=True, comment=Score), format=%(scorer_id wine_id)s) #db.define_table(regions, #Field(region_entered, datetime, # writable=False,readable=False, # default=request.now), #Field(scope,integer, # required=True, notnull=True, # comment=Country or State), #Field(iso2,text, # required=True, notnull=True, # comment=ISO-2 abbriviation), #Field(iso3,text, # required=True, notnull=True, # comment=ISO-3 abbriviation), #Field(region, text, # required=True, notnull=True, # comment=Region name), #format=%(iso2)s) # #db.regions.scope.requires = [IS_NOT_EMPTY()] #db.regions.scope.writable = db.regions.scope.readable = False #db.regions.wine_id.writable= db.regions.wine_id.readable= False #db.regions.region_entered.writable = db.regions.region_entered.readable = False
Re: [web2py] url rewriting
*I want url rewriting not changing the default route * On 3 April 2011 18:40, Jonathan Lundell jlund...@pobox.com wrote: On Apr 3, 2011, at 9:01 AM, Shark wrote: Hello I am asking about url rewriting in web2py withGAE I want to make our site page www.site.com/init/login to www.site,com/login can you help me ? someone tell me change app,yaml others say change routers.py Change (create) routes.py (note the name). With your configuration, the default case should work fine: routers = dict( # base router BASE = dict( default_application = 'init', ), ) so I need your help Thanks -- Ahmed Sharkawy
Re: [web2py] url rewriting
Setting the default_application works really well. Would actual re-writing need to be performed by the server?
Re: [web2py] url rewriting
On Apr 3, 2011, at 2:11 PM, pbreit wrote: Setting the default_application works really well. Would actual re-writing need to be performed by the server? That will interpret / as /init/default/index, but it won't help for /login
[web2py] Another beginner looking for AJAX-y help
The tricky part is going to be the controller logic and how to process a second taster if one exists. I would suggest getting that working first with a static form. You're going to need to insert a custom ield and then do a db insert if it is populated. Then, it's just a matter of showing and hiding the field. Something like this: http://web2py.com/book/default/chapter/10#Conditional-Fields-in-Forms
Re: [web2py] url rewriting
Oh right, cuz login is going to be /user/login ?
[web2py] attention moderator
Somebody has figured out how to post spam by responding to legit posts. That means spam now comes in with legit subjects. Please check content before approving new users. Massimo
Re: [web2py] url rewriting
On Apr 3, 2011, at 2:22 PM, pbreit wrote: Oh right, cuz login is going to be /user/login ? Well, that too, but simply setting default_application (without any routing) will never suppress the application unless it's also suppressing the controller and function.
[web2py] Re: web shell says admin disabled because unable to access password file
Arbie, Is PIL pure python? i'm not sure you can use it with GAE as it is C based (i think), though GAE does provide it's own image manipulation library. for pure python packages you don't need the web shell to install them, just copy their python files to web2py/site-packages and restart GAE. you are good to go. I have not tried to use the web2py shell with GAE so i don't know how to answer that part of your question. sorry. christian
[web2py] JSON and HTTP status codes. Specifically 400s
Hi there, When I try and send JSON responses with HTTP status codes in the 400 range I get the following IE 512 byte bugfix inserted into my response. http://localhost:8000/test.json def test(): response.status = 400 d = dict() d['hello'] = 'world' return dict(object=d) {object: {hello: world}} !-- //-- Which screws up parsing the response and also makes the payload size far larger than it needs to be. Is there any way to have this removed for non html responses? Thanks in advance, Matt
[web2py] Re: JSON and HTTP status codes. Specifically 400s
fixed now in trunk, please check it. Thanks for reporting the problem On Apr 3, 5:03 pm, Matt mjwat...@gmail.com wrote: Hi there, When I try and send JSON responses with HTTP status codes in the 400 range I get the following IE 512 byte bugfix inserted into my response. http://localhost:8000/test.json def test(): response.status = 400 d = dict() d['hello'] = 'world' return dict(object=d) {object: {hello: world}} !-- xxx xxx xxx xxx xxx xxx xx //-- Which screws up parsing the response and also makes the payload size far larger than it needs to be. Is there any way to have this removed for non html responses? Thanks in advance, Matt
[web2py] Re: JSON and HTTP status codes. Specifically 400s
Thanks Massimo :) Works fine now. Matt On Apr 4, 10:30 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: fixed now in trunk, please check it. Thanks for reporting the problem On Apr 3, 5:03 pm, Matt mjwat...@gmail.com wrote: Hi there, When I try and send JSON responses with HTTP status codes in the 400 range I get the following IE 512 byte bugfix inserted into my response. http://localhost:8000/test.json def test(): response.status = 400 d = dict() d['hello'] = 'world' return dict(object=d) {object: {hello: world}} !-- xxx xxx xxx xxx xxx xxx xx //-- Which screws up parsing the response and also makes the payload size far larger than it needs to be. Is there any way to have this removed for non html responses? Thanks in advance, Matt
[web2py] Re: jquery mobile, google maps and routes.py
I was trying to get around the fact that jquery inserts the # into the url, so the correct html template is not loaded, this does not happen if you use multi page html file - oh yes, this is for a jquery mobile page. On Apr 3, 3:54 pm, Jonathan Lundell jlund...@pobox.com wrote: On Apr 3, 2011, at 4:58 AM, ChrisM wrote: update - seems to only work if you have multiple page definitions in same html file. I'd avoid using # in a URL, because a browser is likely to parse it as a fragment (anchor) identifier. On Apr 2, 1:02 pm, ChrisM cjjmur...@gmail.com wrote: i am using the examples from; I have a incoming request at http://localhost:8000/#/init/default/map_geoloc in routes.py i have: routes_in = ((r'.*:/favicon.ico', r'/examples/static/favicon.ico'), (r'.*:/robots.txt', r'/examples/static/robots.txt'), (r'.*:/#/init/default/map_geoloc', r'/init/default/ map_geoloc'), ((r'.*http://otherdomain.com.*(?Pany.*)', r'/app/ctr \gany'))) doesn't seem to work as i have a google map which will load at http://localhost:8000/init/default/map_geoloc but through a jquery link http://localhost:8000/#/init/default/map_geoloc with the additional # google map will not load, anyone else solved this one? Regards Chrism
[web2py] Field 'time' and standard time
Hello, how do I set the default time in 'time' field? ex: db.define_table('register_time', Field('name'), Field('hour', 'time', default=*???*)) obs: I do not want to use the field type 'datetime'. thanks. # --- # Bruno Barbosa # Seja livre - Use Linux!!! # http://algoritmizando.com # http://twitter.com/bruninbsb # ---
Re: [web2py] Re: jquery mobile, google maps and routes.py
On Apr 3, 2011, at 4:01 PM, ChrisM wrote: I was trying to get around the fact that jquery inserts the # into the url, so the correct html template is not loaded, this does not happen if you use multi page html file - oh yes, this is for a jquery mobile page. The hash URL never gets to the server. It's a peculiarity of the way jQuery Mobile does its page navigation. This stuff is all handled on the client side. If you're actually seeing the URL with the hash at the server, something is wrong. I think. http://jquerymobile.com/test/docs/pages/docs-navmodel.html On Apr 3, 3:54 pm, Jonathan Lundell jlund...@pobox.com wrote: On Apr 3, 2011, at 4:58 AM, ChrisM wrote: update - seems to only work if you have multiple page definitions in same html file. I'd avoid using # in a URL, because a browser is likely to parse it as a fragment (anchor) identifier. On Apr 2, 1:02 pm, ChrisM cjjmur...@gmail.com wrote: i am using the examples from; I have a incoming request at http://localhost:8000/#/init/default/map_geoloc in routes.py i have: routes_in = ((r'.*:/favicon.ico', r'/examples/static/favicon.ico'), (r'.*:/robots.txt', r'/examples/static/robots.txt'), (r'.*:/#/init/default/map_geoloc', r'/init/default/ map_geoloc'), ((r'.*http://otherdomain.com.*(?Pany.*)', r'/app/ctr \gany'))) doesn't seem to work as i have a google map which will load at http://localhost:8000/init/default/map_geoloc but through a jquery link http://localhost:8000/#/init/default/map_geoloc with the additional # google map will not load, anyone else solved this one? Regards Chrism
[web2py] Congratulations to this mailing list
I mined some data from: http://groups.google.com/group/web2py/about http://groups.google.com/group/django-users/about This web2py users group had 56,283 messages posted since 1/1/2009. The Django-users list had 51,119 over the same time period. Here is a plot showing the messages/month in the two users groups http://i.imgur.com/GHcce.png As you can see the surpass is significative and consistent since Oct 2009. Now we know why some people are upset about web2py ;-) Congratulations to all of you! Massimo
[web2py] Re: Congratulations to this mailing list
significative??? On Apr 4, 12:53 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: I mined some data from: http://groups.google.com/group/web2py/abouthttp://groups.google.com/group/django-users/about This web2py users group had 56,283 messages posted since 1/1/2009. The Django-users list had 51,119 over the same time period. Here is a plot showing the messages/month in the two users groupshttp://i.imgur.com/GHcce.png As you can see the surpass is significative and consistent since Oct 2009. Now we know why some people are upset about web2py ;-) Congratulations to all of you! Massimo
[web2py] Re: Congratulations to this mailing list
Here is another plot adding Ruby on Rails data (rubyonrails-talk) http://i.imgur.com/sPLzH.png we passed them too as messages/month since Dec 2010. According to this (http://rubyonrails.org/community) rubyonrails-talk is the main Rails list for users. Massimo On Apr 3, 7:08 pm, Anthony abasta...@gmail.com wrote: I don't have exact numbers, but over the past 11 months, I think the web2py Google Group membership has grown by over 50%. By contrast, it appears the Django Google Group membership has grown by only about 10%-15%. I guess there's a reason there were three April Fools jokes on Reddit targeting web2py. :) On Sunday, April 3, 2011 7:53:35 PM UTC-4, Massimo Di Pierro wrote: I mined some data from: http://groups.google.com/group/web2py/about http://groups.google.com/group/django-users/about This web2py users group had 56,283 messages posted since 1/1/2009. The Django-users list had 51,119 over the same time period. Here is a plot showing the messages/month in the two users groups http://i.imgur.com/GHcce.png As you can see the surpass is significative and consistent since Oct 2009. Now we know why some people are upset about web2py ;-) Congratulations to all of you! Massimo
[web2py] Re: mod_wsgi + CentOS + web2py in subdirectory = possible?
There nothing wrong in principle with your configuration and we know of users who use it in a similar configurations. Thank you for the quick reply. It is good to know that this *can* work. I saw one post elsewhere where someone said web2py *can't* be used in a subdirectory with mod_wsgi due to some issue with WSGI compliance. It was hard to believe. When you say it does not work, what do you see? What kind of problems do you experience? When I visit http://example.com/web2py-apps/ I get response 503 in the browser and the error_log says (13)Permission denied: mod_wsgi (pid=10472): Unable to connect to WSGI daemon process 'web2py' on '/ etc/httpd/logs/wsgi.7370.102.1.sock' after multiple attempts. When I visit http://example.com/web2py-apps/welcome/default/index/ I get response 403 in the browser and the error_log says client denied by server configuration: /home/siteadmin/web2py/wsgihandler.pywelcome Web2py works if I use Python's built-in WSGI server, running as the same user that apache normally runs as. Mod_wsgi works normally if I use a different script, other than web2py. The only problem is getting them to work together. Alex
Re: [web2py] Re: Congratulations to this mailing list
Congratulations! I'm really fond of the web2py framework. In fact, after having used both web2py and django, I am very biased towards web2py. I think that you simply *get* it, and you did a excellent job, and you keep on doing great work. But I think that this has to be taken with extreme caution: What does this *really* say about web2py? Most of all, beware: I think that a very big pro for django is that in stackoverflow.com there are 16k questions on Django, so this may mean that a lot of questions get answered there instead of being asked in the django mailing list. Regards, Esteban On Sun, Apr 3, 2011 at 9:16 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Here is another plot adding Ruby on Rails data (rubyonrails-talk) http://i.imgur.com/sPLzH.png we passed them too as messages/month since Dec 2010. According to this (http://rubyonrails.org/community) rubyonrails-talk is the main Rails list for users. Massimo On Apr 3, 7:08 pm, Anthony abasta...@gmail.com wrote: I don't have exact numbers, but over the past 11 months, I think the web2py Google Group membership has grown by over 50%. By contrast, it appears the Django Google Group membership has grown by only about 10%-15%. I guess there's a reason there were three April Fools jokes on Reddit targeting web2py. :) On Sunday, April 3, 2011 7:53:35 PM UTC-4, Massimo Di Pierro wrote: I mined some data from: http://groups.google.com/group/web2py/about http://groups.google.com/group/django-users/about This web2py users group had 56,283 messages posted since 1/1/2009. The Django-users list had 51,119 over the same time period. Here is a plot showing the messages/month in the two users groups http://i.imgur.com/GHcce.png As you can see the surpass is significative and consistent since Oct 2009. Now we know why some people are upset about web2py ;-) Congratulations to all of you! Massimo
[web2py] Re: mod_wsgi + CentOS + web2py in subdirectory = possible?
Have you checked out the fedora script? Not to use but to observe some of the steps and configs? This looks promising. Thanks! Until now, I didn't realize CentOS and Fedora were closely related. I'll see if there are any configurations in there that can solve this. Thank you for the tip! If I figure it out, I'll write back with a HOWTO. Are you able to get it working *not* in a sub-directory? No, it doesn't work even as the root. I only mentioned it because it's a requirement and I saw people in other forums who had problems making web2py work in a subdirectory. I looked at centos initially but went elsewhere pretty quick. Ubuntu FTW! Totally agree! I put up with CentOS because I like the provider. It's a small company with solid service (human and network) and a good deal on VPS hosting. I've used them for 11 years. Alex
[web2py] Re: Field 'time' and standard time
How about: import datetime db.define_table('register_time', Field('name'), Field('hour', 'time', default=request.now.strftime('%H')))
[web2py] fetch(http://74.125.226.80) not working
Hello, I need to fetch an IP but from gluon.tools import fetch html = fetch(http://74.125.226.80;) doesn't work. Thanks i.a.
[web2py] Re: fetch(http://74.125.226.80) not working
It works for me. Are you running on GAE? On Apr 3, 8:35 pm, ionel ionelanton...@gmail.com wrote: Hello, I need to fetch an IP but from gluon.tools import fetch html = fetch(http://74.125.226.80;) doesn't work. Thanks i.a.
[web2py] Re: fetch(http://74.125.226.80) not working
You are right. It works. It was my server. It is mis configured: http://184.82.233.163 Thanks. On Apr 3, 10:05 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: It works for me. Are you running on GAE? On Apr 3, 8:35 pm, ionel ionelanton...@gmail.com wrote: Hello, I need to fetch an IP but from gluon.tools import fetch html = fetch(http://74.125.226.80;) doesn't work. Thanks i.a.
[web2py] Re: fetch(http://74.125.226.80) not working
However, The result of http://184.82.233.163/phpbb/index.html is not the same with the result of fetch(http://184.82.233.163/phpbb/ index.html) I don't know why. On Apr 3, 10:17 pm, ionel ionelanton...@gmail.com wrote: You are right. It works. It was my server. It is mis configured:http://184.82.233.163 Thanks. On Apr 3, 10:05 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: It works for me. Are you running on GAE? On Apr 3, 8:35 pm, ionel ionelanton...@gmail.com wrote: Hello, I need to fetch an IP but from gluon.tools import fetch html = fetch(http://74.125.226.80;) doesn't work. Thanks i.a.
[web2py] a few comments on session handling
i'm making a few observations as i'm debugging my app. They might reflect my lack of understanding of how web2py works. Anyway, a few thoughts + It appears session.forget() (as mentioned numerous times in the book) should be session.forget(response). I have used session.forget() for a long time, thinking it does what I wanted it to do; it turns out that what I need is session.forget(response). If my understanding is correct on this issue, I think the book ought to be corrected !!! + I feel uneasy with the current way of session handling. This mostly has to do with functions that take longer periods of time to run. They lock up sessions. To get around this, it seems you have to forget sessions at the right place. For example: def foo(): session.forget(response) time.sleep(60) However, what this function foo does is simply sleeping. In other words, it locks up session for nothing. Clearly, session is a critical piece of data and it ought to be synchronized carefully. But I think the current policy of locking session can be improved. Instead of locking by default unless explicitly forgetting, we require locking *only if* sessions is saved/written/modified. Processes that do not modify sessions should not lock it; as did foo above, case in point. It seems currently the semaphore is placed right at the beginning of the function, even though the better thing is placing it just right before session is modified and saved. Typically, a long-running function spends its time mostly doing some computation and not touching sessions at all. There is no need for it to acquire the lock during its entire time of execution. Further, processes/functions that do not modify sessions should be allow to read sessions. I could be wrong, but I think much of these synchronization can be taken care of by storing sessions in a separate database. We can use SQLite (for example), which locks only when being written to, but allows large numbers of concurrent reads.
[web2py] Re: fetch(http://74.125.226.80) not working
What is the difference? Could be that the web server sends a different response based on something like the USER-AGENT.
[web2py] add / remove form field
hello, i want to input many data simutanously in web2py to database. did anyone knows how to add / remove form field in web2py and then input it on database? thank you so much and best regards, stifan
[web2py] router change: map_hyphen default
The default setting for map_hyphen in the parametric router has been changed from True to False in the trunk, and will show up in the next stable release. This is to make the default setting the same as having no router at all. If you're using URL hyphen mapping now, just add map_hyphen=True to the BASE router dict, and you won't see any change when you update. If you don't know what I'm talking about, you can probably ignore this message safely.
[web2py] New b2b site using web2py
Hello Everyone! I've been working on a business for some time and have finally launched it! The web server for the main app and CAS are running on appengine using the web2py framework. Please check it out and let me know what you think. The url is www.qakit.com and you can register for a free 2-person account to try it out. QAKit is the Jira Studio (http://www.atlassian.com/hosted/studio/) for early-stage startups; a fully configured and integrated suite of tools for agile development. The suite includes Bugzilla, Testopia, Dokuwiki and Generate Data. Cheers! Jim Kellas