[web2py] Re: How to set/reset administrator password (apache+wsgi+windows)
My simple way: a) stop apache server b) start web2py server in standard way by double clicking web2py.py in order that it creates its own files c) in displayed window set the admin password d) stop web2py server and check that in web2py folder there are options_std.py and parameters_8000.py e) open options_std.py and make sure of row password = 'recycle' is present f) restart apache server Now you sholuld be able to access to admin interface. If you are interested omi chiba has written a guide to setup a wamp server that supports web2py through mod_wsgi. Il giorno martedì 25 dicembre 2012 15:25:38 UTC+1, at ha scritto: Hi After setting up web2py+apache with wsgi on windows, I can see web2py admin page at http://localhost/admin/default/index. But it is asking password to log into the administrative interface. How to set a password? Is there any default password for first time entrance? Thanks AT --
[web2py] Re: How to set/reset administrator password (apache+wsgi+windows)
Il giorno martedì 25 dicembre 2012 19:41:17 UTC+1, Paolo Caruccio ha scritto: My simple way: a) stop apache server b) start web2py server in standard way by double clicking web2py.py in order that it creates its own files c) in displayed window set the admin password d) stop web2py server and check that in web2py folder there are options_std.py and parameters_8000.py e) open options_std.py and make sure of row password = 'recycle' is present f) restart apache server Now you sholuld be able to access to admin interface. If you are interested omi chiba has written a guidehttp://ochiba77.blogspot.it/2011/10/how-to-setup-web2py-apache-wsgi.htmlto setup a wamp server that supports web2py through mod_wsgi. Il giorno martedì 25 dicembre 2012 15:25:38 UTC+1, at ha scritto: Hi After setting up web2py+apache with wsgi on windows, I can see web2py admin page at http://localhost/admin/default/index. But it is asking password to log into the administrative interface. How to set a password? Is there any default password for first time entrance? Thanks AT --
[web2py] Re: Get url of uploaded file
Following code should work {{=URL('download', args=audio.filepath)}} Please read http://web2py.com/books/default/chapter/29/04#URLhttp://web2py.com/books/default/chapter/29/04#URL to learn more about URL mapping. Il giorno giovedì 27 dicembre 2012 13:03:07 UTC+1, Eduardo Costa Lopes ha scritto: Hi folks, I need to know how can I pass the url of an uploaded file. I'm using jquery media to play mp3 or flv files and the code looks like this: a class=media href={{=URL('download')}}/{{=audio.filepath}}/a and the player is rendered by: $('a.media').media( { width: 300, height: 20 } ); The script is loaded correctly, but the href value it seems to be wrong. Any ideas? Thanks, Eduardo Lopes. --
[web2py] Re: Problems with the MENU helper function and HTML5
One possible solution (not tested). 1 step) in static/js create a new file named web2py_metroui.js having the following contents jQuery(function(){ jQuery('.menuli.dropdown').each(function(){ jQuery(this).attr({'class':'','data-role':'dropdown'}); }); jQuery('.menu li li').each(function(){ if(jQuery(this).find('ul').length) jQuery(this).addClass('dropdown-submenu'); }); }); 2 step) in layout.html a) replace existing line with (note the voice menu) {{=MENU(response.menu, _class='mobile-menu nav' if is_mobile else 'nav menu' , mobile=is_mobile, li_class='dropdown', ul_class='dropdown-menu')}} b) replace this line script src={{=URL('static','js/web2py_bootstrap.js')}}/script with script src={{=URL('static','js/web2py_metroui.js')}}/script c) remove all other refererences to bootstrap. Il giorno sabato 29 dicembre 2012 16:11:29 UTC+1, Sverre ha scritto: I'm trying to write a layout plugin with the styles of http://metroui.org.ua . A problem is, that he is using custom data in the menu definitions like ul class=menu li data-role=dropdown a href=#Item 1/a ul class=dropdown-menu lia href=#SubItem/a/li ... lia href=#SubItem/a/li So either I have to extend the MENU function or I have to find a another solution. Has someone a hint? Thx in advance --
[web2py] Re: Problems with the MENU helper function and HTML5
I noted that my previous post is uncomplete. In the following the missing part: !-- The javascript = (Placed at the end of the document so the pages load faster) -- script src={{=URL('static','metroui/js/web2py_metroui.js')}}/script script src={{=URL('static','metroui/js/dropdown.js')}}/script 2) static/metroui/web2py_metroui.css This file is needed to insert your customization or to override the rules in web2py.css and in original files of framework. 3)static/metroui/css/web2py_metroui_nojs.css As #2 but applied when javascript is disabled in the browser. It's empty for metroui. 4) static/metroui/js/web2py_metroui.js In this file we will write mainly the code to add, remove, replace the html tags attributes (classes, data-* and so on) generated automatically by web2py in order to comply with selected framework requirements For example, since metroui requires the data-role attributes for the li.dropdown and the menu is generated with the MENU helper we need to write the following code: jQuery(function(){ jQuery('.menuli.dropdown').each(function(){ jQuery(this).attr({'data-role':'dropdown'}); }); }); 5) views/default/index.html {{=A(T(Administrative Interface), _href=URL('admin','default','index'),_class ='btn', becomes {{=A(T(Administrative Interface), _href=URL('admin','default','index'),_class ='button', 6) models/menu.py we need to remove the href from link, otherwise the click event to open the dropdown menu doesn't fire response.menu += [ #(SPAN('web2py', _class='highlighted'), False, 'http://web2py.com', [ (SPAN('web2py', _class='highlighted'), False, '#', [ Final notes: 1) Classes you removed (web2py-menu-expand web2py-menu-first web2py-menu-last web2py-menu-active) don't influence the metroui menu 2) metroui framework doesn't support nested submenu if I'm not missing something 3) dropdown.js (metroui file) has a small bug on line 91: $('.menul-pull') instead of $('.pull-menu') 4) attached w2p app is only demonstrative so my apologies in advance for eventual bugs you'll find Happy New Year!! Il giorno domenica 30 dicembre 2012 23:01:28 UTC+1, Paolo Caruccio ha scritto: I don't think that MENU helper is the guilty in your case. I made a metroui version of welcome app (see the images). Follows the list of involved files: 1) views/layout.html This is the main file to change if someone want apply a different html/css theme to web2py apps Each css framework has its own layout scaffold so we have to adapt our html structure. For example bootstrap menu html structure is (but the same is valid for other parts of the layout. For details please check the file in attached app): !-- Navbar == -- div class=navbar navbar-inverse navbar-fixed-top div class=flash{{=response.flash or ''}}/div div class=navbar-inner div class=container !-- the next tag is necessary for bootstrap menus, do not remove -- button type=button class=btn btn-navbar data-toggle= collapse data-target=.nav-collapse span class=icon-bar/span span class=icon-bar/span span class=icon-bar/span /button {{=response.logo or ''}} ul id=navbar class=nav pull-right{{='auth' in globals() and auth.navbar(mode=dropdown) or ''}}/ul div class=nav-collapse {{is_mobile=request.user_agent().is_mobile}} {{if response.menu:}} {{=MENU(response.menu, _class='mobile-menu nav' if is_mobile else 'nav',mobile=is_mobile,li_class='dropdown',ul_class='dropdown-menu')}} {{pass}} /div!--/.nav-collapse -- /div /div /div!--/top navbar -- with metroui the menu becomes: div class=page !-- Navbar == -- div class=nav-bar div class=nav-bar-inner padding10 span class=pull-menu/span !--{{=response.logo or ''}}-- a href=http://www.web2py.com/;span class=element brand bwebspan2/spanpy/btrade;nbsp;/span/a div class=divider/div {{is_mobile=request.user_agent().is_mobile}} {{if response.menu:}} {{=MENU(response.menu, _class='menu', mobile=False, li_class='dropdown', ul_class='dropdown-menu')}} {{pass}} /div /div /div Another important change is related to files (css, javascript) that the theme will use. So: !-- include stylesheets -- {{ response.files.append(URL('static','css/web2py.css')) response.files.append(URL('static','css/bootstrap.min.css')) response.files.append(URL('static','css/bootstrap-responsive.min.css')) response.files.append(URL('static','css/web2py_bootstrap.css')) }} ... noscriptlink href={{=URL('static', 'css/web2py_bootstrap_nojs.css')}} rel=stylesheet type
Re: [web2py] geodal
Hi Massimo, I have just tried a few examples but there is a bug in the getPoint function, please find attached a simple patch to fix it. Paolo On Monday, December 24, 2012 7:21:12 PM UTC+1, Massimo Di Pierro wrote: Thank you Denes. Would you please check my changes. I do not think I broke anything but I tried to make it so that it always returns st_astext if not specified and created Python functions to generate geoPoint/geoLine/geoPolygon. I think it makes code more readable. On Monday, 24 December 2012 12:13:39 UTC-6, DenesL wrote: The original post (Spatial / GIS support in DAL): https://groups.google.com/d/topic/web2py/feh1ksfdkGk/discussion -- diff --git a/gluon/dal.py b/gluon/dal.py index e0bf056..00db5f0 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -9736,7 +9736,7 @@ DAL.Table = Table # was necessary in gluon/globals.py session.connect # Geodal utils -def geoPoint(*line): +def geoPoint(x, y): return POINT (%f %f) % (x,y) def geoLine(*line):
Re: [web2py] geodal
Hi Massimo, I've tried the same 3 tests. The first one failed, it was working before though, the ticket: Traceback (most recent call last): File /home/paolo/Dropbox/git/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/paolo/Dropbox/git/web2py/applications/bikend/models/db.py http://127.0.0.1:8000/admin/default/edit/bikend/models/db.py, line 586, in module print db(query)._select(db.test_geo.id, db.test_geo.loc_test) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 8928, in _select return adapter._select(self.query,fields,attributes) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1478, in _select sql_f = ', '.join(map(geoexpand, fields)) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1477, in geoexpand return self.expand(field) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1312, in expand return op(first, second) TypeError: ST_ASTEXT() takes exactly 2 arguments (3 given) The other two test worked, but than the application failed raising the same ticket as the first test. Hope it helps, Paolo On Sunday, January 6, 2013 1:46:00 AM UTC+1, Massimo Di Pierro wrote: If something still fails, can you place post the result of print db(...) _select(...) On Saturday, 5 January 2013 18:45:26 UTC-6, Massimo Di Pierro wrote: I made some changes in trunk. Can you please try again? On Saturday, 5 January 2013 07:05:48 UTC-6, Paolo valleri wrote: Hi, I made a few more tests: from gluon.dal import geoPoint, geoLine, geoPolygon db.define_table('test_geo', Field('loc_test','geometry()')) db.test_geo.insert(loc_test=geoPoint(45.89096,11.0401399)) db.test_geo.insert(loc_test=geoPolygon((0,0),(150,0),(150,150),(0,150),( 0,0))) query = db.test_geo.loc_test.st_contains(geoPoint(1,1)) print db(query).select(db.test_geo.id, db.test_geo.loc_test) dist = db.test_geo.loc_test.st_distance(geoPoint(45.0,11.0)).with_alias( 'dist') print db(db.test_geo.id0).select(db.test_geo.id, dist) dist = db.test_geo.loc_test.st_distance(geoPoint(45.0,11.0)) print db(db.test_geo.id0).select(db.test_geo.id, dist) The results are the following: The first query worked The second query failed with the following error: Traceback (most recent call last): File /home/paolo/Dropbox/git/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/paolo/Dropbox/git/web2py/applications/bikend/models/db.py http://127.0.0.1:8000/admin/default/edit/bikend/models/db.py, line 589, in module print db(db.test_geo.id0).select(db.test_geo.id, dist) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 8975, in select return adapter.select(self.query,fields,attributes) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1636, in select return self._select_aux(sql,fields,attributes) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1601, in _select_aux self.execute(sql) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1714, in execute return self.log_execute(*a, **b) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1708, in log_execute ret = self.cursor.execute(*a, **b) ProgrammingError: syntax error at or near AS LINE 1: ...GeomFromText('POINT (45.00 11.00)',4326)) AS dist) F... The third one failed with the following error: Traceback (most recent call last): File /home/paolo/Dropbox/git/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/paolo/Dropbox/git/web2py/applications/bikend/models/db.py http://127.0.0.1:8000/admin/default/edit/bikend/models/db.py, line 586, in module print db(db.test_geo.id0).select(db.test_geo.id, dist) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 8975, in select return adapter.select(self.query,fields,attributes) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1636, in select return self._select_aux(sql,fields,attributes) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1601, in _select_aux self.execute(sql) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1714, in execute return self.log_execute(*a, **b) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1708, in log_execute ret = self.cursor.execute(*a, **b) ProgrammingError: function st_astext(double precision) does not exist LINE 1: SELECT test_geo.id, ST_AsText(ST_Distance(test_geospan style=color: #660;... Show original https://groups.google.com/group/web2py/msg/6ff54d463de23269?dmode=sourceoutput=gplainnoredirect --
Re: [web2py] geodal
well done! All the former tests worked. I will investigate more the others functions as soon as possible. Paolo On Sunday, January 6, 2013 4:28:13 PM UTC+1, Massimo Di Pierro wrote: One more try please. On Sunday, 6 January 2013 02:11:09 UTC-6, Paolo valleri wrote: Hi Massimo, I've tried the same 3 tests. The first one failed, it was working before though, the ticket: Traceback (most recent call last): File /home/paolo/Dropbox/git/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/paolo/Dropbox/git/web2py/applications/bikend/models/db.py http://127.0.0.1:8000/admin/default/edit/bikend/models/db.py, line 586, in module print db(query)._select(db.test_geo.id, db.test_geo.loc_test) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 8928, in _select return adapter._select(self.query,fields,attributes) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1478, in _select sql_f = ', '.join(map(geoexpand, fields)) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1477, in geoexpand return self.expand(field) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1312, in expand return op(first, second) TypeError: ST_ASTEXT() takes exactly 2 arguments (3 given) The other two test worked, but than the application failed raising the same ticket as the first test. Hope it helps, Paolo On Sunday, January 6, 2013 1:46:00 AM UTC+1, Massimo Di Pierro wrote: If something still fails, can you place post the result of print db(...) _select(...) On Saturday, 5 January 2013 18:45:26 UTC-6, Massimo Di Pierro wrote: I made some changes in trunk. Can you please try again? On Saturday, 5 January 2013 07:05:48 UTC-6, Paolo valleri wrote: Hi, I made a few more tests: from gluon.dal import geoPoint, geoLine, geoPolygon db.define_table('test_geo', Field('loc_test','geometry()')) db.test_geo.insert(loc_test=geoPoint(45.89096,11.0401399)) db.test_geo.insert(loc_test=geoPolygon((0,0),(150,0),(150,150),(0,150 ),(0,0))) query = db.test_geo.loc_test.st_contains(geoPoint(1,1)) print db(query).select(db.test_geo.id, db.test_geo.loc_test) dist = db.test_geo.loc_test.st_distance(geoPoint(45.0,11.0)). with_alias('dist') print db(db.test_geo.id0).select(db.test_geo.id, dist) dist = db.test_geo.loc_test.st_distance(geoPoint(45.0,11.0)) print db(db.test_geo.id0).select(db.test_geo.id, dist) The results are the following: The first query worked The second query failed with the following error: Traceback (most recent call last): File /home/paolo/Dropbox/git/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/paolo/Dropbox/git/web2py/applications/bikend/models/db.py http://127.0.0.1:8000/admin/default/edit/bikend/models/db.py, line 589, in module print db(db.test_geo.id0).select(db.test_geo.id, dist) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 8975, in select return adapter.select(self.query,fields,attributes) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1636, in select return self._select_aux(sql,fields,attributes) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1601, in _select_aux self.execute(sql) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1714, in execute return self.log_execute(*a, **b) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1708, in log_execute ret = self.cursor.execute(*a, **b) ProgrammingError: syntax error at or near AS LINE 1: ...GeomFromText('POINT (45.00 11.00)',4326)) AS dist) F... The third one failed with the following error: Traceback (most recent call last): File /home/paolo/Dropbox/git/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/paolo/Dropbox/git/web2py/applications/bikend/models/db.py http://127.0.0.1:8000/admin/default/edit/bikend/models/db.py, line 586, in module print db(db.test_geo.id0).select(db.test_geo.id, dist) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 8975, in select return adapter.select(self.query,fields,attributes) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1636, in select return self._select_aux(sql,fields,attributes) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1601, in _select_aux self.execute(sql) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1714, in execute return self.log_execute(*a, **b) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1708, in log_execute ret = self.cursor.execute(*a, **b) ProgrammingError: function st_astext(double precision) does not exist LINE 1: SELECT test_geo.id, ST_AsText(ST_Distance(test_geospan style=color: #660;... Show original https://groups.google.com/group/web2py/msg/6ff54d463de23269?dmode=sourceoutput=gplainnoredirect --
[web2py] self join on postgres
Hi all, I've problems on defining self join queries on postgres, the query, works on sqlite, is defined as follows: start = db.record.with_alias('start') end = db.record.with_alias('end') query = ((start.station_id == 11) (end.station_id == 12)) rows = db( query ).select(start.gathered_on,start.mac, end.gathered_on, end. mac, orderby=start.gathered_on.epoch(), left= start.on( (start.mac == end.mac) )) The table is: db.define_table('record', Field('station_id', 'reference station'), Field('log_id', 'reference log'), Field('mac'), Field('gathered_on', 'datetime'), ) The generated query is: SELECT start.gathered_on, start.mac, end.gathered_on, end.mac FROM record AS end LEFT JOIN record AS start ON (start.mac = end.mac) WHERE ((start.station_id = 11) AND (end.station_id = 12)) ORDER BY EXTRACT(epoch FROM start.gathered_on); and it fails raising the following error: Traceback (most recent call last): File /home/paolo/Dropbox/git/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/paolo/Dropbox/git/web2py/applications/vtraffic/controllers/default.py http://127.0.0.1:8000/admin/default/edit/vtraffic/controllers/default.py, line 655, in module File /home/paolo/Dropbox/git/web2py/gluon/globals.py, line 193, in lambda self._caller = lambda f: f() File /home/paolo/Dropbox/git/web2py/applications/vtraffic/controllers/default.py http://127.0.0.1:8000/admin/default/edit/vtraffic/controllers/default.py, line 37, in index left= start.on( (start.mac == end.mac) )) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 8966, in select return adapter.select(self.query,fields,attributes) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1636, in select return self._select_aux(sql,fields,attributes) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1601, in _select_aux self.execute(sql) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1714, in execute return self.log_execute(*a, **b) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1708, in log_execute ret = self.cursor.execute(*a, **b) ProgrammingError: syntax error at or near end LINE 1: SELECT start.gathered_on, start.mac, end.gathered_on, end.m... What should I have to do? Regards, Paolo --
[web2py] Re: self join on postgres
Hi Niphlod, yes it solved the problem. Now I have an other problem, I need to make a self left join, but limited to 1 match only. Namely, I've just need to make the join only for the first matching row. I've tried something like: rows = db( query ).select(start.gathered_on,start.mac,start.id, end.gathered_on, end.mac, end.id, start.gathered_on.epoch(), end.gathered_on.epoch(), orderby=start.gathered_on.epoch(), left= start.on(start.mac == end.mac), groupby=start.id, cacheable = True) This actually works on sqlite but on postgres failed because on postgres you can group only onto the field expressed in the select. Moreover, even if on sqlite it works, It select the wrong rows. Online I have found this post: http://archives.postgresql.org/pgsql-novice/2011-01/msg00069.php and now I am trying to understand how to define a sub_select with the limitby=1 to carry out the left join. Any idea ? Regards, Paolo On Monday, January 7, 2013 2:21:33 PM UTC+1, Niphlod wrote: did you try changing start and end as aliases ? while start on postgresql isn't reserved ( but is a reserved keyword for t-sql:2003 and t-sql:1999), end is reserved even for postgresql. On Monday, January 7, 2013 1:21:27 PM UTC+1, Paolo valleri wrote: Hi all, I've problems on defining self join queries on postgres, the query, works on sqlite, is defined as follows: start = db.record.with_alias('start') end = db.record.with_alias('end') query = ((start.station_id == 11) (end.station_id == 12)) rows = db( query ).select(start.gathered_on,start.mac, end.gathered_on, end.mac, orderby=start.gathered_on.epoch(), left= start.on( (start.mac == end.mac) )) The table is: db.define_table('record', Field('station_id', 'reference station'), Field('log_id', 'reference log'), Field('mac'), Field('gathered_on', 'datetime'), ) The generated query is: SELECT start.gathered_on, start.mac, end.gathered_on, end.mac FROM record AS end LEFT JOIN record AS start ON (start.mac = end.mac) WHERE ((start.station_id = 11) AND (end.station_id = 12)) ORDER BY EXTRACT(epoch FROM start.gathered_on); and it fails raising the following error: Traceback (most recent call last): File /home/paolo/Dropbox/git/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/paolo/Dropbox/git/web2py/applications/vtraffic/controllers/default.py http://127.0.0.1:8000/admin/default/edit/vtraffic/controllers/default.py, line 655, in module File /home/paolo/Dropbox/git/web2py/gluon/globals.py, line 193, in lambda self._caller = lambda f: f() File /home/paolo/Dropbox/git/web2py/applications/vtraffic/controllers/default.py http://127.0.0.1:8000/admin/default/edit/vtraffic/controllers/default.py, line 37, in index left= start.on( (start.mac == end.mac) )) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 8966, in select return adapter.select(self.query,fields,attributes) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1636, in select return self._select_aux(sql,fields,attributes) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1601, in _select_aux self.execute(sql) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1714, in execute return self.log_execute(*a, **b) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1708, in log_execute ret = self.cursor.execute(*a, **b) ProgrammingError: syntax error at or near end LINE 1: SELECT start.gathered_on, start.mac, end.gathered_on, end.m... What should I have to do? Regards, Paolo --
Re: [web2py] geodal
Hi all, I have a simple problem, how I can extract values of a single point? I found that there are the functions ST_X, and ST_Y. Please find attached a patch that add them to dal and to the postgres adapter, I haven't put them neither to MSSQLAdapter nor to SQLITESpatiaLiteAdapter because I don't have those db to run tests. Now you can do something like: print db(db.city).select(db.city.latlng, db.city.latlng.st_x(), db.city.latlng.st_y()) city.latlng,ST_X(city.latlng),ST_Y(city.latlng) POINT(51.507335 -0.127683),51.507335,-0.127683 POINT(41.901514 12.460774),41.901514,12.460774 POINT(40.851775 14.268124),40.851775,14.268124 The geometry field MUST contain only point otherwise it raises an error. Hope it helps Paolo On Sunday, January 6, 2013 5:29:52 PM UTC+1, Paolo valleri wrote: Hi Massimo, I found an other strange behavior. I tried to capitalize the name of a field, as follows: db.define_table('test_geo', Field('loc_Test','geometry()'), ) and I get this error: Traceback (most recent call last): File /home/paolo/Dropbox/git/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/paolo/Dropbox/git/web2py/applications/bikend/models/db.py http://127.0.0.1:8000/admin/default/edit/bikend/models/db.py, line 585, in module db.test_geo.insert(loc_Test=geoPoint(45.89096,11.0401399)) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 7977, in insert ret = self._db._adapter.insert(self,self._listify(fields)) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1175, in insert raise e ProgrammingError: column loc_test of relation test_geo does not exist LINE 1: INSERT INTO test_geo(loc_Test) VALUES (ST_GeomFromText('POIN... and so I tried to insert without the capitalize and I get this error: Traceback (most recent call last): File /home/paolo/Dropbox/git/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/paolo/Dropbox/git/web2py/applications/bikend/models/db.py http://127.0.0.1:8000/admin/default/edit/bikend/models/db.py, line 585, in module db.test_geo.insert(loc_test=geoPoint(45.89096,11.0401399)) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 7977, in insert ret = self._db._adapter.insert(self,self._listify(fields)) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 7915, in _listify 'Field %s does not belong to the table' % name) SyntaxError: Field loc_test does not belong to the table finally, I redefined the table as was before, (without any capital latter) and I get this: Traceback (most recent call last): File /home/paolo/Dropbox/git/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/paolo/Dropbox/git/web2py/applications/bikend/models/db.py http://127.0.0.1:8000/admin/default/edit/bikend/models/db.py, line 583, in module db.test_geo.insert(Name='paolo') File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 7313, in __getattr__ return self.lazy_define_table(tablename,*fields,**args) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 7281, in lazy_define_table polymodel=polymodel) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 965, in create_table fake_migrate=fake_migrate) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1068, in migrate_table self.execute(sub_query) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1714, in execute return self.log_execute(*a, **b) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1708, in log_execute ret = self.cursor.execute(*a, **b) ProgrammingError: syntax error at or near SELECT LINE 1: ALTER TABLE test_geo ADD loc_test__tmp SELECT AddGeometryCol... Hope it helps, Paolo I changed the name of the field: On Sunday, January 6, 2013 5:01:32 PM UTC+1, Paolo valleri wrote: well done! All the former tests worked. I will investigate more the others functions as soon as possible. Paolo On Sunday, January 6, 2013 4:28:13 PM UTC+1, Massimo Di Pierro wrote: One more try please. On Sunday, 6 January 2013 02:11:09 UTC-6, Paolo valleri wrote: Hi Massimo, I've tried the same 3 tests. The first one failed, it was working before though, the ticket: Traceback (most recent call last): File /home/paolo/Dropbox/git/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/paolo/Dropbox/git/web2py/applications/bikend/models/db.py http://127.0.0.1:8000/admin/default/edit/bikend/models/db.py, line 586, in module print db(query)._select(db.test_geo.id, db.test_geo.loc_test) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 8928, in _select return adapter._select(self.query,fields,attributes) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1478, in _select sql_f = ', '.join
Re: [web2py] geodal
Hi Massimo, good to know that the patch is in trunk but I it is only for the postgres adapter, I can try to define the same functions for the other adapter but then someone has to check if they works or not. For what concern the other issue I will open I ticket, the main problem is that web2py makes all the common fields name lower while it store the 'gis' fields as is. I have just tried this: db.define_table('test_geo1_name', Field('name_P', 'string'), Field('location_P','geometry()'), ) In the db I have the field *name_p* and *location_P* respectively. To fix it, I added in dal.py .lower() at line 832: ftype = ftype % dict(schema=schema, tablename=tablename, fieldname=field_name.lower(), srid=srid, dimension=dimension) And now in the db I have the field *name_p* and *location_p* respectively Paolo On Tuesday, January 8, 2013 3:48:56 PM UTC+1, Massimo Di Pierro wrote: In trunk. How about the previous issue? Is that still open? If so, can you please open a ticket? Thanks. On Tuesday, 8 January 2013 05:31:28 UTC-6, Paolo valleri wrote: Hi all, I have a simple problem, how I can extract values of a single point? I found that there are the functions ST_X, and ST_Y. Please find attached a patch that add them to dal and to the postgres adapter, I haven't put them neither to MSSQLAdapter nor to SQLITESpatiaLiteAdapter because I don't have those db to run tests. Now you can do something like: print db(db.city).select(db.city.latlng, db.city.latlng.st_x(), db.city.latlng.st_y()) city.latlng,ST_X(city.latlng),ST_Y(city.latlng) POINT(51.507335 -0.127683),51.507335,-0.127683 POINT(41.901514 12.460774),41.901514,12.460774 POINT(40.851775 14.268124),40.851775,14.268124 The geometry field MUST contain only point otherwise it raises an error. Hope it helps Paolo On Sunday, January 6, 2013 5:29:52 PM UTC+1, Paolo valleri wrote: Hi Massimo, I found an other strange behavior. I tried to capitalize the name of a field, as follows: db.define_table('test_geo', Field('loc_Test','geometry()'), ) and I get this error: Traceback (most recent call last): File /home/paolo/Dropbox/git/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/paolo/Dropbox/git/web2py/applications/bikend/models/db.py http://127.0.0.1:8000/admin/default/edit/bikend/models/db.py, line 585, in module db.test_geo.insert(loc_Test=geoPoint(45.89096,11.0401399)) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 7977, in insert ret = self._db._adapter.insert(self,self._listify(fields)) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1175, in insert raise e ProgrammingError: column loc_test of relation test_geo does not exist LINE 1: INSERT INTO test_geo(loc_Test) VALUES (ST_GeomFromText('POIN... and so I tried to insert without the capitalize and I get this error: Traceback (most recent call last): File /home/paolo/Dropbox/git/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/paolo/Dropbox/git/web2py/applications/bikend/models/db.py http://127.0.0.1:8000/admin/default/edit/bikend/models/db.py, line 585, in module db.test_geo.insert(loc_test=geoPoint(45.89096,11.0401399)) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 7977, in insert ret = self._db._adapter.insert(self,self._listify(fields)) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 7915, in _listify 'Field %s does not belong to the table' % name) SyntaxError: Field loc_test does not belong to the table finally, I redefined the table as was before, (without any capital latter) and I get this: Traceback (most recent call last): File /home/paolo/Dropbox/git/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/paolo/Dropbox/git/web2py/applications/bikend/models/db.py http://127.0.0.1:8000/admin/default/edit/bikend/models/db.py, line 583, in module db.test_geo.insert(Name='paolo') File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 7313, in __getattr__ return self.lazy_define_table(tablename,*fields,**args) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 7281, in lazy_define_table polymodel=polymodel) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 965, in create_table fake_migrate=fake_migrate) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1068, in migrate_table self.execute(sub_query) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1714, in execute return self.log_execute(*a, **b) File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1708, in log_execute ret = self.cursor.execute(*a, **b) ProgrammingError: syntax error at or near SELECT LINE 1: ALTER TABLE test_geo ADD
[web2py] Re: external link in menu with target option
While waiting web2py developers solve the issue, you could simply comment the line in web2py_bootstrap.js and see if all works as expected. In javascript a code line is commented when you put before it //, so the interested line becomes: // jQuery('ul.nav li.dropdown a').click(function(){window.location=jQuery(this).attr('href');}); Il giorno venerdì 11 gennaio 2013 16:36:47 UTC+1, Wes Hall ha scritto: Along these same lines: response.menu += [ (T('External Sites',), False, A('Web2Py', _href=http://web2py.com/,_target =_blank), []), ] Gives the expected result of a new tab/window However, the following loads the link in both the current tab/window as well as the new one. response.menu += [ (SPAN('External Sites', _class='highlighted'), False, '#', [ ('', False, A('Web2Py', _href=http://web2py.com/;, _target= _blank),[]), ]) ] It looks like line #25 from web2py_bootstrap.js is forcing dropdowns to load in the current window regardless of any target. jQuery('ul.nav li.dropdown a').click(function(){window.location=jQuery( this).attr('href');}); I don't know js well enough to suggest a change. Am I at least looking in the right place? On Monday, June 25, 2012 9:31:35 AM UTC-4, Anthony wrote: You can control exactly what goes inside the li for a given menu item by making the third element of that item a web2py HTML helper instead of just a URL. So, instead of: ('External Link', False, 'http://somesite.com') You can do: ('', False, A('External Link', _href='http://somesite.com', _target= '_blank')) Anthony On Monday, June 25, 2012 9:06:20 AM UTC-4, Manuele wrote: What if I want to put a voice in the menu that link a page external to my application that I want to open in a new tab? thanks in advance Manuele --
Re: [web2py] Set up of db.py takes too long time
Try to add lazy_tables=True to DAL. Like: db = DAL('sqlite://storage.sqlite', migrate=False, lazy_tables=True) Paolo On Tuesday, January 15, 2013 10:06:03 AM UTC+1, Daniel Gonzalez wrote: No imports in the code-area profiled. Also, I am testing some requests, but the time I am measuring is the time spent in the code-area that I have provided. That is, in the define tables code. The controllers are of course making use of the table definitions later, but that is not what I am measuring. I have put a print time.time() before and after the define tables code. So no controller is involved in my measurements. On Tuesday, January 15, 2013 9:56:57 AM UTC+1, rochacbruno wrote: It will run only when called! But if he is testing a form, the problem maybe there. There are some imports? --
[web2py] Re: Auth with migrate=False
is on the db definition. db = DAL('postgres://web2py:web2py@localhost:5432/traffic', migrate=False, lazy_tables=True, ) Paolo On Tuesday, January 15, 2013 11:38:49 AM UTC+1, Niphlod wrote: migrate=False is on the db or on Auth define_table() call ? Il giorno martedì 15 gennaio 2013 11:07:49 UTC+1, Paolo valleri ha scritto: Hi all, I tried something odd. I pulled a fresh copy of my code from git and I connected the app to an already 'working' database. 'working' in the meaning that both tables and data are already in the database. In web2py this approach fails, because at the first run it tries to create all the tables, and the db raises an exception like 'table already exist'. In order to fix that I thought that migrate=False would help, however it fails again. due to Auth that tries to create the tables. Ticket: Traceback (most recent call last): File /home/pvalleri/src/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/pvalleri/src/web2py/applications/vtraffic/controllers/default.py http://127.0.0.1:8000/admin/default/edit/vtraffic/controllers/default.py, line 6, in module start = db.record.with_alias('start_point') File /home/pvalleri/src/web2py/gluon/dal.py, line 7221, in __getattr__ return self.lazy_define_table(tablename,*fields,**args) File /home/pvalleri/src/web2py/gluon/dal.py, line 7174, in lazy_define_table table = table_class(self, tablename, *fields, **args) File /home/pvalleri/src/web2py/gluon/dal.py, line 7594, in __init__ field.requires = sqlhtml_validators(field) File /home/pvalleri/src/web2py/gluon/dal.py, line 6338, in sqlhtml_validators referenced = db[field_type[10:]] File /home/pvalleri/src/web2py/gluon/dal.py, line 7215, in __getitem__ return self.__getattr__(str(key)) File /home/pvalleri/src/web2py/gluon/dal.py, line 7221, in __getattr__ return self.lazy_define_table(tablename,*fields,**args) File /home/pvalleri/src/web2py/gluon/dal.py, line 7177, in lazy_define_table table._create_references() # must follow above line to handle self references File /home/pvalleri/src/web2py/gluon/dal.py, line 7663, in _create_references rtable = db[rtablename] File /home/pvalleri/src/web2py/gluon/dal.py, line 7215, in __getitem__ return self.__getattr__(str(key)) File /home/pvalleri/src/web2py/gluon/dal.py, line 7221, in __getattr__ return self.lazy_define_table(tablename,*fields,**args) File /home/pvalleri/src/web2py/gluon/dal.py, line 7189, in lazy_define_table polymodel=polymodel) File /home/pvalleri/src/web2py/gluon/dal.py, line 935, in create_table self.create_sequence_and_triggers(query,table) File /home/pvalleri/src/web2py/gluon/dal.py, line 2483, in create_sequence_and_triggers self.execute(query) File /home/pvalleri/src/web2py/gluon/dal.py, line 1709, in execute return self.log_execute(*a, **b) File /home/pvalleri/src/web2py/gluon/dal.py, line 1703, in log_execute ret = self.cursor.execute(*a, **b) File /home/pvalleri/src/web2py/gluon/contrib/pg8000/dbapi.py, line 246, in _fn return fn(self, *args, **kwargs) File /home/pvalleri/src/web2py/gluon/contrib/pg8000/dbapi.py, line 317, in execute self._execute(operation, args) File /home/pvalleri/src/web2py/gluon/contrib/pg8000/dbapi.py, line 322, in _execute self.cursor.execute(new_query, *new_args) File /home/pvalleri/src/web2py/gluon/contrib/pg8000/interface.py, line 399, in execute self._stmt.execute(*args, **kwargs) File /home/pvalleri/src/web2py/gluon/contrib/pg8000/interface.py, line 169, in execute self._row_desc, cmd = self.c.bind(self._portal_name, self._statement_name, args, self._parse_row_desc, kwargs.get(stream)) File /home/pvalleri/src/web2py/gluon/contrib/pg8000/protocol.py, line 943, in _fn return fn(self, *argsspan style=color: #660; class=styled-by... Mostra originale https://groups.google.com/group/web2py/msg/64de6b8ababbd2a3?dmode=sourceoutput=gplainnoredirect --
Re: [web2py] Re: Auth with migrate=False
I am using lazy_tables=True at DAL definition, actually I don't know how to enable lazy_table for auth. Does it exist? As I can see, auth.define_tables doesn't take any lazy_table parameter, moreover in my code I have a few lines of auth.settings.* which needs auth. To customize my own tables without forcing their creation I am using the on_define function, as shown in the example below: db.define_table('answers', Field('question_id', db.questions), Field('route_id', db.route), Field('description', 'text' ), auth.signature, on_define = lambda table: [ table.route_id.set_attributes(readable = False, writable = False), ] ) Paolo On Tuesday, January 15, 2013 3:10:32 PM UTC+1, Anthony wrote: Good point. Even better, use lazy_tables. You should also compile the app. On Tuesday, January 15, 2013 8:11:48 AM UTC-5, Paolo valleri wrote: Thanks for clarifying it. So that, to speed up web2py, we must use migrate_enabled=False instead of migrate=False at DAL definition. Otherwise for all the auth_* tables, web2py will access the disk to verify if the relative file in databases/hash_tablename.table exists and is updated, right? If what I have said is correct I would suggest to update the book, http://web2py.com/books/default/chapter/29/13#Efficiency-tricks changing migrate=False with migrate_enabled=False Paolo 2013/1/15 Anthony abas...@gmail.com DAL(..., migrate=False) does not completely turn off migrations but merely sets the default migrate value for each table to False if it is not set explicitly. The auth.define_tables() method, however, explicitly sets migrate to True for each Auth table unless otherwise specified, so you would have to do auth.define_tables(..., migrate=False). Another option is to completely disable all migrations, regardless of individual table settings, via: DAL(..., migrate_enabled=False) Anthony On Tuesday, January 15, 2013 7:35:14 AM UTC-5, Paolo valleri wrote: is on the db definition. db = DAL('postgres://web2py:web2py@**localhost:5432/traffic', migrate=False, lazy_tables=True, ) Paolo On Tuesday, January 15, 2013 11:38:49 AM UTC+1, Niphlod wrote: migrate=False is on the db or on Auth define_table() call ? Il giorno martedì 15 gennaio 2013 11:07:49 UTC+1, Paolo valleri ha scritto: Hi all, I tried something odd. I pulled a fresh copy of my code from git and I connected the app to an already 'working' database. 'working' in the meaning that both tables and data are already in the database. In web2py this approach fails, because at the first run it tries to create all the tables, and the db raises an exception like 'table already exist'. In order to fix that I thought that migrate=False would help, however it fails again. due to Auth that tries to create the tables. Ticket: Traceback (most recent call last): File /home/pvalleri/src/web2py/**gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/pvalleri/src/web2py/**applications/vtraffic/**controllers/default.py http://127.0.0.1:8000/admin/default/edit/vtraffic/controllers/default.py, line 6, in module start = db.record.with_alias('start_**point') File /home/pvalleri/src/web2py/**gluon/dal.py, line 7221, in __getattr__ return self.lazy_define_table(tablena**me,*fields,**args) File /home/pvalleri/src/web2py/**gluon/dal.py, line 7174, in lazy_define_table table = table_class(self, tablename, *fields, **args) File /home/pvalleri/src/web2py/**gluon/dal.py, line 7594, in __init__ field.requires = sqlhtml_validators(field) File /home/pvalleri/src/web2py/**gluon/dal.py, line 6338, in sqlhtml_validators referenced = db[field_type[10:]] File /home/pvalleri/src/web2py/**gluon/dal.py, line 7215, in __getitem__ return self.__getattr__(str(key)) File /home/pvalleri/src/web2py/**gluon/dal.py, line 7221, in __getattr__ return self.lazy_define_table(tablena**me,*fields,**args) File /home/pvalleri/src/web2py/**gluon/dal.py, line 7177, in lazy_define_table table._create_references() # must follow above line to handle self references File /home/pvalleri/src/web2py/**gluon/dal.py, line 7663, in _create_references rtable = db[rtablename] File /home/pvalleri/src/web2py/**gluon/dal.py, line 7215, in __getitem__ return self.__getattr__(str(key)) File /home/pvalleri/src/web2py/**gluon/dal.py, line 7221, in __getattr__ return self.lazy_define_table(tablena**me,*fields,**args) File /home/pvalleri/src/web2py/**gluon/dal.py, line 7189, in lazy_define_table polymodel=polymodel) File /home/pvalleri/src/web2py/**gluon/dal.py, line 935, in create_table self.create_sequence_and_**triggers(query,table) File /home/pvalleri/src/web2py/**gluon/dal.py, line 2483, in create_sequence_and_triggers self.execute(query
[web2py] auth.wiki menu
Hi all, I started using the wiki. I created my pages, and I edited the wiki-menu page as I like. Now I want to have response.menu populated with the wiki pages too in every page I have, is there a way to populate it calling somehow auth.wiki or I have to do that by hand, updating each time menu.py? Thanks, Paolo --
[web2py] Re: How experimental is postgis?
Hi, I've tried few examples in last weeks. Gis support is getting better, I don't think is far from being stable but right now I don't have the possibility to say it is stable, i.e., a few functions are available only for postgis (i.e., st_x, st_y). Moreover the errors I found have been fixed, I suggest you to read more here: https://groups.google.com/d/topic/web2py/6DDLVv4jt0w/discussion right now it is not clear if web2py is going to support only gis 2d or more ( I like 3d). I need 3d, not only to define 3d points (which somehow can be defined as 2d more an other field for the elevation) but also to define 3d polylines. The 2d doesn't work with 3d, the 3d works well with 3d and 2d. The only problem is that the 3d is not backward compatible with existing 2d objects. @Massimo, how would you go with that? Paolo On Thursday, January 17, 2013 10:47:59 AM UTC+1, encompass wrote: I am hoping to use it in an upcoming application. Does anyone here have issues with this that still need to be resolved? BR, Jason --
[web2py] Re: How do you change memcache session expiry?
Hi all, I have just tried the solution proposed on the issue but it doen't work. This is a really annoying bug not only because I have to login several times in a day but also because I can lose my edits if I don't save my changes in time (i.e, editing a wiki page). It might be better to remove from the book the advise of storing the session in memcached unless we find a solution Paolo Il giorno domenica 30 settembre 2012 00:54:03 UTC+2, Robert Clark ha scritto: Thanks everyone, have added an issue http://code.google.com/p/web2py/issues/detail?id=1049 On Sunday, September 30, 2012 3:51:10 AM UTC+13, Massimo Di Pierro wrote: It also looks to me memdb should not be implemented as it is. It should be implemented as a plugin_adapter for DAL. On Saturday, 29 September 2012 09:50:37 UTC-5, Massimo Di Pierro wrote: I would prefer the syntax: session.connect(request, response, db=MEMDB(cache.memcache, session_expiry=3600)) On Saturday, 29 September 2012 07:11:10 UTC-5, Niphlod wrote: yep, open a bug on http://code.google.com/p/web2py/issues/list On Saturday, September 29, 2012 5:24:07 AM UTC+2, Robert Clark wrote: Thanks, I am not having any problems with the memcached api python interface, that part all works as advertised. The problem is that if you follow the deployment recipe for storing sessions in Memcached, then they always expire after 300s and there's no way to provide an expiry. Here's what's the code from deployment recipe chapter of web2py book: from gluon.contrib.memcache import MemcacheClientmemcache_servers = ['127.0.0.1:11211'] cache.memcache = MemcacheClient(request, memcache_servers) cache.ram = cache.disk = cache.memcache ..and.. from gluon.contrib.memdb import MEMDB session.connect(request,response,db=MEMDB(cache.memcache)) If you do this and connect to memcached with e.g. -vv you can see that session data is passed in with 300s expiry. I may be missing something obvious. Can I suggest altering the API to be something like this: session.connect(request, response, db=MEMDB(cache.memcache), session_expiry=3600) Thanks! On Saturday, September 29, 2012 12:27:55 AM UTC+12, Jose C wrote: The only way I've found to change this is to explicitly modify the default value from this source file. Is there a better way to configure this value for session expiry from within application code? Cheers. Far as I know it's done like this: set(key=key, value=value, time=seconds) where (from the source): @param time: Tells memcached the time which this value should expire,either as a delta number of seconds, or an absolute unix time-since- the-epoch value. See the memcached protocol docs section Storage Commands for more info on exptime. We default to 0 == cache forever. Are you saying that doesn't work? --
[web2py] problems with wiki create
Hi all, I've just updated web2py to trunk and it seems that wiki _create is broken. I got this ticket: Traceback (most recent call last): File /home/paolo/Dropbox/git/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/paolo/Dropbox/git/web2py/applications/vtraffic/controllers/default.py http://127.0.0.1:8000/admin/default/edit/vtraffic/controllers/default.py, line 399, in module File /home/paolo/Dropbox/git/web2py/gluon/globals.py, line 193, in lambda self._caller = lambda f: f() File /home/paolo/Dropbox/git/web2py/applications/vtraffic/controllers/default.py http://127.0.0.1:8000/admin/default/edit/vtraffic/controllers/default.py, line 18, in wiki return auth.wiki(render='html') File /home/paolo/Dropbox/git/web2py/gluon/tools.py, line 3344, in wiki wiki = self._wiki() File /home/paolo/Dropbox/git/web2py/gluon/tools.py, line 4903, in __call__ return self.create() File /home/paolo/Dropbox/git/web2py/gluon/tools.py, line 5093, in create '%(slug)s')), File /home/paolo/Dropbox/git/web2py/gluon/validators.py, line 464, in __init__ (ktable, kfield) = str(field).split('.') ValueError: need more than 1 value to unpack I moved back to 2.3.2 and my app worked well. I've tried truck with the welcome app adding the following code: def wiki(): return auth.wiki(render='html') and I got the same error. What's wrong? Paolo --
[web2py] Re: SQLFORM.factory and uploaded files. where is the link?
add upload=URL('default', 'download') should solve the problem. Paolo On Thursday, January 24, 2013 12:11:33 AM UTC+1, Ramos wrote: Hello I dont know how to show the link to the uploaded files using SQLFORM.factory my code form=SQLFORM.factory(db.trabalhador,db.t_docs, submit_button=Gravar, fields=['nome','bi','ncart','ncartval','apt_medica','apt_medicaval','val_formacao','f_doc'], table_name='trabalhador') and in my view on of the fields apt_medica is an upload type field. It does not show the link to get the file. How to show it? Thank you --
[web2py] auth.wiki how to format all fields
Dear all, I've just came across the fact that with the following code: def wiki(): return auth.wiki(render='html') and visiting something like app/controller/wiki/about in the view I will get only the 'content' field without any other useful wiki's field such as Title, modified_on just to name a few. Checking the code, I figured out that the problem is due to the test: extension==html (see tools.py:5090) Could we return the other fields too? Paolo --
Re: [web2py] Re: new setup-web2py-nginx-uwsgi-ubuntu.sh
I am using memcached for caching cache.ram and cache.disk, the configuration is really easy, this is mine: if not request.is_local: from gluon.contrib.memcache import MemcacheClient memcache_servers = ['127.0.0.1:11211'] cache.memcache = MemcacheClient(request, memcache_servers) cache.ram = cache.disk = cache.memcache but I don't know how to understand the gain of using it. Any idea? paolo On Friday, January 25, 2013 9:51:22 PM UTC+1, Arnon Marcus wrote: Oh, and what about memcache? Can web2py benefit from it? Is there somewhere an explanation about this? On Fri, Jan 25, 2013 at 12:48 PM, Arnon Marcus a.m.m...@gmail.comjavascript: wrote: 10x for clearing things out - you're right, I didn't do too much resource on uwsgi, and just assumed that it is, for nginx. what mod_wsgi is for apache. So I guess I had it wrong. My current (soon to be old) setup is running apache + mod_wsgi on windows 7, so I know all about the headaches that comes from setting this up... I would be more than glad to put apache behind me for good, if it would offer not performance improvements to this script's setup the way it does for php... On that note, how exactly is uwsgi handling web2py processes, as would be configured in this script? Is it easily customizable after the fact? Are there any any pros/cons for different scenarios that one should be aware of? On Fri, Jan 25, 2013 at 12:21 PM, Niphlod nip...@gmail.com javascript: wrote: seems you missed a point uwsgi here is not a module, is an executable that does one job and it does it well (actually, very well, and there's a lot of it that can be used that is outside the scope of this script). It could be used as a standalone highperformance webserver, but nginx is placed in front of it to serve static files and to take care of Ddos attacks. If you want to use apache behind nginx instead of uwsgi behind nginx you're going basically to suffer wasted cpu, ram, a much harder to maintain config. If you want to run python on apache because it's your default webserver, than mod_wsgi is the way to go. Have to install apache just to run python, it's only a waste of resources. -- --
[web2py] Re: auth.wiki how to format all fields
to keep track of that, I have opened an issue http://code.google.com/p/web2py/issues/detail?id=1303 On Friday, January 25, 2013 3:32:55 PM UTC+1, Paolo valleri wrote: Dear all, I've just came across the fact that with the following code: def wiki(): return auth.wiki(render='html') and visiting something like app/controller/wiki/about in the view I will get only the 'content' field without any other useful wiki's field such as Title, modified_on just to name a few. Checking the code, I figured out that the problem is due to the test: extension==html (see tools.py:5090) Could we return the other fields too? Paolo --
[web2py] Re: auth.wiki how to format all fields
Hi Massimo, the point is that, if I define the following code in a controller: def wiki(): return auth.wiki(render='html') In the corresponding view I will have only the 'content' field. As a result I will be able to format the wiki page by its content only no other fields can be retrieved; in order to 'format' better the wiki page, it would be nice to have at least information such as the fields title and modified_on. paolo On Sunday, January 27, 2013 4:56:51 PM UTC+1, Massimo Di Pierro wrote: I do not fully understand the issue. Can you post more code as an example? On Friday, 25 January 2013 08:32:55 UTC-6, Paolo valleri wrote: Dear all, I've just came across the fact that with the following code: def wiki(): return auth.wiki(render='html') and visiting something like app/controller/wiki/about in the view I will get only the 'content' field without any other useful wiki's field such as Title, modified_on just to name a few. Checking the code, I figured out that the problem is due to the test: extension==html (see tools.py:5090) Could we return the other fields too? Paolo --
[web2py] Re: Howto Multi file uploader
I don't think you will find something out-of-the-box. However, I advice you to start from here: http://malsup.com/jquery/form/ On Wednesday, January 30, 2013 10:48:57 AM UTC+1, Ramos wrote: Hello, what is the best way to add multi file upload functionality. This is very important for me. I have many apps that can be converted to web2py but i have a lot of fields that need to upload multiple files. I want to use it inside company in a lot of colaborative apps. I would love to see this functionality out of the box in web2py. Thank you António -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: contribute: db diagram for web2py appadmin
first post updated: replaced following files db_diagram.html corrected CDN links. Now the diagram works on https too db_diagram.py [please note that you must copy the code within this file and paste at the bottom of web2py_app/controllers/appadmin.py] deleted a print statement Il giorno mercoledì 30 gennaio 2013 17:23:21 UTC+1, Paolo Caruccio ha scritto: I was not able to succesfully install pygraphviz on my windows7 64bit enviroment but I liked Jose's idea https://groups.google.com/d/topic/web2py/cFqD1M6rkc8/discussion, so I wrote a simple addendum to appadmin in order to show a graph representation of a database. It's not alternative to or a replacement of Jose's graph layout because there are substantial differences. db diagram is interactive (nodes are draggable and clickable) but you cannot save it as an image (anyway it's possible to use a third party application for screenshoots). Moreover it is customizable via css (you will find here attached a css theme for reference) and it's based on jqueryUI framewok. The nodes contain only the table name, so we can draw the layout of a database with (moderately) numerous tables. In order to see table data you have to click on the node. I added some infos like indexed columns (currently available only for sqlite but I think it's not hard to implement for other database engines), the list of other affected tables when we delete a row in cascade mode. The layout (the position of nodes on the screen) is generated trough a force-directed spring algorythm. Therefore the layout is generated dinamically and it will be different each time you refresh the page. For this scope, I adapted and translated to jQuery the original prototype source code freely distributed under the terms of a MIT-style license from http://snipplr.com/view/1950/graph-javascript-framework-version-001/ For a jquery version of this original source code you could visit http://www.graphdracula.net/ The edges are drawn by jsPlumb library ( http://www.jsplumb.org/jquery/demo.html ). All 1.x.x versions of jsPlumb are dual-licensed under both MIT and GPL version 2. Current main limitation: the database must have 'db' key in application databases dictionary. In other words in our model we must have db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all']) and not, for example, mydb = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all']) The screen dimensions are important too: the layout will be messed on small screens. The code has been tested on latest versions of Firefox, Chrome, Opera, IE(7,8,9) and on a very limited number of databases. So please check for errors and bugs. Installation: 1) append the code within in the attached db_diagram.py in your_application/controllers/appadmin.py file 2) put attached db_diagram.html in to your_application/views folder 3) create a new folder in your_application/static folder and name it db_diagram 4) in to latter put db_diagram.css, db_diagram_print.css, jquery.dbdiagram.js, pencildiagonals.png (an image create by me only for the css theme in bundle) (all these files are here attached) 5) download jsPlumb (jQuery release) from http://code.google.com/p/jsplumb/downloads/list and put jquery.jsPlumb-1.3.16-all-min.js file in your_application/static/db_diagram folder Usage: In your appadmin page you should see a new menu item diagram (see image 1), click on it and you should see the layout of your db. That's all Folks! -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] wiki: how to cache media files?
Hi all, today I discovered that wiki media, actually they are all images, they are always requested to the server and never cached by the client. In other words, even if I have already visited the page I do a get to download all the images instead of using those in the browser cache as commonly happens with for js or css. Is it a problem of my configuration or of wiki it self? paolo -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: contribute: db diagram for web2py appadmin
Absolutly not, you are free to do what do you want. Only one note. The db_diagram.css file is not optimized because it is a reference for the users which would like customize the theme. Il giorno venerdì 1 febbraio 2013 17:31:50 UTC+1, Massimo Di Pierro ha scritto: Would you be opposed to turn this into an admin plugin and allow appadmin to access it? On Wednesday, 30 January 2013 15:04:06 UTC-6, Paolo Caruccio wrote: Massimo, thanks for the compliments and for the suggestions. Actually, in my mind the posted code is a sort of appadmin plugin. For this reason I separated db diagram static files from web2py ones. About the 'db' limitation, it's due to lack of time for testing. I'm attaching a w2p application (modified hotel management appliance) to show better how it works. Il giorno mercoledì 30 gennaio 2013 19:55:53 UTC+1, Massimo Di Pierro ha scritto: This is really nice. How about we move all the static files and the view into admin and he have the db_diagram.py code in appadmin just include form admin? we can do that easily. you can do dbs = [db in globals().values() if isinstance(db.DAL)] to get databases. There is a more efficient way: from gluon.dal import THREAD_LOCA mdbs = getattr(THREAD_LOCAL,'db_instances',{}).items() dbs = [] for db_uid, db_group in mdbs: dbs += [db for db in db_group] On Wednesday, January 30, 2013 10:23:21 AM UTC-6, Paolo Caruccio wrote: I was not able to succesfully install pygraphviz on my windows7 64bit enviroment but I liked Jose's idea https://groups.google.com/d/topic/web2py/cFqD1M6rkc8/discussion, so I wrote a simple addendum to appadmin in order to show a graph representation of a database. It's not alternative to or a replacement of Jose's graph layout because there are substantial differences. db diagram is interactive (nodes are draggable and clickable) but you cannot save it as an image (anyway it's possible to use a third party application for screenshoots). Moreover it is customizable via css (you will find here attached a css theme for reference) and it's based on jqueryUI framewok. The nodes contain only the table name, so we can draw the layout of a database with (moderately) numerous tables. In order to see table data you have to click on the node. I added some infos like indexed columns (currently available only for sqlite but I think it's not hard to implement for other database engines), the list of other affected tables when we delete a row in cascade mode. The layout (the position of nodes on the screen) is generated trough a force-directed spring algorythm. Therefore the layout is generated dinamically and it will be different each time you refresh the page. For this scope, I adapted and translated to jQuery the original prototype source code freely distributed under the terms of a MIT-style license from http://snipplr.com/view/1950/graph-javascript-framework-version-001/ For a jquery version of this original source code you could visit http://www.graphdracula.net/ The edges are drawn by jsPlumb library ( http://www.jsplumb.org/jquery/demo.html ). All 1.x.x versions of jsPlumb are dual-licensed under both MIT and GPL version 2. Current main limitation: the database must have 'db' key in application databases dictionary. In other words in our model we must have db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all']) and not, for example, mydb = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all' ]) The screen dimensions are important too: the layout will be messed on small screens. The code has been tested on latest versions of Firefox, Chrome, Opera, IE(7,8,9) and on a very limited number of databases. So please check for errors and bugs. Installation: 1) append the code within in the attached db_diagram.py in your_application/controllers/appadmin.py file 2) put attached db_diagram.html in to your_application/views folder 3) create a new folder in your_application/static folder and name it db_diagram 4) in to latter put db_diagram.css, db_diagram_print.css, jquery.dbdiagram.js, pencildiagonals.png (an image create by me only for the css theme in bundle) (all these files are here attached) 5) download jsPlumb (jQuery release) from http://code.google.com/p/jsplumb/downloads/list and put jquery.jsPlumb-1.3.16-all-min.js file in your_application/static/db_diagram folder Usage: In your appadmin page you should see a new menu item diagram (see image 1), click on it and you should see the layout of your db. That's all Folks! -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: contribute: db diagram for web2py appadmin
Jose. thank you too for the amazing idea to draw a graph of the database. I take the opportunity to ask you where I can download a working pygraphviz build for windows. Il giorno giovedì 31 gennaio 2013 23:11:00 UTC+1, Jose ha scritto: Very nice. Excellent work Paolo. Jose -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: contribute: db diagram for web2py appadmin
thank you. package downloaded from [1] setup.py modified following istructions on [2] After setup.py install command all worked fine. Il giorno sabato 2 febbraio 2013 14:03:09 UTC+1, Jose ha scritto: El viernes, 1 de febrero de 2013 15:50:43 UTC-3, Paolo Caruccio escribió: Jose. thank you too for the amazing idea to draw a graph of the database. I take the opportunity to ask you where I can download a working pygraphviz build for windows. Tried with this [1] or [2]? [1] http://pypi.python.org/pypi/pygraphviz/1.1 [2] https://groups.google.com/forum/?fromgroups=#!topic/networkx-discuss/Xy1lWfMdB6U -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: contribute: db diagram for web2py appadmin
first post updated with latest version. Il giorno venerdì 1 febbraio 2013 21:21:28 UTC+1, Massimo Di Pierro ha scritto: Can you post a link to the latest? On Thursday, 31 January 2013 08:31:53 UTC-6, Paolo Caruccio wrote: first post updated: replaced following files db_diagram.html corrected CDN links. Now the diagram works on https too db_diagram.py [please note that you must copy the code within this file and paste at the bottom of web2py_app/controllers/appadmin.py] deleted a print statement Il giorno mercoledì 30 gennaio 2013 17:23:21 UTC+1, Paolo Caruccio ha scritto: I was not able to succesfully install pygraphviz on my windows7 64bit enviroment but I liked Jose's idea https://groups.google.com/d/topic/web2py/cFqD1M6rkc8/discussion, so I wrote a simple addendum to appadmin in order to show a graph representation of a database. It's not alternative to or a replacement of Jose's graph layout because there are substantial differences. db diagram is interactive (nodes are draggable and clickable) but you cannot save it as an image (anyway it's possible to use a third party application for screenshoots). Moreover it is customizable via css (you will find here attached a css theme for reference) and it's based on jqueryUI framewok. The nodes contain only the table name, so we can draw the layout of a database with (moderately) numerous tables. In order to see table data you have to click on the node. I added some infos like indexed columns (currently available only for sqlite but I think it's not hard to implement for other database engines), the list of other affected tables when we delete a row in cascade mode. The layout (the position of nodes on the screen) is generated trough a force-directed spring algorythm. Therefore the layout is generated dinamically and it will be different each time you refresh the page. For this scope, I adapted and translated to jQuery the original prototype source code freely distributed under the terms of a MIT-style license from http://snipplr.com/view/1950/graph-javascript-framework-version-001/ For a jquery version of this original source code you could visit http://www.graphdracula.net/ The edges are drawn by jsPlumb library ( http://www.jsplumb.org/jquery/demo.html ). All 1.x.x versions of jsPlumb are dual-licensed under both MIT and GPL version 2. Current main limitation: the database must have 'db' key in application databases dictionary. In other words in our model we must have db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all']) and not, for example, mydb = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all']) The screen dimensions are important too: the layout will be messed on small screens. The code has been tested on latest versions of Firefox, Chrome, Opera, IE(7,8,9) and on a very limited number of databases. So please check for errors and bugs. Installation: 1) append the code within in the attached db_diagram.py in your_application/controllers/appadmin.py file 2) put attached db_diagram.html in to your_application/views folder 3) create a new folder in your_application/static folder and name it db_diagram 4) in to latter put db_diagram.css, db_diagram_print.css, jquery.dbdiagram.js, pencildiagonals.png (an image create by me only for the css theme in bundle) (all these files are here attached) 5) download jsPlumb (jQuery release) from http://code.google.com/p/jsplumb/downloads/list and put jquery.jsPlumb-1.3.16-all-min.js file in your_application/static/db_diagram folder Usage: In your appadmin page you should see a new menu item diagram (see image 1), click on it and you should see the layout of your db. That's all Folks! -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: login by ajax
+1 for auth,ajax_login() paolo On Monday, February 18, 2013 4:50:20 AM UTC+1, Massimo Di Pierro wrote: Should we offer something like {{=auth.ajax_login()}} helper which submits to /user/login? If would not be difficult to write. How should it work? On Sunday, 17 February 2013 21:37:59 UTC-6, Anthony wrote: def login(): form=auth.login() if form.accepts(request,session=None): auth.login() already handles form processing, so you should not call form.accepts(), as that will not work. form action='' fieldset div id='login_result'/div labelEmail/label input name='email' id='email' type=text placeholder=Email Address labelPassword/label input name='password' id='password' type=password placeholder=*br/ button id='loginbtn' class=btn Onclick='login();return false;'Submit/button /fieldset /form web2py SQLFORM's (including the auth forms) include hidden _formname and _formkey fields -- if you're creating a custom form, you need to include those, or the form will not pass validation when submitted. If you want to create a custom form based on a SQLFORM, you should follow http://web2py.com/books/default/chapter/29/07#Custom-forms. Also, rather than manually submitting the form via Ajax, you might consider putting the login form in an Ajax component (or even a non-Ajax component with ajax_trap set to True). In that case, web2py.js will handle the Ajax submission for you. In that case, you may want to create a login_onaccept function to avoid the usual post-login redirect (which wouldn't be useful for an Ajax login). Anthony -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: [Newbee] - Error message with plugin_Wiki : 'auth' not defined
Hi Pibol, plugin_wiki is now deprecated, use auth.wiki() instead. http://web2py.com/books/default/chapter/29/03?search=auth.wiki#The-built-in-web2py-wiki paolo On Wednesday, February 20, 2013 3:17:42 PM UTC+1, open...@gmail.com wrote: Hi all, I am beginner in Web2Py and I like it much. I have tried some applications, like InstantPress... all is very interesting. But when I want (after installation) run the plugin_Wiki in the applications's liste, I have one ticket that gives this error message : Traceback (most recent call last): File gluon/restricted.py, line 212, in restricted File C:\web2py\applications\Wiki\models\plugin_wiki.py, line 9, in module NameError: name 'auth' is not defined I know that this plugin_Wiki is on steroid . Maybe I did a wrong manipulation ? Thanks for your patience, Pibol -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Scheduler: new plugin cs_plugin_monitor
Really nice job, +1 for shipping this with web2py. paolo On Sunday, February 24, 2013 3:34:03 PM UTC+1, Massimo Di Pierro wrote: I think this plugin should ship with web2py. ;-) On Sunday, 24 February 2013 07:28:11 UTC-6, Niphlod wrote: spoilers here https://www.dropbox.com/sh/gynhv3yvhnrw5is/YvtgRkIrlL On Saturday, February 23, 2013 10:17:22 PM UTC+1, Niphlod wrote: Not until beta at least... Graphs need a better look :-P -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: [newbee] Wiki_plugin - WidgetBuilder-jqgrid : How to link data from db to jqgrid
Hi Bruno, plugin_wiki is deprecated and it has been replaced by auth.wiki, have a look here: http://web2py.com/books/default/chapter/29/03?search=auth.wiki#The-built-in-web2py-wiki Paolo On Tuesday, February 26, 2013 5:09:06 PM UTC+1, open...@gmail.com wrote: Hi, I am new on Web2py and I try the plugin_wiki and the widget jqgrid with the WidgetBuilder. I have created in db.py my table but my jqgrid in my page (my form) is all the time empty. I have tried to do the select of my table in the meta_code but my jqgrid is empty. My question: How and where can I give the link between my table (db.py) and the Widget jqGrid in the Plugin_Wiki 's logic ? Regards, Bruno -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: SQLFORM in Bootstrap modal
Hi Vincenzo, I came across to the same problem with sqlform and modal. As far as I remember there is nothing 'automatic' to solve the problem. However, so far I fixed the duplicate submit buttons by hiding the 'original' one, namely the one belonging to the sqlform, and then adding just a few jquery lines that fire the click event to the original sumbit when the modal submit is clicked. This approach is not clear at all, it works though, Something better would be nice to come. Paolo On Wednesday, February 27, 2013 3:59:36 AM UTC+1, Vincenzo Ampolo wrote: Hi, I'm looking to a way to use the available by default bootstrap modal on a SQLFORM. It would be easy to integrate it, or any sort of lightbox like plugin, with SQLFORM if there is the capability to give a template to SQLFORM(). Looking at the documentation it doesn't seem that there is a way. I tried to simply put a form into the body of a modal window but of course i end up having duplicate submit buttons. Any clue/suggestion ? -- Vincenzo Ampolo http://goshawknest.wordpress.com/ http://vincenzo-ampolo.net/ -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Optimising caching and enabling gzip for web2py on heroku?
Hi Alec, if I were you I would remove the 'inline' parameter from both response.optimize_css response.optimize_js, just to keep the page lighter and to leverage on the browser cache for the external resources. Moreover, +1 for having something 'automatic' for using somehow the browser cache, in this case the 'somehow' is not clear to me yet. Paolo On Sunday, March 3, 2013 5:51:29 AM UTC+1, Alec Taylor wrote: Going through the Google PageSpeed Insights report (https://developers.google.com/speed/pagespeed/insights) to see what I should optimise to improve my site-load speed. The two high priority ones to worry about are: - Leverage browser caching - Enable compression How do I deal with these internally to web2py and on heroku? (e.g.: Rocket doesn't support gzip; so how do I configure this on heroku? - All the guides I saw were for Django or Flask…) FYI: I have also enabled these two lines in my db.py: response.optimize_css = 'concat,minify,inline' response.optimize_js = 'concat,minify,inline' How do I optimize these High priority metrics PageSpeed found? Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: web2py 2.4.2 is OUT
Good works, I will try it later today. I don't know if you have already discussed about that, just in case, I would suggest to start the use of git tags so it will be easier to update web2py and keep track of the different releases. Paolo On Monday, March 4, 2013 7:58:19 AM UTC+1, Massimo Di Pierro wrote: That is not the expected behavior. I will check what is going on but the more info you can provide the better. On Sunday, 3 March 2013 23:09:22 UTC-6, Monte Milanuk wrote: So... running 2.3.2 on Windows 7 and Ubuntu 12.10... on both when I click the 'Check for Upgrades' button in the admin dashboard, I get a message 'Unable to check for upgrades' that replaces the button, and is a link to web2py.com. Is that the expected behavior? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: web2py 2.4.2 is OUT
I solved in this way: https://groups.google.com/d/msg/web2py/6obMbP6OY6A/PAI5wStWFIQJ Maybe it helps you too. Il giorno martedì 5 marzo 2013 18:27:09 UTC+1, Derek ha scritto: Tried to 'graph models' on a windows machine, old apps get the error: invalid function (appadmin/graph_model) Created a new app from the wizard, clicked 'graph models' pygraphviz library not found Tried to install pygraphviz on Windows (after installing Graphviz), get this message: Your Graphviz installation could not be found. And the reason why: 3) You are using Windows There are no PyGraphviz binary packages for Windows but you might be able to build it from this source. See http://networkx.lanl.gov/pygraphviz/reference/faq.html So, can we have it disable the 'graph models' if you are running on Windows? Thanks! On Sunday, March 3, 2013 8:38:19 PM UTC-7, Massimo Di Pierro wrote: The book will be out shortly describing this version. I am sure there are some corners to iron but I could not wait any longer. Changelog: - 2D GEO API: geoPoint, getLine, geoPolygon - support for 'json' field type in DAL - schema export with db.as_json/as_xml, thanks Alan - graph representation of models - admin based on bootstrap, thanks Paolo - support for semantic versioning - new bootstrap based admin, thanks Paolo - improved scheduler (and change in scheduler field names), thanks Niphlod - graphiz support added to adm, thanks Jose - on_failure in grid - db.table.field.abs() - better wiki - geoPoint, getLine, geoPolygon - better reporting of 500 ajax errors - better grid - improved/fixed mongodb support - improved parse_as_rest(patterns=...), thanks Denes - improved IMAP DAL support, thanks Alan - improved security when cookies in sessions - Row.as_xml, as_json, as_dict, as_yaml thanks Alan - smarted custom_import - setup-ubuntu-12-04-redmine-unicorn-web2py-uwsgi-nginx.sh - added support for motor and pulsar servers, thanks Niphlod - added json-rpc2 support - added pypyodbc.py driver - allow auth.settings.ondelete='CASCADE' - new syntax IS_EXPR(lambda value: ... - using google for QR codes (although Graph API will be deprecated in 2015) - upgraded fpdf to 1.7.1 - bug fixes (including issues with calendar.js and archive tables) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: web2py 2.4.2 is OUT
For a similar project please see https://groups.google.com/d/msg/web2py/6obMbP6OY6A/QfjoDpZqCJAJ It uses javascript libraries and it is simple to implement. I didn't tested extensively so please report your feedback. Il giorno martedì 5 marzo 2013 18:48:27 UTC+1, LightDot ha scritto: I know of some users that made it work on windows, so it wouldn't be enough to just check the OS. Also, if the button is hidden in case the lib import fails, then new users would never see it and be reminded that they can install the library and use it. In both cases, the button serves a cause, IMHO. Regards, Ales On Tuesday, March 5, 2013 6:27:09 PM UTC+1, Derek wrote: Tried to 'graph models' on a windows machine, old apps get the error: invalid function (appadmin/graph_model) Created a new app from the wizard, clicked 'graph models' pygraphviz library not found Tried to install pygraphviz on Windows (after installing Graphviz), get this message: Your Graphviz installation could not be found. And the reason why: 3) You are using Windows There are no PyGraphviz binary packages for Windows but you might be able to build it from this source. See http://networkx.lanl.gov/pygraphviz/reference/faq.html So, can we have it disable the 'graph models' if you are running on Windows? Thanks! On Sunday, March 3, 2013 8:38:19 PM UTC-7, Massimo Di Pierro wrote: The book will be out shortly describing this version. I am sure there are some corners to iron but I could not wait any longer. Changelog: - 2D GEO API: geoPoint, getLine, geoPolygon - support for 'json' field type in DAL - schema export with db.as_json/as_xml, thanks Alan - graph representation of models - admin based on bootstrap, thanks Paolo - support for semantic versioning - new bootstrap based admin, thanks Paolo - improved scheduler (and change in scheduler field names), thanks Niphlod - graphiz support added to adm, thanks Jose - on_failure in grid - db.table.field.abs() - better wiki - geoPoint, getLine, geoPolygon - better reporting of 500 ajax errors - better grid - improved/fixed mongodb support - improved parse_as_rest(patterns=...), thanks Denes - improved IMAP DAL support, thanks Alan - improved security when cookies in sessions - Row.as_xml, as_json, as_dict, as_yaml thanks Alan - smarted custom_import - setup-ubuntu-12-04-redmine-unicorn-web2py-uwsgi-nginx.sh - added support for motor and pulsar servers, thanks Niphlod - added json-rpc2 support - added pypyodbc.py driver - allow auth.settings.ondelete='CASCADE' - new syntax IS_EXPR(lambda value: ... - using google for QR codes (although Graph API will be deprecated in 2015) - upgraded fpdf to 1.7.1 - bug fixes (including issues with calendar.js and archive tables) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: web2py 2.4.2 is OUT
just submitted a proposal patch on issue tracker https://code.google.com/p/web2py/issues/detail?id=1358 Il giorno mercoledì 6 marzo 2013 20:26:52 UTC+1, Fernando Lucas ha scritto: I had the same problem. In the Wizard 2.4.2 the buttons [+] end [-] don't work. Thanks, thanks for the new version. Fernando Lucas 2013/3/6 Marco Túlio Cícero de M. Porto mtcp...@gmail.com javascript: When using the New application wizard, cannot add new input row for new tables at Step 2: Tables neither by clicking on the plus signal nor by pressing ENTER. Same happens on Step 3: Fields for table auth_user (1 of 1) and on Step 4: Pages. Besides that, seems to be working properly... Thanks for the new version! Cheers! Marco Tulio 2013/3/6 Adnan Smajlovic adnan.s...@gmail.com javascript: Thanks for a new version. Will upgrade production tonight or tomorrow morning :) On Sunday, March 3, 2013 8:38:19 PM UTC-7, Massimo Di Pierro wrote: The book will be out shortly describing this version. I am sure there are some corners to iron but I could not wait any longer. Changelog: - 2D GEO API: geoPoint, getLine, geoPolygon - support for 'json' field type in DAL - schema export with db.as_json/as_xml, thanks Alan - graph representation of models - admin based on bootstrap, thanks Paolo - support for semantic versioning - new bootstrap based admin, thanks Paolo - improved scheduler (and change in scheduler field names), thanks Niphlod - graphiz support added to adm, thanks Jose - on_failure in grid - db.table.field.abs() - better wiki - geoPoint, getLine, geoPolygon - better reporting of 500 ajax errors - better grid - improved/fixed mongodb support - improved parse_as_rest(patterns=...), thanks Denes - improved IMAP DAL support, thanks Alan - improved security when cookies in sessions - Row.as_xml, as_json, as_dict, as_yaml thanks Alan - smarted custom_import - setup-ubuntu-12-04-redmine-**unicorn-web2py-uwsgi-nginx.sh - added support for motor and pulsar servers, thanks Niphlod - added json-rpc2 support - added pypyodbc.py driver - allow auth.settings.ondelete='**CASCADE' - new syntax IS_EXPR(lambda value: ... - using google for QR codes (although Graph API will be deprecated in 2015) - upgraded fpdf to 1.7.1 - bug fixes (including issues with calendar.js and archive tables) -- -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- []'s Marco Tulio -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Slow DAL initialization
I am wondering why the pool_size is set to 0 by default http://web2py.com/books/default/chapter/29/06#Connection-pooling Which are the side effect of having something greater than 0? Is not worth to have it set for example as 5 by default? paolo On Thursday, March 14, 2013 2:47:56 PM UTC+1, Niphlod wrote: those are more or less in line with my old tests on my home rig. If you don't specify a pool argument, every request needs to establish a connection with the db. On Thursday, March 14, 2013 2:32:58 PM UTC+1, Daniel Gonzalez wrote: Great, thanks Niphlod! Now the setup times have been reduced to the 3ms (with some cases of 3ms, and even less over 10ms). I would say, discarding the initial pool setup, the average is around 4 ms, with some spikes around 10ms (these are not accurate stats) Anyway, looks like an improvement. On Thursday, March 14, 2013 2:13:51 PM UTC+1, Niphlod wrote: pool ? On Thursday, March 14, 2013 1:16:25 PM UTC+1, Daniel Gonzalez wrote: This codes in the model takes between 5ms and 24ms to complete: WEB2PY_DAL_STORAGE=postgres://myuser:mypass@localhost:5432/mydb db = DAL(WEB2PY_DAL_STORAGE, migrate_enabled=False, lazy_tables=True) I am in a laptop with: - 2 cores, 3300 bogomips/core - 4 GB - linux 2.6.32-5-686 Is this expected? Thanks, Daniel -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Scheduler: new plugin cs_plugin_monitor
Hi, I have in plan to use it in a future project, today a started a very easy app but I ended up in the error: 'database is locked'. The tests were done by using sqlite. What is wrong in my app? Please find attached the example test The ticket: Traceback (most recent call last): File /home/pvalleri/src/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/pvalleri/src/web2py/applications/scapp/models/scheduler.py http://127.0.0.1:8000/admin/default/edit/scapp/models/scheduler.py, line 31, in module scheduler.queue_task(test_rest, period=10, repeats=0) File /home/pvalleri/src/web2py/gluon/scheduler.py, line 959, in queue_task **kwargs) File /home/pvalleri/src/web2py/gluon/dal.py, line 8460, in validate_and_insert response.id = self.insert(**new_fields) File /home/pvalleri/src/web2py/gluon/dal.py, line 8443, in insert ret = self._db._adapter.insert(self, self._listify(fields)) File /home/pvalleri/src/web2py/gluon/dal.py, line 1201, in insert raise e OperationalError: database is locked Paolo On Thursday, February 28, 2013 10:57:40 PM UTC+1, Niphlod wrote: plugin just got beta status. I'd gladly take patches for: - a nicer layout ? - removing all the javascript in template views and consolidate it in a separate js file As always, testers are more than welcome. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. from gluon.scheduler import Scheduler scheduler = Scheduler(db) def test_rest(): import urllib url = 'http://search.yahooapis.com/ContentAnalysisService/V1/termExtraction' appid = 'YahooDemo' context = ''' Italian sculptors and painters of the renaissance favored the Virgin Mary for inspiration ''' query = 'madonna' params = urllib.urlencode({ 'appid': appid, 'context': context, 'query': query }) data = urllib.urlopen(url, params).read() print data return 5 scheduler.queue_task(test_rest, period=10, repeats=0)
Re: [web2py] Re: Scheduler: new plugin cs_plugin_monitor
Hi Niphlod, I am thinking that I do misunderstood the book because I put this line scheduler.queue_task(test_rest, period=10, repeats=0) in a model file, this means that I have re-scheduled my task times and times! Btw, which should be the best place to add a new task (beside using your plugin!)? Paolo On Friday, March 15, 2013 11:29:26 AM UTC+1, Niphlod wrote: maybe the fact that you're using sqlite :D If you have a recent sqlite distribution activate the WAL, it can zero out the issues for normal loads (usually also for low loads SQLite ends up locked) Jokes aside, that's why I implemented multiple queries as regroupings in python, to alleviate db pressure on normal db and to see if sqlite can cope with it. Where are you seeing this error? If you were on the main page, did you try turning the autorefresh off ? Did you try increasing the cache time ? and setting GROUPING_MODE to python instead of database ? PS: you did not used this as a model, right ? it queues a new task at every request in that case On Friday, March 15, 2013 11:14:46 AM UTC+1, Paolo valleri wrote: Hi, I have in plan to use it in a future project, today a started a very easy app but I ended up in the error: 'database is locked'. The tests were done by using sqlite. What is wrong in my app? Please find attached the example test The ticket: Traceback (most recent call last): File /home/pvalleri/src/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/pvalleri/src/web2py/applications/scapp/models/scheduler.py http://127.0.0.1:8000/admin/default/edit/scapp/models/scheduler.py, line 31, in module scheduler.queue_task(test_rest, period=10, repeats=0) File /home/pvalleri/src/web2py/gluon/scheduler.py, line 959, in queue_task **kwargs) File /home/pvalleri/src/web2py/gluon/dal.py, line 8460, in validate_and_insert response.id = self.insert(**new_fields) File /home/pvalleri/src/web2py/gluon/dal.py, line 8443, in insert ret = self._db._adapter.insert(self, self._listify(fields)) File /home/pvalleri/src/web2py/gluon/dal.py, line 1201, in insert raise e OperationalError: database is locked Paolo On Thursday, February 28, 2013 10:57:40 PM UTC+1, Niphlod wrote: plugin just got beta status. I'd gladly take patches for: - a nicer layout ? - removing all the javascript in template views and consolidate it in a separate js file As always, testers are more than welcome. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Cache performance with computed columns
Dear all, I want to share with you some results. I implemented a query in two different ways. Given the following common code: start = db.record.with_alias('start_point') end = db.record.with_alias('end_point') elapsed_time = end.gathered_on.epoch() - start.gathered_on.epoch() The first query is (the constrain is in the query): rows = db( query (elapsed_time 86400) ).select( start.ALL, end.ALL, start.gathered_on.epoch(), end.gathered_on.epoch(), elapsed_time, orderby=start.gathered_on.epoch(), left=start.on( (start.mac == end.mac) (start.gathered_on end.gathered_on)), cache=(cache.memcache, 3600), cacheable = True ) The second one is (the constrain is explicitly tested latter): rows = db( query ).select( start.ALL, end.ALL, start.gathered_on.epoch(), end.gathered_on.epoch(), elapsed_time, orderby=start.gathered_on.epoch(), left=start.on( (start.mac == end.mac) (start.gathered_on end.gathered_on)), cache=(cache.memcache, 3600), cacheable = True ) rows2 = [r for r in rows if (r.end_point.gathered_on - r.start_point.gathered_on datetime.timedelta(days=1)) ] From the timing results I got that the second query is always faster, with or without cache: Q_1: 0.273243904114 Q_1 with cache: 0.0182011127472 Q_2: 0.250607967377 Q_2 with cache: 0.0158171653748 Beside the fact that they are just a few milliseconds of difference and that all the rows satisfy the constrain, what is not clear to me is why even when the cache is enabled the first query is taking longer. The question that came to my mind is about computed columns, are they cached? Paolo -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Cache performance with computed columns
Thanks for the very clear explanation. I made the following: t0 = time.time() rows = cache.memcache ('q1', lambda : q1(query)) t1 = time.time() rows2 = cache.memcache('q2', lambda: q2(query)) rows2 = [r for r in rows2 if (r.end_point.gathered_on - r.start_point.gathered_on datetime.timedelta(days=1)) ] t2 = time.time() print 'q1:', t1-t0 print 'q2:', t2-t1 and I got from three different requests: q1: 0.0104899406433 q2: 0.0106620788574 q1: 0.011244058609 q2: 0.0156059265137 q1: 0.010370016098 q2: 0.0133299827576 Beside memcache, I tried with cache.ram getting: q1: 9.77516174316e-06 q2: 0.00217413902283 q1: 1.62124633789e-05 q2: 0.00206780433655 q1: 8.10623168945e-06 q2: 0.00120091438293 Given that, in a local env cache.ram is faster than memcache. Paolo On Monday, March 25, 2013 11:54:07 AM UTC+1, Niphlod wrote: well, when you plan to use cache you do it because: a) the additional roundtrip is negligible b) using the cache means your database is not used I'll explain it further A query that takes 0.18ms to get computed on the database side can very well end up in 18sec as soon as your database gets hit by several requests. A cached query that takes 0.18ms to get stored and 0.18ms to get retrieved (unpacked, decompressed, unpickled, choose your own term that suits the job) will take, if the cache backend is proper, 0.36ms the first time and 0.18ms from the 2nd to the nth. Even so, some complicated queries (or uncomplicated for you, but complicated for the db backend) can be speedied up just requesting less fields or computing in raw python something that can be usually done on the backend. This kind of optimization (i.e. relying on python's datetime operations vs an extract(epoch from datefield) on the db) will be less and less useful as soon as the resultsets cardinality grows (i.e. the more rows you have the better chance for the db to get the results faster than having a basic query and processing the results in python). Assuming your python filter cuts out the 5% on the total of the rows, as soon as the number of rows grows you'll just waste time unpacking that additional 5%, and the time difference will be more explicit. On a total unrelated note, remember that Python is fast, but dbs are fast too, especially when leveraged by all their features (e.g. you could set an index on the computed epoch and that query will probably gain a lot of speedup). This is meant to explain why Q2 is faster than Q1. On the reason why Q1 with cache isn't faster than Q2 with cache, since the time difference is negligible, it's possible that the time difference gets spent on calculating the automatic key for the cache of the query (on the first implementation needs to add the elapsed time part) . Just to be sure, try timing def Q1(): your first implementation, without cache def Q2(): your second implementation, without cache, without the check in python with rows1 = cache('q1', lambda : Q1()) . and, separately rows2 = cache('q2', lambda: Q2()) rows2 = [r for row in rows ...] On Monday, March 25, 2013 11:12:50 AM UTC+1, Paolo valleri wrote: Hi Niphlod, thanks for the answer. I am not blaming on web2py I am just sharing with you all these results. In both the cases I have the time constrain, in one case it is in the query (Q1) while in the second it is explicit(Q2). With cache enabled, Q1 is no longer checking the constrain while Q2 is still checking all the constrain for all rows. Moreover, computing the .epoch() should take a well defined amount of time but for queries without cache, with cache it should be stored the computed result. To sum up, when cache is enabled, with the same amount of rows (nearly 300): - Q2 is taking less time than Q1 even if it has to compute explicitly the time constrain - Q1 is taking more time than Q2, but it has to retrieve from cache only one field more than Q1 among a dozen of fields Given that, retrieving more data from memcached can be slower than re-computing it for each request. Paolo 2013/3/25 paolo@gmail.com paolo@gmail.com Paolo 2013/3/25 Niphlod nip...@gmail.com I didn't get the point. Q1 is slower (obviously) cause of the epoch() function and the additional filtering Q1 with cache shows more or less the same duration as Q2 with cache. the key point is even when the cache is enabled the first query is taking longer ... longer than what ? Q1 with cache is speedier that: - Q1 without cache, and that's ok - Q2 without cache, and that's ok but it's slower than - Q2 with cache however 3 ms (assuming those timings are in seconds) with all the moving parts of a memcache instance seems unfair to blame entirely on web2py On Monday, March 25, 2013 9:48:14 AM UTC+1, Paolo valleri wrote: Dear all, I want to share with you some results. I implemented a query in two different ways. Given the following common code
[web2py] scheduler sincronization
Dear all, I started to use scheduler. I've created a simple starting example task: https://github.com/ilvalle/scapp/blob/master/models/scheduler.py and with the great niphlod's plugin cs_monitor_plugin I created an initial repetitive task. However, although I set repeats: 0 and period: 300, tasks are not repeated as expected exactly every 300s. The first five tasks were executed at: 2013-03-25 15:34:43 2013-03-25 15:40:48 2013-03-25 15:46:52 2013-03-25 15:52:08 2013-03-25 15:57:22 The time between two consecutive execution is not so straightforward. what am I missing? Is there a way to impose more accuracy ? paolo -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: scheduler sincronization
When yesterday I saw demo1 in timeout with ps auxf I have seen that a new process was created. For this reason I started to debug scheduler and I asked how to log etc. Moreover, I restarted the scheduler manually so I am not able to understand if the other different names are for an internal problem or something different. Do you think that should be fixed by using a different db engine? Paolo On Tuesday, March 26, 2013 12:42:14 PM UTC+1, Niphlod wrote: with the default logging.conf the timestamp is present as in all other web2py-related logging PS: are you sure that the worker is not killed/restarted by any chance (see the worker_name in the scheduler_run table) On Tuesday, March 26, 2013 11:33:53 AM UTC+1, Paolo valleri wrote: I executed again demo1, I run it several times, I got even in this case elapsed time between two consecutive executions around 360 and even more instead of 300. What can I do to understand what is not working correctly? Moreover, I would suggest to add the timestamp to the scheduler debug log. Paolo 2013/3/25 Niphlod nip...@gmail.com On Monday, March 25, 2013 10:46:12 PM UTC+1, Paolo valleri wrote: I didn't get your point, with one repetitive task, should I start the scheduler with two or more workers? If so, I will try it. The point is that the thread that manages some logic every heartbeat seconds is the one in charge of waiting 5 loops to trigger the additional logic to pick up new tasks (a repetitive task is just a new task to execute). If the process doing the work is busy processing the task and the underlying thread reaches the let's assign tasks loop, the logic will be skipped (it's unuseful to assign tasks if a worker is already processing them). So it can happen that even if the assignment time has come, if the worker is processing tasks it will skip the assignment Actually I have just seen the stop time, on average the task completes it cycle in just a few seconds (~1-2). Given that, is what you have suggested still valid? Nope. As I said it guaranteed that even in the case that the assignment loop falls into the timeframe of a RUNNING task, at the next round it will be picked up Last but not least, demo1 has gone in timeout after one successful cycle, this is very odd, How I can debug the scheduler application and find its errors? I am running scheduler as a linux service, as described here: http://web2py.com/books/**default/chapter/29/13#Start-** the-scheduler-as-a-Linux-**service-%28upstart%29http://web2py.com/books/default/chapter/29/13#Start-the-scheduler-as-a-Linux-service-%28upstart%29 SQLite locking is the most probable cause. The fastest way is to see what's happening is starting the scheduler with debug logging web2py.py -K appname -D 0 -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/u_PgzKLuQmw/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: scheduler sincronization
import sqlite3 print sqlite3.version 2.6.0 print sqlite3.sqlite_version 3.7.9 But, if the db lock is not the problem, the test application is very easy, where is it supposed to be the problem? On Tuesday, March 26, 2013 2:32:50 PM UTC+1, Niphlod wrote: I find hard to believe that with a single worker, with that function that basically just prints something and an execution every 300 seconds the problem lies into a lock, unless the SQLite library available on your system is reallly old. On Tuesday, March 26, 2013 2:21:21 PM UTC+1, Paolo valleri wrote: When yesterday I saw demo1 in timeout with ps auxf I have seen that a new process was created. For this reason I started to debug scheduler and I asked how to log etc. Moreover, I restarted the scheduler manually so I am not able to understand if the other different names are for an internal problem or something different. Do you think that should be fixed by using a different db engine? Paolo On Tuesday, March 26, 2013 12:42:14 PM UTC+1, Niphlod wrote: with the default logging.conf the timestamp is present as in all other web2py-related logging PS: are you sure that the worker is not killed/restarted by any chance (see the worker_name in the scheduler_run table) On Tuesday, March 26, 2013 11:33:53 AM UTC+1, Paolo valleri wrote: I executed again demo1, I run it several times, I got even in this case elapsed time between two consecutive executions around 360 and even more instead of 300. What can I do to understand what is not working correctly? Moreover, I would suggest to add the timestamp to the scheduler debug log. Paolo 2013/3/25 Niphlod nip...@gmail.com On Monday, March 25, 2013 10:46:12 PM UTC+1, Paolo valleri wrote: I didn't get your point, with one repetitive task, should I start the scheduler with two or more workers? If so, I will try it. The point is that the thread that manages some logic every heartbeat seconds is the one in charge of waiting 5 loops to trigger the additional logic to pick up new tasks (a repetitive task is just a new task to execute). If the process doing the work is busy processing the task and the underlying thread reaches the let's assign tasks loop, the logic will be skipped (it's unuseful to assign tasks if a worker is already processing them). So it can happen that even if the assignment time has come, if the worker is processing tasks it will skip the assignment Actually I have just seen the stop time, on average the task completes it cycle in just a few seconds (~1-2). Given that, is what you have suggested still valid? Nope. As I said it guaranteed that even in the case that the assignment loop falls into the timeframe of a RUNNING task, at the next round it will be picked up Last but not least, demo1 has gone in timeout after one successful cycle, this is very odd, How I can debug the scheduler application and find its errors? I am running scheduler as a linux service, as described here: http://web2py.com/books/**default/chapter/29/13#Start-** the-scheduler-as-a-Linux-**service-%28upstart%29http://web2py.com/books/default/chapter/29/13#Start-the-scheduler-as-a-Linux-service-%28upstart%29 SQLite locking is the most probable cause. The fastest way is to see what's happening is starting the scheduler with debug logging web2py.py -K appname -D 0 -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/u_PgzKLuQmw/unsubscribe?hl=en . To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Just knew about Server-Sent Events and want to share it with you
Well, I just tested version 2.4.5 Stable ts 2013.04.04.21.10.38 and all worked for me. What issue have you encountered? Anyway, the code was and is experimental (for example it doesn't work on IE). If do you want something more tested please try comet messaging included in web2py as Derek suggested in an other thread. Il giorno venerdì 5 aprile 2013 02:26:23 UTC+2, Arnon Marcus ha scritto: Can you post the actual files? The w2p can't be imported to the latest web2py... Also, some questions: 1. The way I understand this, an implementation would be via a controller-action that receives the event-stream-request, then responds with a 200 OK and that MIME thing, to affirm the connection. But from that point onward, new responses should be sent over the same open connection. How is the response-object being generated and sent without a request? How does it know where to send it to? 2. I would like to make a shared-collaborative view for multiple users, that any changed done by one, is reflected automatically in all the others. How would I go about doing that? Since web2py executes on each request, I would have to hold connection-data of all open-connections, in some semi-persistent location - would I have to use some external/internal caching? Is there some automatic session-saving already built-in web2py that can be useful? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Server-Sent Events
When I wrote the small app SSE_clock I was searching a replacement for a long polling javascript code that I was using in order to push db's table update notifications to clients. I abandoned the project by lack of browser's support. Anyway, the application is a simple translation from php to python. Original demo target is to show that SSEs reconnect automatically and that it possible send multiple events on a single connection. Here attached you'll find original code in php to compare with python version. However SSE has other features not discussed in the clock example. Below some links that I collected during my research: http://blog.samshull.com/2010/10/ajax-push-in-ios-safari-and-chrome-with.html http://my.opera.com/WebApplications/blog/show.dml/438711 http://dev.w3.org/html5/eventsource/ http://www.html5rocks.com/en/tutorials/eventsource/basics/ https://github.com/rwldrn/jquery.eventsource http://www.igvita.com/2011/08/26/server-sent-event-notifications-with-html5/ http://dsheiko.com/weblog/html5-and-server-sent-events http://blog.abourget.net/2010/6/16/html5-eventsource-in-pylons-read-comet-ajax-polling/ http://en.wikipedia.org/wiki/Server-sent_events https://msmvps.com/blogs/theproblemsolver/archive/2011/11/07/html-5-server-sent-events.aspx http://peter.sh/examples/?/javascript/event-source.html http://weblog.bocoup.com/chrome-6-server-sent-events-with-new-eventsource https://developer.mozilla.org/en/Server-sent_events/Using_server-sent_events http://stevenhollidge.blogspot.com/2011/10/html5-server-side-events.html http://www.dotnetage.com/publishing/home/2011/09/23/6932/html5-server-sent-events.html http://moshhard.wordpress.com/2011/10/11/html5-server-sent-event-combine-with-web-notification/ http://www.codeproject.com/Questions/405117/Sending-Html5-SSE-to-specific-clients Il giorno lunedì 8 aprile 2013 17:48:31 UTC+2, Arnon Marcus ha scritto: Look, I appreciate you're trying to help-out, but it seems you are answering the questions you know the answers to, instead of the questions I ask. It's OK to say that you don't know the answer. You are not alone in this user-group, perhaps someone else does. We all got that. it's an external process, but it's implemented already, it just works, has a simple yet powerful routing algo and its secure. With SSE you have to do it yourself. I know that there is a somewhat-working solution for web-sockets, using Tornado. I know it would be better to use it, instead of trying to make SSE work in web2py by myself. In the long-term I'll probably do something like that. But as you said, not in all scenarios, a web-socket is requited - sometimes an SSE does what I need. And as it is HTTP-based, I thought it should have been easy to implement in web2py. This is exactly the example shown on the videos about websocket_messaging.py . the user receives updates through the ws, and he sends to the default web2py installation with a simple ajax post its message. web2py then queues that message to tornado, that informs all connected users of the new message on the ws channel. Again, that is not an answer to my questions. My questions where referring to how web2py can implement SSE, not how Tornado can implement web-sockets and have web2py push stuff into it. On the SSE side, you'd have some controller that basically does: def events(): initialization_of_sse while True: yield send_a_message you have to think to security, routing, etc by yourself. Basically in that while True loop you'd likely want to inspect your storage (redis, ram, dict, database, whatever) if there's a new message for the user. You can't exit from there and resume itall the logic needs to happen inside that yield(ing) loop. That is answering the question : How does web2py keep a long-lasting connection. That is NOT answering the question: How can a different controller-action activate this I found a way to extract the web2py-SSE example, here are the relevant parts (I *bold*'ed the important stuff): *Controller:* # -*- coding: utf-8 -*- import time from gluon.contenttype import contenttype ### required - do no delete def user(): return dict(form=auth()) def download(): return response.download(request,db) def call(): return service() ### end requires def index(): return dict() def error(): return dict() def sse(): return dict() def buildMsg(eid , msg): mmsg = id: %s\n %eid mmsg += data: {\n mmsg += data: \msg\: \%s\, \n %msg mmsg += data: \id\: %s\n %eid mmsg += data: }\n\n return mmsg *def sent_server_event():* response.headers['Content-Type'] = 'text/event-stream' response.headers['Cache-Control'] = 'no-cache' * def sendMsg():* startedAt = time.time(); #http://www.epochconverter.com/ * while True:* messaggio = buildMsg(startedAt , time.time()) * yield messaggio* * time.sleep(5)* * if ((time.time() - startedAt) 10):break* * return sendMsg()*
Re: [web2py] Re: Server-Sent Events
just a crazy question: what about if you wrap the eventsource in a web worker? Il giorno martedì 9 aprile 2013 22:56:51 UTC+2, Arnon Marcus ha scritto: The first yield WILL block the thread, but as you say, only the thread of that connection. So the inter-thread communication would then be solved via another shared process - Redis - which will act as a message broker, listening to submissions and submit publications for subscribers. I guess I can live with that, for now, our user-base is small enough I think... Apache is doing the same, right? P.S : Here is a nice lecture about concurrency and co-routines in python: http://www.youtube.com/watch?v=b7R3-_ViNxk On Tue, Apr 9, 2013 at 4:16 AM, Niphlod nip...@gmail.com javascript:wrote: ok, all clear! One point though: with a threaded webserver web2py can manage as many connections as there are free threads: it's not blocking everything at the first SSE yielding loop, it doesn't communicate with new connections as soon as there are n open connections, with n == max number of threads. I can't test it right now, but rocket (that is the embedded webserver of web2py) unless specified explicitely, opens a new thread at every connection (if you don't set the maxthreads option). Of course this can't scale up to 1000 connections, but its nonetheless sufficient for testing purposes or a small userbase. -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/bpx7ZcL67Co/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: help with css
The first behavior (a small button is shown on narrow screen) is normal. The second no. Original behavior was to show all submenu when you clicked on small button. You could check this on web2py 2.3.0. Something broke this I'll investigate and submit a patch asap. Il giorno sabato 13 aprile 2013 23:29:39 UTC+2, Massimo Di Pierro ha scritto: In twitter bootstrap and web2py when the screen is too narrow the menu display as a single button which triggers a drop down. This happens to me every time I give a talk and the menu disappears because the screen gets narrower on a projector. Moreover when the menu is a dropdown, submenus do not work? Any suggestions for changing this behavior? Massimo -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: help with css
I found the problem causing the submenu display failure. Twitter bootstrap shows the submenu with the click. In web2py, instead we use the hover. Since bootstrap has implemented a js function that sets the height of the navbar, having the collapsed state, on click event we have to override it. I added a function that adjusts the height of the navbar on hover event. Unfortunately there is a small initial spring effect, but I think that it is acceptable. I will send a patch in the next few minutes. Regarding the size of the small button you can increase it by simple css rules. For example: . navbar. btn-navbar. icon-bar { width: 36px; height: 4px; } . btn-navbar. icon-bar +. icon-bar { margin-top: 6px; } to be added to the section Overriding Bootstrap.css Rules in web2py_bootstrap.css. But I think it's a question of taste so it is in my opinion that it is preferable to leave the default values in the distributed version of web2py. Finally, I noticed that in web2py we have an old version of jquery (1.8.3 vs 1.9.1) and an old version of bootstrap (2.2.2 vs 31.2). I'm pretty sure that updating these technologies does not lead to side effects. Il giorno domenica 14 aprile 2013 16:52:03 UTC+2, Massimo Di Pierro ha scritto: Can we increase width that triggers the first behavior (small button)? On Sunday, 14 April 2013 05:06:01 UTC-5, Paolo Caruccio wrote: The first behavior (a small button is shown on narrow screen) is normal. The second no. Original behavior was to show all submenu when you clicked on small button. You could check this on web2py 2.3.0. Something broke this I'll investigate and submit a patch asap. Il giorno sabato 13 aprile 2013 23:29:39 UTC+2, Massimo Di Pierro ha scritto: In twitter bootstrap and web2py when the screen is too narrow the menu display as a single button which triggers a drop down. This happens to me every time I give a talk and the menu disappears because the screen gets narrower on a projector. Moreover when the menu is a dropdown, submenus do not work? Any suggestions for changing this behavior? Massimo -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: css-menu
The Niphlod's solution is better but add following rules .navbar-inverse .navbar-inner { background-color:green; background-image:none; } .navbar-inverse .navlia { color:red; } to the section other rules in web2py_bootstrap.css for a very fast and not complete customization. Il giorno domenica 14 aprile 2013 07:40:56 UTC+2, mweissen ha scritto: I want to have another for color and backgroundcolor in the menu bar. I have changed bootswatch.css, line 83 #navbar .auth_navbar, #navbar .auth_navbar a {color:*green*;} And in web2py_bootstrap.css, line 40 /* auth navbar - primitive style */ .auth_navbar,.auth_navbar a{color:*red*;} /* inherit */ .ie-lte7 .auth_navbar,.auth_navbar a{color:expression(this.parentNode.currentStyle['color']); /* ie7 doesn't support inherit */} .auth_navbar a{white-space:nowrap;} /* to avoid the nav split on more lines */ .auth_navbar a:hover{color:*red*; text-decoration:none;} /* white */ Any hints? Refards, Martin -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Where do I change the size of the editor object in admin?
A possible solution in order to hide the small vertical scrollbar displayed when the page is loaded: in applications/admin/static/codemirror/lib/codemirror.css please change line 13 from height: 300px; to height: auto; the css rule after the change will be: .CodeMirror-scroll { overflow: auto; height: auto; /*300px;*/ /* This is needed to prevent an IE[67] bug where the scrolled content is visible outside of the scrolling box. */ position: relative; outline: none; } Il giorno sabato 13 aprile 2013 21:04:25 UTC+2, Niphlod ha scritto: ok, long version ^__^ there are 2 separate problems: 1. every time the admin page is updated (i.e. new css, new structure, etc) it is possible (and happened already) that your browser has the old version of these assets in cache, so things are working weirdly. If you trigger the full-reload with ctrl+f5, the browser requests the full page and discard the cached elements -- it reloads the admin app the way it should be. Now, if you observe that the behaviour of a particular page of the admin app is sometimes a, sometimes b, ctrl+f5 should fix it and the page will behave consistently (i.e. always a or always b) 2. If a full-reload didn't fix the consistent (after ctrl+f5) behaviour of showing a scrollbar, then it's a problem of the structure of admin, meaning either the markup and/or css and/or js is doing something that shouldn't happen. Just to confirm, I can observe that behaviour too (scrollbar is there, as soon as I click it goes away) but I didn't ever noticed it ^__^ -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Where do I change the size of the editor object in admin?
No. My previous solution doesn't work in all circumstances. The problem is more complex and involves the javascript code. Il giorno lunedì 15 aprile 2013 00:35:19 UTC+2, Paolo Caruccio ha scritto: A possible solution in order to hide the small vertical scrollbar displayed when the page is loaded: in applications/admin/static/codemirror/lib/codemirror.css please change line 13 from height: 300px; to height: auto; the css rule after the change will be: .CodeMirror-scroll { overflow: auto; height: auto; /*300px;*/ /* This is needed to prevent an IE[67] bug where the scrolled content is visible outside of the scrolling box. */ position: relative; outline: none; } Il giorno sabato 13 aprile 2013 21:04:25 UTC+2, Niphlod ha scritto: ok, long version ^__^ there are 2 separate problems: 1. every time the admin page is updated (i.e. new css, new structure, etc) it is possible (and happened already) that your browser has the old version of these assets in cache, so things are working weirdly. If you trigger the full-reload with ctrl+f5, the browser requests the full page and discard the cached elements -- it reloads the admin app the way it should be. Now, if you observe that the behaviour of a particular page of the admin app is sometimes a, sometimes b, ctrl+f5 should fix it and the page will behave consistently (i.e. always a or always b) 2. If a full-reload didn't fix the consistent (after ctrl+f5) behaviour of showing a scrollbar, then it's a problem of the structure of admin, meaning either the markup and/or css and/or js is doing something that shouldn't happen. Just to confirm, I can observe that behaviour too (scrollbar is there, as soon as I click it goes away) but I didn't ever noticed it ^__^ -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: help with css
Patch sent https://code.google.com/p/web2py/issues/detail?id=1447 Il giorno lunedì 15 aprile 2013 05:48:16 UTC+2, Massimo Di Pierro ha scritto: Can you send me a patch? thanks. On Sunday, 14 April 2013 10:36:40 UTC-5, Paolo Caruccio wrote: I found the problem causing the submenu display failure. Twitter bootstrap shows the submenu with the click. In web2py, instead we use the hover. Since bootstrap has implemented a js function that sets the height of the navbar, having the collapsed state, on click event we have to override it. I added a function that adjusts the height of the navbar on hover event. Unfortunately there is a small initial spring effect, but I think that it is acceptable. I will send a patch in the next few minutes. Regarding the size of the small button you can increase it by simple css rules. For example: . navbar. btn-navbar. icon-bar { width: 36px; height: 4px; } . btn-navbar. icon-bar +. icon-bar { margin-top: 6px; } to be added to the section Overriding Bootstrap.css Rules in web2py_bootstrap.css. But I think it's a question of taste so it is in my opinion that it is preferable to leave the default values in the distributed version of web2py. Finally, I noticed that in web2py we have an old version of jquery (1.8.3 vs 1.9.1) and an old version of bootstrap (2.2.2 vs 31.2). I'm pretty sure that updating these technologies does not lead to side effects. Il giorno domenica 14 aprile 2013 16:52:03 UTC+2, Massimo Di Pierro ha scritto: Can we increase width that triggers the first behavior (small button)? On Sunday, 14 April 2013 05:06:01 UTC-5, Paolo Caruccio wrote: The first behavior (a small button is shown on narrow screen) is normal. The second no. Original behavior was to show all submenu when you clicked on small button. You could check this on web2py 2.3.0. Something broke this I'll investigate and submit a patch asap. Il giorno sabato 13 aprile 2013 23:29:39 UTC+2, Massimo Di Pierro ha scritto: In twitter bootstrap and web2py when the screen is too narrow the menu display as a single button which triggers a drop down. This happens to me every time I give a talk and the menu disappears because the screen gets narrower on a projector. Moreover when the menu is a dropdown, submenus do not work? Any suggestions for changing this behavior? Massimo -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: help with css
Please replace the file web2py_bootstrap.js in welcome/static/js/ and admin/static/js folders with the patched one. I added a function [adjust_height_of_collapsed_nav()] that adjusts the height of the navbar on hover mouse event when it is collapsed (screen width 980px based on default bootstrap threshold). Unfortunately there is a small initial spring effect, but I think that it is acceptable. I removed the client width check: now hoverMenu() function works also for narrow screen. The code is very simple but if you need more details I'll be at your disposal. Il giorno lunedì 15 aprile 2013 16:42:39 UTC+2, Massimo Di Pierro ha scritto: Can you explain how that works? Il giorno lunedì 15 aprile 2013 05:47:48 UTC-5, Paolo Caruccio ha scritto: Patch sent https://code.google.com/p/web2py/issues/detail?id=1447 Il giorno lunedì 15 aprile 2013 05:48:16 UTC+2, Massimo Di Pierro ha scritto: Can you send me a patch? thanks. On Sunday, 14 April 2013 10:36:40 UTC-5, Paolo Caruccio wrote: I found the problem causing the submenu display failure. Twitter bootstrap shows the submenu with the click. In web2py, instead we use the hover. Since bootstrap has implemented a js function that sets the height of the navbar, having the collapsed state, on click event we have to override it. I added a function that adjusts the height of the navbar on hover event. Unfortunately there is a small initial spring effect, but I think that it is acceptable. I will send a patch in the next few minutes. Regarding the size of the small button you can increase it by simple css rules. For example: . navbar. btn-navbar. icon-bar { width: 36px; height: 4px; } . btn-navbar. icon-bar +. icon-bar { margin-top: 6px; } to be added to the section Overriding Bootstrap.css Rules in web2py_bootstrap.css. But I think it's a question of taste so it is in my opinion that it is preferable to leave the default values in the distributed version of web2py. Finally, I noticed that in web2py we have an old version of jquery (1.8.3 vs 1.9.1) and an old version of bootstrap (2.2.2 vs 31.2). I'm pretty sure that updating these technologies does not lead to side effects. Il giorno domenica 14 aprile 2013 16:52:03 UTC+2, Massimo Di Pierro ha scritto: Can we increase width that triggers the first behavior (small button)? On Sunday, 14 April 2013 05:06:01 UTC-5, Paolo Caruccio wrote: The first behavior (a small button is shown on narrow screen) is normal. The second no. Original behavior was to show all submenu when you clicked on small button. You could check this on web2py 2.3.0. Something broke this I'll investigate and submit a patch asap. Il giorno sabato 13 aprile 2013 23:29:39 UTC+2, Massimo Di Pierro ha scritto: In twitter bootstrap and web2py when the screen is too narrow the menu display as a single button which triggers a drop down. This happens to me every time I give a talk and the menu disappears because the screen gets narrower on a projector. Moreover when the menu is a dropdown, submenus do not work? Any suggestions for changing this behavior? Massimo -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: help with css
What do you mean? the button or the submenu? On my system (windows7) the submenus are displayed correctly in IE10, FF last version, Chrome last version, Opera last version when the topbar menu is collapsed and you see the button with 3 horizontal lines. I can't test on narrow screen but on reduced browser windows only. The patch doesn''st change the button size. Il giorno martedì 16 aprile 2013 00:58:09 UTC+2, Massimo Di Pierro ha scritto: I did ( committing now) but I do not see any improvement. On Monday, 15 April 2013 10:28:07 UTC-5, Paolo Caruccio wrote: Please replace the file web2py_bootstrap.js in welcome/static/js/ and admin/static/js folders with the patched one. I added a function [adjust_height_of_collapsed_nav()] that adjusts the height of the navbar on hover mouse event when it is collapsed (screen width 980px based on default bootstrap threshold). Unfortunately there is a small initial spring effect, but I think that it is acceptable. I removed the client width check: now hoverMenu() function works also for narrow screen. The code is very simple but if you need more details I'll be at your disposal. Il giorno lunedì 15 aprile 2013 16:42:39 UTC+2, Massimo Di Pierro ha scritto: Can you explain how that works? Il giorno lunedì 15 aprile 2013 05:47:48 UTC-5, Paolo Caruccio ha scritto: Patch sent https://code.google.com/p/web2py/issues/detail?id=1447 Il giorno lunedì 15 aprile 2013 05:48:16 UTC+2, Massimo Di Pierro ha scritto: Can you send me a patch? thanks. On Sunday, 14 April 2013 10:36:40 UTC-5, Paolo Caruccio wrote: I found the problem causing the submenu display failure. Twitter bootstrap shows the submenu with the click. In web2py, instead we use the hover. Since bootstrap has implemented a js function that sets the height of the navbar, having the collapsed state, on click event we have to override it. I added a function that adjusts the height of the navbar on hover event. Unfortunately there is a small initial spring effect, but I think that it is acceptable. I will send a patch in the next few minutes. Regarding the size of the small button you can increase it by simple css rules. For example: . navbar. btn-navbar. icon-bar { width: 36px; height: 4px; } . btn-navbar. icon-bar +. icon-bar { margin-top: 6px; } to be added to the section Overriding Bootstrap.css Rules in web2py_bootstrap.css. But I think it's a question of taste so it is in my opinion that it is preferable to leave the default values in the distributed version of web2py. Finally, I noticed that in web2py we have an old version of jquery (1.8.3 vs 1.9.1) and an old version of bootstrap (2.2.2 vs 31.2). I'm pretty sure that updating these technologies does not lead to side effects. Il giorno domenica 14 aprile 2013 16:52:03 UTC+2, Massimo Di Pierro ha scritto: Can we increase width that triggers the first behavior (small button)? On Sunday, 14 April 2013 05:06:01 UTC-5, Paolo Caruccio wrote: The first behavior (a small button is shown on narrow screen) is normal. The second no. Original behavior was to show all submenu when you clicked on small button. You could check this on web2py 2.3.0. Something broke this I'll investigate and submit a patch asap. Il giorno sabato 13 aprile 2013 23:29:39 UTC+2, Massimo Di Pierro ha scritto: In twitter bootstrap and web2py when the screen is too narrow the menu display as a single button which triggers a drop down. This happens to me every time I give a talk and the menu disappears because the screen gets narrower on a projector. Moreover when the menu is a dropdown, submenus do not work? Any suggestions for changing this behavior? Massimo -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: @cache decorator
Basically it stores the output of the function, in your case the output is the rendered view. For more info about cache, have a look here: http://web2py.com/books/default/chapter/29/04#cache Paolo On Thursday, April 18, 2013 6:17:36 PM UTC+2, BlueShadow wrote: Hi I got a site which calls some major calculating. So I thought lets use the cache decoator to speed up second time loads. But it doesnt seem to have any effekt on pageloading times. @cache(returnDatestring()+Somepage, time_expire=86000, cache_model=cache .disk) def Somepage(): #some time intensive calculations return response.render(l=l) So with and without the @cache decorator it takes about 25 seconds for the page to load. (yeah my server is slow I know) As far as I understand it the whole age should be stored on the disk and be served as a static page. which should load instantly. Or is just the output of the function stored and the view has to be rendered afterwards? (the view has a big table with like 100 rows, there are calculated some sums too) If so can I cache the entire view? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: db select with rows
You get the last element simply because in the loop you have an assignment. So that you will get only the last element of the loop. What about that: rows = db(db.tableA. http://db.tableb.id/id_b==db.tableB.idhttp://row.id/ ).select(db.tableB.ALL) or temp = [] for row in rowsA: temp.append( db(db.tableB.id http://db.tableb.id/==row.id).select() ) Paolo On Sunday, April 21, 2013 10:28:18 AM UTC+2, BlueShadow wrote: I can't get my head around this problem it's probably easy but I ask anyway: I got rows(lets call them rowsA) from tableA and I want to select all items from another tableB which have one of the ids in tableA I could do it with a for loop selecting one at a time like so: for row in rowsA: temp=db(db.tableB.id http://db.tableb.id/==row.id).select() but now I got only one element as a result. how can I get all those into one variable:rowsB -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: bootstrap thumnails problem
This behavior is due to different number of text lines in labels. You could use a jquery plugin (search the net for jquery equal height) in order to give to the div.thumbnail the same height as tallest one. Or you could give to the div.thumbnail a fixed height and auto overflow-y by a css rule. Il giorno mercoledì 1 maggio 2013 23:06:55 UTC+2, Omi Chiba ha scritto: Maybe this is not web2py issue but I'm trying to use thumnail class to shows the three image blocks but the text in the paragraph inside is strangely have too much space between the words. Does anyone know how to adjust it? h3How can we help you?/h3 ul class=thumbnails li class=span3 div class=thumbnail {{=IMG(_src=URL('static/images','holder260_180.png'),_style=width: 250px,_class=img-polaroid,_alt=Order Status)}} h4Order Status/h4 pThumbnail caption.../p /div /li li class=span3 div class=thumbnail {{=IMG(_src=URL('static/images','holder260_180.png'),_style=width: 250px,_class=img-polaroid,_alt=Order Status)}} h4QA/h4 pTo search the Frequently Asked Questions/p /div /li li class=span3 div class=thumbnail {{=IMG(_src=URL('static/images','holder260_180.png'),_style=width: 250px,_class=img-polaroid,_alt=Order Status)}} h4Contact/h4 pThumbnail caption.../p /div /li /ul -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Dynamically change highlighted class for response.menu
for a pyhon solution (not involving javascript) you could check this argument https://groups.google.com/d/topic/web2py/8AHYqV_EKy0/discussion https://groups.google.com/d/topic/web2py/8AHYqV_EKy0/discussion Il giorno martedì 7 maggio 2013 17:56:10 UTC+2, Omi Chiba ha scritto: I have a following response.menu in my menu.py. By default Home is highlighted but I want to highlight the menu clicked by the user. For example, when user click contact, 'highlighted' class should be added to contact and removed from home. response.menu = [ (SPAN('Home', _class='highlighted'), False, URL('default', 'index'), []), (T('Order Status'), False, URL('default', 'orderstatus'), []), (T('QA'), False, URL('default', 'qa'), []), (T('Contact'), False, URL('default', 'contact'), []) ] -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Bulk insert: how to improve performances?
I didn't know that as well, Is there a limit in the number of dicts passed to the bulk_insert? Paolo On Monday, May 20, 2013 11:18:51 AM UTC+2, Niphlod wrote: there's a bulk_insert method too. http://web2py.com/books/default/chapter/29/06?search=bulk Il giorno lunedì 20 maggio 2013 10:36:32 UTC+2, Rocco ha scritto: Dear all, I've a loop to insert about 2K records into a postgres database (running on same host). This is the used code: for row in cnv.data_matrix: sensor_n=0 for element in row: db.CTD_DATA.insert(CTD_STATION_ID=stationid,SENSOR= sensor_n,VALUE=float(element)) sensor_n+=1 It takes more than 20 seconds, sometimes... also more. I could change the database structure to reduce the number of inserts, but there is a way to aggregate multiple insert o to improve the performances? Thanks in advance for any suggestion. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Bulk insert: how to improve performances?
At least with sqlite wrapping a list of insert by adding respectively at the beginning and at the end BEGIN TRANSACTION/END TRANSACTION allows to speed up the performance, see: http://stackoverflow.com/questions/1711631/how-do-i-improve-the-performance-of-sqlite could we do something like that in our bulk_insert? Paolo On Monday, May 20, 2013 2:57:30 PM UTC+2, Niphlod wrote: this is the implementation def bulk_insert(self, table, items): return [self.insert(table,item) for item in items] no limits there, but it doesn't leverage any native BULK operation, so, don't pass a list of 1 zillion dicts. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Scaling + performance tips to prepare for launch
It is worth to check this too https://developers.google.com/speed/pagespeed/insights Paolo On Tuesday, May 21, 2013 8:40:20 PM UTC+2, Niphlod wrote: the session.forget(response) will render all session related features useless. Use wisely. I'd add lazy_tables=True to your points, as well as a good cache backend and possibily the use of wise cache headers in the response. On Tuesday, May 21, 2013 7:34:28 PM UTC+2, smoggy wrote: Hi folks, I'm about to launch my site (http://nizen.net) and before launching i would like some scaling tips. Right now i've done the following: - using cloudflare for CDN. - compiled web2py .py - .pyc - in 0.py session.forget(response) - settings.migrate = False I'm using openshift also. If i try to reach the big sites (engadget, reddit, etc) i fear it may get the site broken. Any (other) tips ? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Postgres users beware auth.signature is_active; bad problem, easy to fix
I agree, it would be nice to have is_active as a real boolean although I don't know how difficult could be its implementation without breaking the backward compatibility. Furthermore, I've just checked my instance and is_active is saved as 'T' with postgres 9.1 Paolo On Friday, May 24, 2013 5:06:19 AM UTC+2, Massimo Di Pierro wrote: This is a backward compatibility issues. The fact that it inserts a 't' instead of a 'T' is more of a concern to me. How was the query built? The source clearly says: TRUE = 'T' FALSE = 'F' On Thursday, 23 May 2013 16:21:18 UTC-5, Cliff Kachinske wrote: auth.signature appends a boolean field called is_active to a table. The default is True. Under the covers it's not really boolean, it's char(1). When you insert a record, is_active is set to t. That's right, a lowercase t. Today I had the kind of problem where queries were missing records. It turns out that the DAL was emitting queries looking for 'T' in is_active. The queries were missing records because Postgres is case sensitive in char fields. I don't really understand why the dal adapters for Postgres transmogrify boolean fields to char(1) when Postgres supports boolean fields. The nice thing about that is Postgres boolean fields do not care about case. The easy fix for this problem is make sure that any fields you have defined as boolean in your models are also boolean in Postgres. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: DAL Select constant field
Hi, actually, I couldn't see the reason of that :-P but anyway this seems to work q=db( db.clients.id 0).select( db.clients.clientuuid, '%s' % 1) Paolo On Thursday, May 30, 2013 5:23:34 PM UTC+2, Zach wrote: Hi guys, I am trying to run something in the form of : select clientuuid, 1 from clients ; q=db( db.clients.id 0).select( db.clients.clientuuid, 1) I can settle for select clientuuid, 'Y' from clients ; however web2py is bing picky and weird and complains that AttributeError: 'int' object has no attribute 'type' in the former case and OperationalError: (1054, Unknown column 'y' in 'field list') in the latter. Is there a workaround I can use in that situation ? Ideally I would not like to add fields with constants to my tables. Thanks a lot for your time. Kind regards, Zach -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: web2py 2.4.7 admin Recent Tweets not loaded
Hi, now it seems to work but it is different than the former implementation, namely the current shows only tweets posted by the user web2py, however the most recent one is more than two months old. As is I don't see this so useful, actually It is a matter of communication and which information we want to spread from the admin page. Paolo On Friday, May 31, 2013 3:19:27 PM UTC+2, Massimo Di Pierro wrote: Done. in trunk. On Thursday, 30 May 2013 22:39:10 UTC-5, 黄祥 wrote: hi, just want to report that web2py 2.4.7 admin Recent Tweets not loaded. error: Unable to download because: local variable 'r' referenced before assignment applications/admin/controllers/default.py def twitter(): session.forget() session._unlock(response) import gluon.tools import gluon.contrib.simplejson as sj try: if TWITTER_HASH: page = urllib.urlopen( http://search.twitter.com/search.json?q=%%40%s; % TWITTER_HASH).read() data = sj.loads(page, encoding=utf-8)['results'] d = dict() *r = []* for e in data: d[e[id]] = e r = reversed(sorted(d)) return dict(tweets=[d[k] for k in r]) else: return 'disabled' except Exception, e: return DIV(T('Unable to download because:'), BR(), str(e)) ref: https://groups.google.com/forum/?fromgroups#!topic/web2py/rtUZeamzXp8 error is gone and also not showing any tweets if i'm not wrong twitter api had already deprecated, imho, if you want to use twitter tweets please use the embeded one provide by twitter (timelines, tweets, etc) ref: https://dev.twitter.com/ please correct and forgive me if i'm wrong best regards -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Problem overriding bootstrap.min.css with customized submit button style
please try: input.btn_auth { background:url('../images/button_02.png') no-repeat; border: 0px; width:205px; height:45px; position: relative; top:80px; left:97px; } input.btn_auth:hover { background:url('../images/button_hover_02.png') } input.btn_auth:active { background:url('../images/button_active.png') no-repeat; width:201px; height:41px; } Il giorno lunedì 3 giugno 2013 19:05:02 UTC+2, Lio ha scritto: Hello there, I'm trying to use a customized submit button for login. The problem is in normal status the button image is the correct one but width is controlled by bootstrap.min.css; in hover status the width is correct but image is overridden by bootstrap.min.css Driving me crazy... Code in view: {{form.custom.submit['_class']='btn_auth'}} {{=form.custom.submit}} Code in customized css file: .btn_auth { background:url('../images/button_02.png') no-repeat; border: 0px; width:205px; height:45px; position: relative; top:80px; left:97px; } .btn_auth:hover{ background:url('../images/button_hover_02.png'); border: 0px; width:205px; height:45px; position: relative; top:80px; left:97px; } .btn_auth:active{ background:url('../images/button_active.png') no-repeat; border: 0px; width:201px; height:41px; position: relative; top:80px; left:97px; } Can someone please advise? Thanks in advance. Lio -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: css help
In order to eliminate the issue under point 1, we could modify slightly the interested code in layout.html in: !-- Masthead == -- header class=mastheader row id=header div class=span12 div class=page-header h1{{if response.title is not None:}} {{=response.title}} small{{=response.subtitle or ''}}/small{{pass}} /h1 /div /div /header About point 2, in order to change the color of the links it's enough to set the following rules in web2py_bootstrap.css (preferibly on top of the file below the first rule): a{color: magenta;} a:visited{color: pink;} a:hover{color: red;} a:focus{color: brown;} a:active{color: darkmagenta;} Of course please change the color value at your taste. The same for the color of headers: h1{color: green;} h2{color: lightgreen;} h3{} h4{} h5{} h6{} Finally, for the image under menu there are several ways in order to obtain the same result. Replace the title with a big image: !-- Masthead == -- header class=mastheader row id=header div class=span12 div class=page-header {{response.title = XML('img src=%s alt=web2py image /' % (URL('static','images/big_image.jpg'))) # this is only for example}} {{response.subtitle = None # this is only for example}} h1{{if response.title is not None:}} {{=response.title}} small{{=response.subtitle or ''}}/small{{pass}} /h1 /div /div /header In this case the image will not be as wide as the page width. To obtain the right result we have to add a new element in layout.html and some css rules to web2py_bootstrap.css. Here attached the patched files. Please note that the code has not been deeply tested, so please let me know if you'll find bugs. Il giorno martedì 4 giugno 2013 16:20:21 UTC+2, Massimo Di Pierro ha scritto: I would like help with two css issues: 1) In layout.html if there is no response.title, the page content slides up and may disappear under the menu banner. Can we prevent this? 2) In web2py_bootstrap.css I would like to have example code to change the colors without changing the bootstrap.css (specifically color of links, headers, menu banner, and add a page wide image under the menu banner. These seems to be recurrent needs. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. Title: {{=response.title or request.application}} {{=response.flash or ''}} {{=response.logo or ''}} {{='auth' in globals() and auth.navbar(mode="dropdown") or ''}} {{is_mobile=request.user_agent().is_mobile}} {{if response.menu:}} {{=MENU(response.menu, _class='mobile-menu nav' if is_mobile else 'nav',mobile=is_mobile,li_class='dropdown',ul_class='dropdown-menu')}} {{pass}} {{#response.title = XML('' % (URL('static','images/bootstrap_idea2.png'))) # this is only for example}} {{#response.subtitle = None # this is only for example}} {{if response.title is not None:}} {{=response.title}} {{=response.subtitle or ''}}{{pass}} {{if left_sidebar_enabled:}} {{block left_sidebar}} Left Sidebar {{end}} {{pass}} {{block center}} {{include}} {{end}} {{if right_sidebar_enabled:}} {{block right_sidebar}} Right Sidebar {{end}} {{pass}} {{block footer}} {{=T('Copyright')}} {{=request.now.year}} {{=T('Powered by')}} web2py {{end}} {{if response.google_analytics_id:}} {{pass}} /*= CUSTOM RULES ==*/ body{height:auto;} /* to avoid vertical scroll bar */ a{} a:visited{} a:hover{} a:focus{} a:active{} h1{} h2{} h3{} h4{} h5{} h6{} div.flash.flash-center{left:25%;right:25%;}
[web2py] Re: Fun with Scheduler
I agree Scheduler is great. I use this technique: in modules/lib.py: def a_func(db): # some code # ... return in models/scheduler.py def a_func(): import lib return lib.a_func(db) from gluon.scheduler import Scheduler scheduler = Scheduler(db) in controllers/a_controller.py def a_func: import lib return lib.a_func(db) so the code is centralized in modules/lib.py and i can call the same code from controller or scheduled task. PB -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] admin access password file
Hi all, I have to migrate a web2py app to a centos server. It has python 2.6.6, uwsgi 1.9.12. admin fails saying: admin disabled because unable to access password file the file (parameters_443.py) is there. I tried to debug the failure and I discover that, despite the fact that I use https, it tries to access parameters_80.py. Thus, I created the file parameters_80.py but then it fails saying to use https :(. Paolo -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Save rendered .html views to file system
Hi, you could use cache.ram or cache.disc. Start by replacing the {{include 'footer.html' }} with something like: {{=response.render('footer.html', {your dict} )}} and then wrap that like {{=cache.ram( YOUR_KEY, lambda: response.render('footer.html', {your dict} ) , time_expire=YOUR_TIME_EXPIRE)}} footer.html will be rendered either if the key hasn't cached already or it is no longer valid (expired). Hope it helps Paolo On Wednesday, June 12, 2013 10:04:07 AM UTC+2, Annet wrote: In my application the header and footer of the layout, contain more or less static information (navbar, address, social etc.) Since this header and footer are shared by all users, their content is stored in a database. The problem is that on every request the database is queried for this 'semi' static content. I wonder whether it is possible to render the header and footer when the user edits his navigation, address etc. in the cms and then store it in a sub folder in the static folder and in layout.html have something like: {{include user_id_header}} {{include}} {{include user_id_footer}} where user_id_header and user_id_footer reference rendered .html files in 'static/user_6/header.html' and 'static/user_6/footer.html' respectively. Kind regards, Annet -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Spammers on web2pyslices.com
Personally I don't like captcha image, before delving into the implementation of whatever like that it is worth to try the honeypot mechanism namely a 'hidden field'. A field that if filled out allow you to distinguish between user and robots requests. The field it is hidden by css properties real users aren't able to fill it. More here: http://en.wikipedia.org/wiki/Honeypot_%28computing%29 Actually, I have never tested if that really works! we could think about implementing it as an option for web2py, it would be very welcome. Finally, it seems that web2pyslices.com registration has got a captcha, have you already implemented it? Paolo On Saturday, June 15, 2013 6:40:50 AM UTC+2, rochacbruno wrote: Hi, recently we are having too many spams posted on web2pyslices.com I am deleting one by one, but started to be difficult to track this. We need to implement a captcha system or any other kind of spam blocking. is there any volunter? to do this for user registration form and also for article post form? I am in a rush between work and medical treatments, I tried but I really have no time now to develop this. If anybody can take this, please email me ans I give you access to the development version of the code on pythonanywhere. Thanks. []'s --- Bruno Rocha http://github.com/rochacbruno http://rochacbruno.com.br http://terraqueos.org -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Spammers on web2pyslices.com
Hi, is a different solution but have you ever tried CloudFlare (cloudflare.com) service? It is a kind of proxy-cache online. I use it with my site that has very very low traffic :-) but open comments and spammers have disappeared. {the site is made with Plone but I have to upgrade to web2py as soon as possible ;-)} PB Il giorno sabato 15 giugno 2013 06:40:50 UTC+2, rochacbruno ha scritto: Hi, recently we are having too many spams posted on web2pyslices.com I am deleting one by one, but started to be difficult to track this. We need to implement a captcha system or any other kind of spam blocking. is there any volunter? to do this for user registration form and also for article post form? I am in a rush between work and medical treatments, I tried but I really have no time now to develop this. If anybody can take this, please email me ans I give you access to the development version of the code on pythonanywhere. Thanks. []'s --- Bruno Rocha http://github.com/rochacbruno http://rochacbruno.com.br http://terraqueos.org -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: admin access password file
Hi Massimo, I've just tried but the issue hasn't gone :( what can I do to debug it more, by who is the request.env.server_port setter ? Paolo On Sunday, June 16, 2013 10:32:37 AM UTC+2, Massimo Di Pierro wrote: After uwsgi_param UWSGI_SCHEME $scheme; you must add uwsgi_param HTTP_X_FORWARDED_PROTO https; On Wednesday, 12 June 2013 09:09:01 UTC-5, Paolo valleri wrote: Hi Massimo, I used https. I expired the same behavior on both apache and nginx. please find attached the condiguration file of nginx Paolo 2013/6/12 Massimo Di Pierro massimo@gmail.com In the URL, are you using http or https? Assuming you use apache, can you show the config file? On Wednesday, 12 June 2013 01:53:25 UTC-5, Paolo valleri wrote: Hi all, I have to migrate a web2py app to a centos server. It has python 2.6.6, uwsgi 1.9.12. admin fails saying: admin disabled because unable to access password file the file (parameters_443.py) is there. I tried to debug the failure and I discover that, despite the fact that I use https, it tries to access parameters_80.py. Thus, I created the file parameters_80.py but then it fails saying to use https :(. Paolo -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/1PDpL5yRKMs/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] @request.restful() only works on localhost
that could be a problem of a generic view not correctly loaded due to the following line in db.py response.generic_patterns = ['*'] if request.is_local else [] change it to response.generic_patterns = ['*'] Paolo On Monday, June 17, 2013 9:50:58 PM UTC+2, Michele Comitini wrote: send example code to reproduce the error please! model, controller and iff you have modified routes.py send that too. mic 2013/6/17 Eduardo Cruz educ...@gmail.com javascript: I have made an api using @request.restful() decorator but when I try to use the api from another machine it gives me an 404, Im running web2py with the built-in server at 0.0.0.0 -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: web2pyslice and PIL thumbnail quality
I am not sure but the quality option could be for jpeg only. Paolo On Thursday, June 20, 2013 5:06:06 PM UTC+2, lesssugar wrote: A bit of offtopic but maybe someone knows what's going on. I'm using this thumbnail generating slice I found: LINKhttp://www.web2pyslices.com/slice/show/1522/generate-a-thumbnail-that-fits-in-a-box All works fine but the problem I face is the thumbnails quality. I upload really high-quality images and the generated thumbs are definitely not HQ. I tried adding *quality=90 *argument to these lines of smarthumb.py: * * img.thumbnail(box, Image.ANTIALIAS) and img.save(request.folder + 'uploads/' + thumb) respectively: img.save(request.folder + 'uploads/' + thumb, quality=90) and img.save(request.folder + 'uploads/' + thumb, quality=90) -- no effect. Any ideas? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: disable left side panel in editor in 2.5
Are you looking for an hard-code option or for an easy-to-click button to reduce the whole panel? Paolo On Monday, June 24, 2013 8:31:48 PM UTC+2, Massimo Di Pierro wrote: Not sure but there should be. Please open a ticket and we will add it tonight. On Monday, 24 June 2013 05:05:34 UTC-5, lucas wrote: hello one and all, is there a setting to disable the left side panel that shows the filenames in the editor? my habits are used to it off. lucas -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Can page/chapter titles be added to the online book ?
I would add the title in the url, not only for a better seo but also for a faster in-browser url matching against visited url while typing, from: http://web2py.com/books/default/chapter/29/02 to: http://web2py.com/books/default/chapter/29/02/The database abstraction layerhttp://web2py.com/books/default/chapter/29/06#The-database-abstraction-layer actually even better without the 'default' Paolo On Monday, June 24, 2013 8:31:11 PM UTC+2, Massimo Di Pierro wrote: Good idea. Asap. It is easy to do. On Monday, 24 June 2013 05:01:11 UTC-5, Holger Schurig wrote: As I'm new to web2py, I usually have several tabs open to various web2py chapters from the online book. Unfortunately, the page title for each tab is web2py. See the attached screenshot. Can those book pages get more descriptive titles? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] datetime operation with dal (postgres)
Dear all, I am trying to run simple mathematical operations with datetime and postgres as backend (http://www.postgresql.org/docs/9.0/static/functions-datetime.html) I've prepared this simple example code: from datetime import timedelta db.define_table('test_sum', Field('first_int', 'integer'), Field('second_int', 'integer'), Field('first_date', 'datetime'), Field('second_date', 'datetime'), ) db.test_sum.insert(first_int=40, second_int=30, first_date=request.now, second_date=request.now-timedelta(days=1)) diff_int = db.test_sum.first_int - db.test_sum.second_int diff_date = db.test_sum.first_date - db.test_sum.second_date print db(db.test_sum).select(diff_int) print db(db.test_sum).select(diff_date) With postgres the first query is executed correctly, the second failed raising the ticket: Traceback (most recent call last): File /home/pvalleri/src/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/pvalleri/src/web2py/applications/vtraffic/models/db.py http://127.0.0.1:8000/admin/edit/vtraffic/models/db.py, line 98, in module print db(db.test_sum).select(diff_date) File /home/pvalleri/src/web2py/gluon/dal.py, line 9935, in select return adapter.select(self.query,fields,attributes) File /home/pvalleri/src/web2py/gluon/dal.py, line 1709, in select return self._select_aux(sql,fields,attributes) File /home/pvalleri/src/web2py/gluon/dal.py, line 1690, in _select_aux return processor(rows,fields,self._colnames,cacheable=cacheable) File /home/pvalleri/src/web2py/gluon/dal.py, line 2093, in parse fields[j].type,blob_decode) File /home/pvalleri/src/web2py/gluon/dal.py, line 1908, in parse_value return self.parsemap[key](value,field_type) File /home/pvalleri/src/web2py/gluon/dal.py, line 1995, in parse_double return float(value) TypeError: float() argument must be a string or a number To some extent the interesting ticket is that, the query generated works without problems (tested with pgadmin). SELECT (test_sum.second_date - test_sum.first_date) FROM test_sum WHERE (test_sum.id IS NOT NULL); Moreover, I run the same example with sqlite, it worked well without error, the resulting values are wrong though. What can I do? Paolo -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: datetime operation with dal (postgres)
Hi Massimo, can you point out how to write query with date diff? I tried this: db(diff_date timedelta(days=4)).select() and I got the same ticket, I don't know if this is there right way for expressing query with date_diff. Paolo On Friday, June 28, 2013 12:41:13 PM UTC+2, Massimo Di Pierro wrote: Please open a ticket about this. Expressions like date_diff were designed to be in the query, not in the list of selected columns. I think this can be done but need to check what breaks. On Friday, 28 June 2013 03:02:06 UTC-5, Paolo valleri wrote: Dear all, I am trying to run simple mathematical operations with datetime and postgres as backend ( http://www.postgresql.org/docs/9.0/static/functions-datetime.html) I've prepared this simple example code: from datetime import timedelta db.define_table('test_sum', Field('first_int', 'integer'), Field('second_int', 'integer'), Field('first_date', 'datetime'), Field('second_date', 'datetime'), ) db.test_sum.insert(first_int=40, second_int=30, first_date=request.now, second_date=request.now-timedelta(days=1)) diff_int = db.test_sum.first_int - db.test_sum.second_int diff_date = db.test_sum.first_date - db.test_sum.second_date print db(db.test_sum).select(diff_int) print db(db.test_sum).select(diff_date) With postgres the first query is executed correctly, the second failed raising the ticket: Traceback (most recent call last): File /home/pvalleri/src/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/pvalleri/src/web2py/applications/vtraffic/models/db.py http://127.0.0.1:8000/admin/edit/vtraffic/models/db.py, line 98, in module print db(db.test_sum).select(diff_date) File /home/pvalleri/src/web2py/gluon/dal.py, line 9935, in select return adapter.select(self.query,fields,attributes) File /home/pvalleri/src/web2py/gluon/dal.py, line 1709, in select return self._select_aux(sql,fields,attributes) File /home/pvalleri/src/web2py/gluon/dal.py, line 1690, in _select_aux return processor(rows,fields,self._colnames,cacheable=cacheable) File /home/pvalleri/src/web2py/gluon/dal.py, line 2093, in parse fields[j].type,blob_decode) File /home/pvalleri/src/web2py/gluon/dal.py, line 1908, in parse_value return self.parsemap[key](value,field_type) File /home/pvalleri/src/web2py/gluon/dal.py, line 1995, in parse_double return float(value) TypeError: float() argument must be a string or a number To some extent the interesting ticket is that, the query generated works without problems (tested with pgadmin). SELECT (test_sum.second_date - test_sum.first_date) FROM test_sum WHERE ( test_sum.id IS NOT NULL); Moreover, I run the same example with sqlite, it worked well without error, the resulting values are wrong though. What can I do? Paolo -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Stop menu from collapsing
This should work: replace navbar section in layout.html with !-- Navbar == -- div class=navbar navbar-inverse div class=flash{{=response.flash or ''}}/div div class=navbar-inner div class=container {{is_mobile=request.user_agent().is_mobile}} !-- the next tag is necessary for bootstrap menus, do not remove -- button type=button class=btn btn-navbar data-toggle=collapse data-target=.nav-collapse style={{='display:none;' if not is_mobile else ''}} span class=icon-bar/span span class=icon-bar/span span class=icon-bar/span /button {{=response.logo or ''}} ul id=navbar class=nav pull-right{{='auth' in globals() and auth.navbar(mode=dropdown) or ''}}/ul div class={{='nav-collapse' if is_mobile else 'nav'}} {{if response.menu:}} {{=MENU(response.menu, _class='mobile-menu nav' if is_mobile else 'nav',mobile=is_mobile,li_class='dropdown',ul_class='dropdown-menu')}} {{pass}} /div!--/.nav-collapse -- /div /div /div!--/top navbar -- In attachment the patched file. The code has not been tested in mobiles so please try before to use it. Il giorno giovedì 27 giugno 2013 09:04:49 UTC+2, Massimo Di Pierro ha scritto: I would like to know it too. It should only happen when detecting a mobile device. On Thursday, 27 June 2013 01:57:44 UTC-5, James Burke wrote: Hi, Is it possible to stop the menu from collapsing into a button when the window width is resized smaller? Or do I have to start from scratch. Cheers James -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. Title: {{=response.title or request.application}} {{=response.flash or ''}} {{is_mobile=request.user_agent().is_mobile}} {{=response.logo or ''}} {{='auth' in globals() and auth.navbar(mode="dropdown") or ''}} {{if response.menu:}} {{=MENU(response.menu, _class='mobile-menu nav' if is_mobile else 'nav',mobile=is_mobile,li_class='dropdown',ul_class='dropdown-menu')}} {{pass}} {{if response.title:}} {{=response.title}} {{=response.subtitle or ''}} {{pass}} {{if left_sidebar_enabled:}} {{block left_sidebar}} Left Sidebar {{end}} {{pass}} {{block center}} {{include}} {{end}} {{if right_sidebar_enabled:}} {{block right_sidebar}} Right Sidebar {{end}} {{pass}} {{block footer}} {{=T('Copyright')}} {{=request.now.year}} {{=T('Powered by')}} web2py {{end}} {{if response.google_analytics_id:}} {{pass}}
[web2py] Re: Radio Buttons layout problem with trunk
Please put the following code in your custom css file (or in the bottom of web2py_bootstrap.css if you are using the welcome app scaffolding): .generic-widget input[type='radio'] {margin:-1px 0 0 0; vertical-align:middle ;} .generic-widget input[type='radio'] + label {display:inline-block; margin:0 0 0 6px; vertical-align: middle;} Bootstrap framework has a html structure for radio controls different from web2py radio widget. For this reason the issue has been raised. Il giorno giovedì 18 luglio 2013 10:12:20 UTC+2, Johann Spies ha scritto: I took the welcome app (trunk version), added the following model: db.define_table(toets_radio, Field('yesno', requires=IS_IN_SET([(0, 'No'), (1, 'Yes')]), widget = SQLFORM.widgets.radio.widget)) And it produced this view there the radio button and the label are on two different lines (see attached screenshot). Then I replaced the /static directory and /views/layout.html with a version from an older app and the radio button and it's label was next to each other as expected (see second screenshot). I was so far unable to determine what exactly causes this and have wasted several hours to solve the problem in the trunk version. I would appreciate it if someone more knowledgable than me can solve this. The bootstrap version in the css that worked correctly was 2.04. Unfortunately the web2py*.css files did not have a version in. Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. attachment: radio_aligned.jpg
[web2py] Re: Radio Buttons layout problem with trunk
I answered to a specific question but you are right: the code should go in web2py_bootstrap.css in order to solve the conflict. Anyway we have to check that the patch doesn't break anything else. Therefore please give me a bit of the time and I will open an issue ticket on the issue tracker together with the patch. Il giorno giovedì 18 luglio 2013 17:56:50 UTC+2, Massimo Di Pierro ha scritto: Should this go in web2py_bootstrap.css? On Thursday, 18 July 2013 10:51:15 UTC-5, Paolo Caruccio wrote: Please put the following code in your custom css file (or in the bottom of web2py_bootstrap.css if you are using the welcome app scaffolding): .generic-widget input[type='radio'] {margin:-1px 0 0 0; vertical-align:middle ;} .generic-widget input[type='radio'] + label {display:inline-block; margin :0 0 0 6px; vertical-align: middle;} Bootstrap framework has a html structure for radio controls different from web2py radio widget. For this reason the issue has been raised. Il giorno giovedì 18 luglio 2013 10:12:20 UTC+2, Johann Spies ha scritto: I took the welcome app (trunk version), added the following model: db.define_table(toets_radio, Field('yesno', requires=IS_IN_SET([(0, 'No'), (1, 'Yes')]), widget = SQLFORM.widgets.radio.widget)) And it produced this view there the radio button and the label are on two different lines (see attached screenshot). Then I replaced the /static directory and /views/layout.html with a version from an older app and the radio button and it's label was next to each other as expected (see second screenshot). I was so far unable to determine what exactly causes this and have wasted several hours to solve the problem in the trunk version. I would appreciate it if someone more knowledgable than me can solve this. The bootstrap version in the css that worked correctly was 2.04. Unfortunately the web2py*.css files did not have a version in. Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: better calendar.js?
How to Turn Off Form Autocompletionhttps://developer.mozilla.org/en-US/docs/Mozilla/How_to_Turn_Off_Form_Autocompletion?redirectlocale=en-USredirectslug=How_to_Turn_Off_Form_Autocompletion Il giorno giovedì 18 luglio 2013 21:46:46 UTC+2, Jim S ha scritto: I have no idea what version my calendar.js is. Is that something that can just be overwritten whenever you do an update of web2py? Also, has this been addressed in more recent versions of web2py? -Jim On Thursday, July 18, 2013 2:30:58 PM UTC-5, Willoughby wrote: I believe you can override that (it's a browser feature) with HTML5: http://www.w3.org/wiki/HTML/Elements/input/text On Thursday, July 18, 2013 1:32:47 PM UTC-4, Jim S wrote: My main complaint with the current datetime picker is that you can get in situations where (in Firefox at least) you can have a dropdown of previous entries appear over the calendar itself. See attached screen shot. -Jim On Wednesday, July 17, 2013 1:28:14 PM UTC-5, Annet wrote: I had a look at the datetime picker, I miss the month and year menus and the week of the year. Furthermore I find the display of dates in other months distracting, the styling could be a bit more calendar like. Kind regards, Annet. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: better calendar.js?
Well, the automplete is a form | input attribute and therefore you could set in HTML code form name=form1 id=form1 method=post autocomplete=off action=... /form or input type=text name=myfield autocomplete=off w3c documentation: for the form http://www.w3.org/TR/2012/CR-html5-20121217/forms.html#attr-form-autocomplete for the input http://www.w3.org/TR/2012/CR-html5-20121217/forms.html#the-autocomplete-attribute Il giorno giovedì 18 luglio 2013 22:16:34 UTC+2, Jim S ha scritto: that may work for 1 browser but I can't require that all users of the app turn off auto-complete. On Thu, Jul 18, 2013 at 3:03 PM, Paolo Caruccio paolo.ca...@gmail.comjavascript: wrote: How to Turn Off Form Autocompletionhttps://developer.mozilla.org/en-US/docs/Mozilla/How_to_Turn_Off_Form_Autocompletion?redirectlocale=en-USredirectslug=How_to_Turn_Off_Form_Autocompletion Il giorno giovedì 18 luglio 2013 21:46:46 UTC+2, Jim S ha scritto: I have no idea what version my calendar.js is. Is that something that can just be overwritten whenever you do an update of web2py? Also, has this been addressed in more recent versions of web2py? -Jim On Thursday, July 18, 2013 2:30:58 PM UTC-5, Willoughby wrote: I believe you can override that (it's a browser feature) with HTML5: http://www.w3.org/wiki/HTML/**Elements/input/texthttp://www.w3.org/wiki/HTML/Elements/input/text On Thursday, July 18, 2013 1:32:47 PM UTC-4, Jim S wrote: My main complaint with the current datetime picker is that you can get in situations where (in Firefox at least) you can have a dropdown of previous entries appear over the calendar itself. See attached screen shot. -Jim On Wednesday, July 17, 2013 1:28:14 PM UTC-5, Annet wrote: I had a look at the datetime picker, I miss the month and year menus and the week of the year. Furthermore I find the display of dates in other months distracting, the styling could be a bit more calendar like. Kind regards, Annet. -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/5NfsFtnv8Ww/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: better calendar.js?
I don't think so but you could set the autocomplete attribute of date inputs in your form to off by adding in the related controller: inp_dates = form.elements('input', _class='date') for inp_date in inp_dates: inp_date['_autocomplete'] = 'off' Il giorno giovedì 18 luglio 2013 23:42:21 UTC+2, Jim S ha scritto: So it should be an update to the widget, right? -Jim On Thu, Jul 18, 2013 at 4:24 PM, Paolo Caruccio paolo.ca...@gmail.comjavascript: wrote: Well, the automplete is a form | input attribute and therefore you could set in HTML code form name=form1 id=form1 method=post autocomplete=off action= ... /form or input type=text name=myfield autocomplete=off w3c documentation: for the form http://www.w3.org/TR/2012/CR-html5-20121217/forms.html#attr-form-autocomplete for the input http://www.w3.org/TR/2012/CR-html5-20121217/forms.html#the-autocomplete-attribute Il giorno giovedì 18 luglio 2013 22:16:34 UTC+2, Jim S ha scritto: that may work for 1 browser but I can't require that all users of the app turn off auto-complete. On Thu, Jul 18, 2013 at 3:03 PM, Paolo Caruccio paolo.ca...@gmail.comwrote: How to Turn Off Form Autocompletionhttps://developer.mozilla.org/en-US/docs/Mozilla/How_to_Turn_Off_Form_Autocompletion?redirectlocale=en-USredirectslug=How_to_Turn_Off_Form_Autocompletion Il giorno giovedì 18 luglio 2013 21:46:46 UTC+2, Jim S ha scritto: I have no idea what version my calendar.js is. Is that something that can just be overwritten whenever you do an update of web2py? Also, has this been addressed in more recent versions of web2py? -Jim On Thursday, July 18, 2013 2:30:58 PM UTC-5, Willoughby wrote: I believe you can override that (it's a browser feature) with HTML5: http://www.w3.org/wiki/HTML/**El**ements/input/texthttp://www.w3.org/wiki/HTML/Elements/input/text On Thursday, July 18, 2013 1:32:47 PM UTC-4, Jim S wrote: My main complaint with the current datetime picker is that you can get in situations where (in Firefox at least) you can have a dropdown of previous entries appear over the calendar itself. See attached screen shot. -Jim On Wednesday, July 17, 2013 1:28:14 PM UTC-5, Annet wrote: I had a look at the datetime picker, I miss the month and year menus and the week of the year. Furthermore I find the display of dates in other months distracting, the styling could be a bit more calendar like. Kind regards, Annet. -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/** topic/web2py/5NfsFtnv8Ww/**unsubscribehttps://groups.google.com/d/topic/web2py/5NfsFtnv8Ww/unsubscribe . To unsubscribe from this group and all its topics, send an email to web2py+un...@**googlegroups.com. For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/5NfsFtnv8Ww/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: real time graph
Have a look at http://www.flotcharts.org/ Paolo On Friday, July 19, 2013 12:58:54 AM UTC+2, Vera Moreira wrote: hi everyone, I need some help, does anyone have examples on how to do a real time graph. What I need is a graph to constantly show random numbers, I´m using matplotlib I already have this info: from Antonis Tzorvas an idea for a real-time approach graph you have to go with gifs generated by the several .draw()s and save *.gif in static/images folder but i've just found this one: http://jakevdp.github.io/blog/2012/08/18/matplotlib-animation-tutorial/ from Ovidio Marinho A good option would also google maps. See this done with google maps and web2py. http://mosaico.no-ip.org/mosaico/regionalizacao/regmapa . For graphs with movements that would be better http://mosaico.no-ip.org/mosaico/mortalidadeinfantil/neonatalmun.html?municipio=Agua+Brancabotao=muniind=neonatal graphs are interactive and very good http://www.highcharts.com/ -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: better calendar.js?
Anyway, we could take in consideration the button alternative that, in my opinion, is more flexible. I mean that the calendar popup should be shown when the user clicks a button near the control and not when the control is focused. In this way the autocomplete browser feature (that, in some scenarios, could be useful) will be preserved and, from a developer point of view, it's simpler remove a button or change its onclick action when he/she want use an other calendar or even use the html5 calendar feature. Il giorno venerdì 19 luglio 2013 15:13:25 UTC+2, Paolo Caruccio ha scritto: We could also change web2py.js Attached the file modified. Il giorno venerdì 19 luglio 2013 10:40:44 UTC+2, Massimo Di Pierro ha scritto: How about we put this in web2py,js? jQuery('input.date,input.datetime,input.time').attr('autocomplete','off') Massimo On Thursday, 18 July 2013 17:11:19 UTC-5, Paolo Caruccio wrote: I don't think so but you could set the autocomplete attribute of date inputs in your form to off by adding in the related controller: inp_dates = form.elements('input', _class='date') for inp_date in inp_dates: inp_date['_autocomplete'] = 'off' Il giorno giovedì 18 luglio 2013 23:42:21 UTC+2, Jim S ha scritto: So it should be an update to the widget, right? -Jim On Thu, Jul 18, 2013 at 4:24 PM, Paolo Caruccio paolo.ca...@gmail.comwrote: Well, the automplete is a form | input attribute and therefore you could set in HTML code form name=form1 id=form1 method=post autocomplete=off action = ... /form or input type=text name=myfield autocomplete=off w3c documentation: for the form http://www.w3.org/TR/2012/CR-html5-20121217/forms.html#attr-form-autocomplete for the input http://www.w3.org/TR/2012/CR-html5-20121217/forms.html#the-autocomplete-attribute Il giorno giovedì 18 luglio 2013 22:16:34 UTC+2, Jim S ha scritto: that may work for 1 browser but I can't require that all users of the app turn off auto-complete. On Thu, Jul 18, 2013 at 3:03 PM, Paolo Caruccio paolo.ca...@gmail.com wrote: How to Turn Off Form Autocompletionhttps://developer.mozilla.org/en-US/docs/Mozilla/How_to_Turn_Off_Form_Autocompletion?redirectlocale=en-USredirectslug=How_to_Turn_Off_Form_Autocompletion Il giorno giovedì 18 luglio 2013 21:46:46 UTC+2, Jim S ha scritto: I have no idea what version my calendar.js is. Is that something that can just be overwritten whenever you do an update of web2py? Also, has this been addressed in more recent versions of web2py? -Jim On Thursday, July 18, 2013 2:30:58 PM UTC-5, Willoughby wrote: I believe you can override that (it's a browser feature) with HTML5: http://www.w3.org/wiki/HTML/**El**ements/input/texthttp://www.w3.org/wiki/HTML/Elements/input/text On Thursday, July 18, 2013 1:32:47 PM UTC-4, Jim S wrote: My main complaint with the current datetime picker is that you can get in situations where (in Firefox at least) you can have a dropdown of previous entries appear over the calendar itself. See attached screen shot. -Jim On Wednesday, July 17, 2013 1:28:14 PM UTC-5, Annet wrote: I had a look at the datetime picker, I miss the month and year menus and the week of the year. Furthermore I find the display of dates in other months distracting, the styling could be a bit more calendar like. Kind regards, Annet. -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/** topic/web2py/5NfsFtnv8Ww/**unsubscribehttps://groups.google.com/d/topic/web2py/5NfsFtnv8Ww/unsubscribe . To unsubscribe from this group and all its topics, send an email to web2py+un...@**googlegroups.com. For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/5NfsFtnv8Ww/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Errors in form, please check it out....... HOW?
In the last trunk of web2py, the form input error message is more visible. See attached image. Il giorno lunedì 17 giugno 2013 16:04:50 UTC+2, REM ha scritto: I'm attempting to understand a few things and decided to test out one of the items at: http://web2py.com/appliances Specifically, the video library example at the bottom of the page. I tried installing it from the URL feature on the admin page but I get the message: Errors in form, please check it out However, how in the world does one check it out? WHERE is it? WHAT, in fact, am I checking out? I downloaded the referenced .web2py file and my (Ubuntu) system tells me it's a gzipped file, but I can't open it with anything. I then tried installing that locally downloaded file through admin: same error. So, I tried downloading and installing others and, in every single case: no donuts! So, how does one even begin to figure out the cause of this? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. attachment: error_msg_more_visible_i.jpg
[web2py] Re: Google Analytics - 'analytics is not defined' error
You found an issue, in the welcome app the analytics library is shiped as minified, given that the correct file name is analytics.min.jshttps://github.com/web2py/web2py/blob/master/applications/welcome/static/js/analytics.min.jsinstead of analytics.jshttps://github.com/web2py/web2py/blob/master/applications/welcome/static/js/analytics.min.js btw, it is a bit out of date. Paolo On Wednesday, July 24, 2013 4:12:34 PM UTC+2, st...@hurlingstats.com wrote: Wondering if anyone has seen this. I've set my tracking id in menu.py response.google_analytics_id = 'UA--X' When I load my site, I get js errors: SyntaxError: syntax error http://127.0.0.1:8000/mysite/static/js/analytics.js Line 4 ReferenceError: analytics is not defined http://127.0.0.1:8000/mysite/controller/default Line 2682 This is what I have in layout.html {{if response.google_analytics_id:}} script src={{=URL('static','js/analytics.js')}}/script script type=text/javascript analytics.initialize({ 'Google Analytics':{trackingId:'{{=response.google_analytics_id}}'} });/script {{pass}} Using web2py v2.5.1-stable+timestamp.2013.06.06.10.23.23 -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py][share] ressources
On Wednesday, July 24, 2013 4:47:37 PM UTC+2, Richard wrote: Hello, I recently discover these two lib : http://johnny.github.io/jquery-sortable/ (avoid jquery ui just to get drag and drop capability) thanks for sharing, I would try to use that with bootstrap tabs. http://fgnass.github.io/spin.js/ (a spinner lib) :) Richard -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Err 24: too many files open
dederocks, I've just tried to run lsof -p uwsgi pid# on a ubuntu server running web2py In my case, it returns 138 opened files among libraries, sockets and so on; the most opened file is /dev/zero, opened 55 times. Paolo On Thursday, July 25, 2013 8:18:32 AM UTC+2, dederocks wrote: Thanks a lot for the link. Unfortunately it didn't help. @roberto: the uwsgi process is then indeed eating all the CPU - but I'm not sure it means uwsgi is the culprit, at least at this stage (could be the case earlier though). Is there in linux a way to know who opened which file and when? lsof gives only the process, not the time. Le mercredi 24 juillet 2013 23:56:10 UTC+2, Niphlod a écrit : it's a problem on the layers at the base of web2py, such as the os, nginx or uwsgi. http://www.cyberciti.biz/faq/linux-unix-nginx-too-many-open-files/ let's see if @roberto (the developer behind uwsgi) passes by with some useful tips too. On Wednesday, July 24, 2013 4:30:51 PM UTC+2, dederocks wrote: I'm running web2py on nginx /uwsgi. And in a sequence implying frequent serveur calls, I eventually get an error 500 from the server, which is actualy an error 24: too many files open (see ticket in attachement). I checked former reports on this error, but none seems to match this case: I'm not using rocket, and running the latest web2py stable version. I checked also on opening files myself, but that is never the case (e.g. always done by web2py). I tried to increase the file opened limit (ulimit -SHn 4048), but to no improvement. Any suggestion? Thanks in advance, Andre -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Err 24: too many files open
I am not a redis expert and I don't know how web2py handles the interaction with redis, either. However the scenario could be, either you instantiate one or more new connections for request or 'expired' connections are not closed. I am for the former case, could you post few lines where redis is instantiated? Paolo On Thursday, July 25, 2013 8:48:37 AM UTC+2, dederocks wrote: Thank you Paolo for the benchmark! In my case, I start at 107, and at the end of the process the count is at 672!! nginx on the other hand is stable around 55. And the culprit is (drums ...): redis! The large majority of the files opened are the redis port. Extract from lsof: uwsgi 2128 www-data 511u IPv4 62305 0t0 TCP localhost:56632-localhost:6379 (ESTABLISHED) uwsgi 2128 www-data 512u IPv4 62536 0t0 TCP localhost:56661-localhost:6379 (ESTABLISHED) uwsgi 2128 www-data 513u IPv4 62361 0t0 TCP localhost:56639-localhost:6379 (ESTABLISHED) uwsgi 2128 www-data 514u IPv4 62377 0t0 TCP localhost:56641-localhost:6379 (ESTABLISHED) uwsgi 2128 www-data 515u IPv4 62392 0t0 TCP localhost:56643-localhost:6379 (ESTABLISHED) Does someone know how to fix this? Le jeudi 25 juillet 2013 08:28:08 UTC+2, Paolo Valleri a écrit : dederocks, I've just tried to run lsof -p uwsgi pid# on a ubuntu server running web2py In my case, it returns 138 opened files among libraries, sockets and so on; the most opened file is /dev/zero, opened 55 times. Paolo On Thursday, July 25, 2013 8:18:32 AM UTC+2, dederocks wrote: Thanks a lot for the link. Unfortunately it didn't help. @roberto: the uwsgi process is then indeed eating all the CPU - but I'm not sure it means uwsgi is the culprit, at least at this stage (could be the case earlier though). Is there in linux a way to know who opened which file and when? lsof gives only the process, not the time. Le mercredi 24 juillet 2013 23:56:10 UTC+2, Niphlod a écrit : it's a problem on the layers at the base of web2py, such as the os, nginx or uwsgi. http://www.cyberciti.biz/faq/linux-unix-nginx-too-many-open-files/ let's see if @roberto (the developer behind uwsgi) passes by with some useful tips too. On Wednesday, July 24, 2013 4:30:51 PM UTC+2, dederocks wrote: I'm running web2py on nginx /uwsgi. And in a sequence implying frequent serveur calls, I eventually get an error 500 from the server, which is actualy an error 24: too many files open (see ticket in attachement). I checked former reports on this error, but none seems to match this case: I'm not using rocket, and running the latest web2py stable version. I checked also on opening files myself, but that is never the case (e.g. always done by web2py). I tried to increase the file opened limit (ulimit -SHn 4048), but to no improvement. Any suggestion? Thanks in advance, Andre -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Appending div class=error for validation using jQuery.
Please try; jQuery(div class='error'Please Enter Name/div/div).appendTo(jQuery( #taxpayer_name).parent()); or jQuery(div class='error'Please Enter Name/div/div).insertAfter( #taxpayer_name); Your code fails because the div.error is created inside the input element Il giorno giovedì 25 luglio 2013 13:39:34 UTC+2, Prasad Muley ha scritto: has anybody got my question? On Thu, Jul 25, 2013 at 2:30 PM, Prasad Muley pmm...@gmail.comjavascript: wrote: Hello Joe, I made a mistake while pasting. // working isn't there in updated code. actual code is {{extend 'layout.html'}} {{=form}} script jQuery(document).ready( function(){ var flag=0 jQuery('.web2py_form').submit(function(){ //Getting value from tracker status var get_data=jQuery(this).html(); var get_name=jQuery('#taxpayer_name').val() if(get_name ==) { if(flag==0) { //Following are working //alert(Please Enter valid Name); // jQuery(div class='error'Please Enter Valid Name/div).appendTo(#taxpayer_name__label) //jQuery(div class='error'Please Enter Valid Name/div).appendTo(.w2p_fw) jQuery(div class='error'Please Enter Name/div/div).appendTo(#taxpayer_name); flag=1 } return false } }); }); /script As per your advice I opened firebug and found no errors ( I've attached screen shot) But When I opened Web console It shows me one error as Empty string passed to getElementById(). If it works on other fields then why it should work in field also. On Thu, Jul 25, 2013 at 1:25 PM, Joe Barnhart joe.ba...@gmail.comjavascript: wrote: It's probably just a typo, but shouldn't there be a semi-colon after the line that is // WORKING as a comment? You need to separate javascript lines with semi-colons, except for the last statement in a function. (But even there it doesn't hurt anything if you put one in.) Get Firebug on Firefox and open the console pane. It shows you if you have any javascript errors. -- Joe B. On Wednesday, July 24, 2013 10:05:52 PM UTC-7, Prasad Muley wrote: Hello All, I am newbie web2py programmer. I tried to do custom validation using jQuery but not gettng expected result. Code is as followed: *Model-db.py* db.define_table('taxpayer', Field('name'), Field('married','boolean'), Field('spouse_name') ) # I don't want use IS_NOT_EMPTY() in this table *Controller-default.py* def taxer(): grid=SQLFORM.grid(db.taxpayer,**user_signature=False) if request.args(0) in ['edit']: form=grid.update_form if form.process().accepted: response.flash=form.vars return dict(grid=grid) * * *View- default/taxer.html* {{extend 'layout.html'}} {{=grid}} script jQuery(document).ready( function(){ var flag=0 jQuery('.web2py_form').submit(**function(){ //Getting value from tracker status var get_name=jQuery('#taxpayer_**name').val() if(get_name ==) { if(flag==0) { //alert(Please Enter valid Name); WORKING jQuery(div class='error'Please Enter Valid Name/div).appendTo(#**taxpayer_name__label) // WORKING jQuery(div class='error'Please Enter Valid Name/div).appendTo(#**taxpayer_name) // NOT WORKING flag=1 } return false } }); }); /script Please help me for this. I want to display error message for 'name' field as IS_NOT_EMPTY() does. It successfully does for taxpayer_name__label even as well as taxpayer_name__row but isn't working for taxpayer_name id. -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/orFuJ3h2JxY/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Thanks and Regards Prasad M. Muley Programmer at One Delta Synergies Pvt Ltd. [ Themis Group ] | PICT 2013 “Pretty much everything on the web uses those two things: *C* and *UNIX*,” - Dennis Ritchie *http://www.cs.bell-labs.com/who/dmr/*http://www.cs.bell-labs.com/who/dmr/ -- Thanks and Regards Prasad M. Muley Programmer at One Delta Synergies Pvt Ltd. [ Themis Group ] | PICT 2013 “Pretty much
Re: [web2py] Re: This javascript worked in older version of web2py - not in trunk version.
Yes the issue is due to jquery version. In your code, please replace .prop() to .attr() (for reference see http://api.jquery.com/prop/) Below code worked in my test: script jQuery(document).ready(function(){ jQuery('#a2_other').hide(); jQuery('#survey_a2').change(function(){ console.log('table changed', jQuery('#a27').attr('checked')); if(jQuery('#a27').prop('checked')){ jQuery('#a2_other').show();} else {jQuery('#a2_other').hide();} }); }); /script Il giorno giovedì 25 luglio 2013 12:12:43 UTC+2, Johann Spies ha scritto: I did that (again) now and immediately the javascript stopped working as expected. Then I just put back the file jsquery (*/*! jQuery v@1.8.0)* from the older copy of the app and the javascript worked again as expected. Regards Johann On 24 July 2013 18:42, Richard Vézina ml.richa...@gmail.com javascript: wrote: Johann don't forget to update the other files too... https://groups.google.com/d/msg/web2py/tVyL7z7WHkw/mce13Vh-k3UJ Richard On Wed, Jul 24, 2013 at 4:46 AM, Johann Spies johann...@gmail.comjavascript: wrote: On Wednesday, 24 July 2013 09:54:28 UTC+2, Johann Spies wrote: I have not been able to determine the exact course of the problem. It seems that static/js/jquery.js is the problem. Replacing the file in the working app with the one from the Welcome app, breaks things. Regards Johann -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.