Re: [web2py] Re: web2py Scheduler with Postgres creates idle in transaction connections

2015-02-19 Thread Niphlod
in my environment, I can't see any idle in transaction that's why I 
patched the scheduler and asked to do that test.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


Re: [web2py] not web2py question - test timezone detection

2015-02-19 Thread Martin Weissenboeck
From Austria: Europe/Berlin (no surprise... :-))
Regards, Martin

2015-02-19 9:57 GMT+01:00 Mirek Zvolský zvol...@seznam.cz:

 If you want to help,
 can you access
 http://praha.alwaysdata.net/testjstz/testjstz
 and see what this will write in your country? -- for me: Europe/Berlin.

 Here is source - my web2py code with jstz library (timezone detect from
 browser):
 def testjstz():
 return 'htmlhead/headbodyscript src=
 https://cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.4/jstz.min.js
 /scriptscriptdocument.write(jstz.determine().name());/script/body/html'

 If you are more active, you can test it from second browsers or through
 web proxy:

 Web proxies - examples:
 https://hide.me/en/proxy
 https://www.filterbypass.me/
 http://www.webproxy.net/
 www.where*isip*.net/ will write where the ip of the proxy is located.

 Thank you.
 Mirek

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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/d/optout.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


Re: [web2py] not web2py question - test timezone detection

2015-02-19 Thread Niphlod
me too, I live in Italy, so it's correct.

On Thursday, February 19, 2015 at 10:01:43 AM UTC+1, mweissen wrote:

 From Austria: Europe/Berlin (no surprise... :-))
 Regards, Martin

 2015-02-19 9:57 GMT+01:00 Mirek Zvolský zvo...@seznam.cz javascript::

 If you want to help,
 can you access
 http://praha.alwaysdata.net/testjstz/testjstz
 and see what this will write in your country? -- for me: Europe/Berlin.

 Here is source - my web2py code with jstz library (timezone detect from 
 browser):
 def testjstz():
 return 'htmlhead/headbodyscript src=
 https://cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.4/jstz.min.js
 /scriptscriptdocument.write(jstz.determine().name());/script/body/html'

 If you are more active, you can test it from second browsers or through 
 web proxy:

 Web proxies - examples:
 https://hide.me/en/proxy
 https://www.filterbypass.me/
 http://www.webproxy.net/
 www.where*isip*.net/ will write where the ip of the proxy is located.

 Thank you.
 Mirek

 -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 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/d/optout.





 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] return javascript alert from contorler without redirection

2015-02-19 Thread Yebach
Hello

I have a button for user to export some data from db. If he does not have 
the right privileges (that is checked on server) I would like to return an 
alert (possible modal or smth) without redirection after he clicks ok

So far I have an alert but user is redirected to an empty page afterwards


This is my button in html

div class=btn-group style=margin-bottom: 20px; margin-top: 10px;
!--  button onclick= class=btn btn-primaryspan 
class=glyphicon glyphicon-export/spannbsp;nbsp;{{ =T('Export EXCEL') 
}}/button --
{{=A(T('iCal export'), _class='btn btn-primary', 
_href=URL('script','iCalDownload',  args = request.args[0]))}}
/div

and my controler

def iCalDownoload():
 if user has privilages:
 blah blah blah
 else:
 return SCRIPT(alert('You do not have the right privileges to 
download. Please contact administrator: i...@algit.si'))

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: how to use groupby and sum() in query or grid?

2015-02-19 Thread 黄祥
please try :
sum_items = db.items.sales.sum()
db().select(sum_items, groupby = db.items.country)[sum_items]

best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] not web2py question - test timezone detection

2015-02-19 Thread Mirek Zvolský
If you want to help,
can you access
http://praha.alwaysdata.net/testjstz/testjstz
and see what this will write in your country? -- for me: Europe/Berlin.

Here is source - my web2py code with jstz library (timezone detect from 
browser):
def testjstz():
return 'htmlhead/headbodyscript src=
https://cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.4/jstz.min.js
/scriptscriptdocument.write(jstz.determine().name());/script/body/html'

If you are more active, you can test it from second browsers or through web 
proxy:

Web proxies - examples:
https://hide.me/en/proxy
https://www.filterbypass.me/
http://www.webproxy.net/
www.where*isip*.net/ will write where the ip of the proxy is located.

Thank you.
Mirek

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] request.args return __(double underscore) instead of proper unicode character ??

2015-02-19 Thread Mirek Zvolský
 

I have problem with unicode characters in url in request.args.


 Most resources recommend to use the percent encoding.

http://stackoverflow.com/questions/2742852/unicode-characters-in-urls


Example:

http://www.utf8-chartable.de/unicode-utf8-table.pl?start=256unicodeinhtml=hexhtmlent=1

U+010C == %c4%8c == Č


 If I enter: a/c/f/ABC%c4%8cD

as URL into browser, browser will properly show: a/c/f/ABCČD

request.args[0] ABC__D --failure - double underscore instead of the unicode 
character

request.url a/c/f/ABCČD --ok

request.vars --ok

So the problem is just in request.args

 Version 2.9.12-stable+timestamp.2015.01.17.06.11.03

Lubuntu, Firefox/Chromium/urllib2/.. --or-- Debian, Chrome 


 Any idea ... ?


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Web2py freezes when uploading a file greater than IS_LENGTH maxsize

2015-02-19 Thread William Chen
Hi all,

*Background:*
I have created a file upload form where you can upload any file smaller 
than 1MB. 

This is the db field for the file:

Field('file1', 'upload', requires = IS_LENGTH(minsize=0, maxsize=1048576, 
error_message='File is too huge.')),

*Problem:*
When I try to upload a huge file larger than 1MB, Web2py freezes up for up 
to 2 minutes, before finally returning to the form showing the 
error_message that 'file is too huge'. I am unable to access any other part 
of my application when web2py freezes. 

*Question:*
Is there any way to work around this problem? For example, is there anyway 
to check the size of file before uploading it? 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: web2py Scheduler with Postgres creates idle in transaction connections

2015-02-19 Thread stingpan
I actually get an error using your trick:

Traceback (most recent call last):
  File gluon/scheduler.py, line 1512, in module
main()
  File gluon/scheduler.py, line 1506, in main
utc_time=options.utc_time)
  File gluon/scheduler.py, line 588, in __init__
self.define_tables(db, migrate=migrate)
  File gluon/scheduler.py, line 613, in define_tables
from pydal.base import DEFAULT
ImportError: No module named pydal.base



Thanks for your help anyway Niphlod. But maybe I wasn't being very clear 
when I mentioned the connections being idle in transaction rather than 
just idle. I did find a work-around! I segregated scheduler functions 
into its own application. A dedicated application for scheduler meant 
scheduler would only hold a single connection to its own dedicated 
database. No more locks accessing the other 2 databases so everything works 
quite well now :)


On Wednesday, February 18, 2015 at 2:09:22 PM UTC-8, Niphlod wrote:

 uhm^3. The code is quite unfixable as it is (launching scheduler with 
 web2py.py -K appname). Remember that the only thing I'm trying to fix is 
 the main process using idle connections to all databases defined in the 
 models of you app.

 However, there's a small unknown trick: the scheduler can be started on 
 its own, and process happily tasks defined in applications, as long as 
 they are reachable from within the path you're launching it.
 The former translates to: if you are on the same path web2py is in, you 
 can use another commandline to launch the scheduler, whose main process 
 will only be aware of the db_sched connection.
 Small fixes are needed to make the unknown trick work again (up until 
 now the trick hasn't been tested much) but the working file is here 
 https://www.dropbox.com/s/3lumrofqcp1bxyq/scheduler.py?dl=0 .

 You should start as

 cd web2py # -- path where web2py.py is
 python gluon/scheduler.py -u *uri_of_the_db* -f *folder* -L 0 -b 2


 where:
 - *uri_of_the_db* is the database uri (i.e. *postgresql://.*, mind 
 that for sqlite, you should pass the entire relative path, as in 
 *sqlite:///applications/appname/databases/storage.sqlite*)
 - *folder* is the relative folder where the database tables are (i.e. 
 *applications/appname/databases/* )
 - the number after -L is the logging level (0 all, 100 nothing)
 - the number after -b is the heartbeat in seconds

 Please try it and see if the idle connections are still there or not.



 On Wednesday, February 18, 2015 at 10:04:45 PM UTC+1, Niphlod wrote:

 uhm, the problem is more subtle. 

 The main process of the scheduler is like a shell opened on that 
 application... it needs to reads models to see the scheduler 
 definition. I guess that this means that it will also connect to all the 
 databases defined in models, even if it will effectively send/receive 
 commands only on the scheduler_db. 
 Those additional connections are not needed as a matter of fact, but 
 shouldn't block anything too: they're idle and never used.

 Every spawned process (the one that will process the task) needs to 
 execute models, else your task won't be able to access, e.g. db, and, to 
 be fair, they won't be able to see the tasks definitions in the first 
 place. Those connections are used, but the connections are kept open just 
 for the time the task gets processed (the spawned process dies as soon as 
 the task finishes). 

 Let me check if there is a workaround for the  connections on the main 
 process. I'll get back to you (at most in a few days)



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] open source GIS components

2015-02-19 Thread Serbulent Ocal

Hello,

I am new in web2py.

Could someone guide me about how to use open source GIS components 
(geoserver, openlayers, postgresql) with web2py?
I would like to develop a web based GIS app with web2py and open source 
components.

Thanks,
Serb

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] openlayers java scriptcode and web2py

2015-02-19 Thread Serbulent Ocal

I am new in this group.

I am struggling with to put the openlayers java script code to web2py 
controller (test.py) together. My aim is to combine them and I was wondering

how to put them together to show the tiles as base and the map on top of it?

test.py:

for url in 
['http://dev.openlayers.org/theme/default/style.css','http://dev.openlayers.org/examples/style.css','http://dev.openlayers.org/OpenLayers.js']:
response.files.append(url)

def map():
mymap = DIV(_id=map, _class=smallmap)

response.js = var map, layer;
function init() {
map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.OSM (Simple OSM Map);
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(-71.147, 42.472).transform(
new OpenLayers.Projection(EPSG:4326),
map.getProjectionObject()
), 12
);
 };
 init();
 return locals()
def index():
mymap = LOAD ('test', 'map.load', ajax=True)return locals()

openlayers (tile.html)

 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
  HTML
   HEAD
  TITLEOpenLayers/TITLE
   META content=text/html; charset=windows-1252 http-equiv=Content-Type
  script src=http://openlayers.org/api/OpenLayers.js;/script
  META name=GENERATOR content=MSHTML 9.00.8112.16540/HEAD
   BODY
 DIV style=WIDTH: 100%; HEIGHT: 100% id=map/DIV
 SCRIPT type=text/javascript defer
var map = new OpenLayers.Map('map');
var wms = new OpenLayers.Layer.WMS( OpenLayers WMS,
http://vmap0.tiles.osgeo.org/wms/vmap0;, {layers: 'basic'} );
var dm_wms = new OpenLayers.Layer.WMS(
Canadian Data,
http://www2.dmsolutions.ca/cgi-bin/mswms_gmap;,
{
layers: bathymetry,land_fn,park,drain_fn,drainage, +
prov_bound,fedlimit,rail,road,popplace,
transparent: true,
format: image/png
},
{isBaseLayer: false}
);
map.addLayers([wms, dm_wms]);
map.zoomToMaxExtent();
  /SCRIPT
  /BODY/HTML

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


Re: Re: [web2py] Re: Testing and web2py - especially appadmin

2015-02-19 Thread Vinicius Assef
Hi guys.

I've been too busy in the past months and I couldn't focus on web2py.test.

I'm planning to getting back to it next month.


 On Wed, 18 Feb 2015 17:25:11 -0300 Niphlod  wrote  
the idea behind the project was to have BDD done. Vinicius was covering 
already unittesting. IMHO web applications (or, at least, the ones I code) 
rely on too many pieces you can't test without a live browser. Once that 
concept sinks in, you'll quickly realize that unittesting is too limited when 
coupled with a real browser, hence BDD. 
Behave is just one library, and IMHO is more usable than Lettuce (or was at 
the time at least), but given it is/was a project from scratch, it's not an 
hard requirement, more of a personal choice.



 
 -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 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/d/optout.
 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Good Practices - Custom Auth (default table) VS. Defining Own Auth Tables (for different user level)

2015-02-19 Thread Jon M.
Peaceful Greetings Web2Py Group!

In my first glances of practicing and implementing this awesome framework, 
came across with some doubts with the *authorization* topic.

In general database, server and services good practices, hand to hand with 
security, What do you think that is the best? (based on experience with 
hardcore data transmissions)

Customize the '*user_table*' so the Auth library can do it's job done, 
adding fields and have all almighty admins, mid-admins of certain realms, 
and users of the different realms that are in the server, distinguished but 
stored in the same '*user_table*'

Or, split that table, so each one out of 3 can have its own table.

I'm learning DBs on the way too, sorry if the question level bothers 
anyone. Kinda new in production environments... I know that it might be 
some answer out there, but I wonder about actual epoch IT solutions and 
experiences, having in mind the possible future scenarios. It's kinda scary 
to me, but awesome and challenging at the same time.

Thanks a lot for your attention! :D

Nice day | afternoon | night!

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] is main site hacked?

2015-02-19 Thread Alex Ar
First time looking at web2py. 

This button could not be generated. Help 
https://www.coinbase.com/external_redirect?link=https%3A%2F%2Fsupport.coinbase.comsignature=2b3e71a85b300325118665602b21e9470c9ce414The
 
first page contains a semi-hidden fourth button on the right tab, just 
under sites powered by with text This button could not be generated. Help 
https://www.coinbase.com/external_redirect?link=https%3A%2F%2Fsupport.coinbase.comsignature=2b3e71a85b300325118665602b21e9470c9ce414
 
that points to coinbase. Is this intentional?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] how to change grid name?

2015-02-19 Thread Oliver Holloway
The smartgrid seems to be taking the name of the table, capitalizing it, 
and adding es to it, which is funny because the table name is already 
plural ('programs').

Anyway, how do I set the grid name?

https://lh5.googleusercontent.com/-ZFNQcHh5c1s/VOV3aQzqlDI/K-s/M-MvatJzdFM/s1600/grid_name.PNG


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: How to copy and move a file from the admin interface?

2015-02-19 Thread Massimo Di Pierro
Please open a ticket. We should add the funtionality

On Wednesday, 18 February 2015 10:12:45 UTC-6, François Delpierre wrote:

 Hi,

 From the admin interface, it's easy to create a new file or to delete it, 
 but how do I move one to an other folder, or just copy an existing one to a 
 new file name?
 This is one of the few operation I still need a shell on the server for.


 Regards,


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] github wiki?

2015-02-19 Thread Massimo Di Pierro
What do people think about using?

https://github.com/web2py/web2py/wiki

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: sessions2trash.py

2015-02-19 Thread Niphlod
uhm, strange. I opened the code and saw this

https://github.com/web2py/web2py/blob/master/scripts/sessions2trash.py#L167

I though it worked. Let me test it and I'll get back here ASAP.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


Re: Re: [web2py] Re: Testing and web2py - especially appadmin

2015-02-19 Thread Richard Vézina
I study a bit each of your demo app, and they pretty much use a similar
approach.

So for making test execution under web2py environnement, I think we are
fine...

I see flaw in mocking inside web2py (Niphold as some kind of mocking
functions), I guess a default mocking module python file could be a good
thing.

Also, I don't really know by which end starting testing my app...

Here ideas :
http://thenextweb.com/apps/2013/11/28/guide-testing-web-app-steps-approach-testing-get-sessions/
http://www.softwaretestinghelp.com/web-application-testing/

We could implement a basic testing library that demostrate the bare minimum
test that someone should do over his app.

I will futher read your testing demonstration and try to implement some
test and make PR.

:)

Richard


On Thu, Feb 19, 2015 at 11:36 AM, Vinicius Assef 
list-web...@viniciusban.eu.org wrote:

 Hi guys.

 I've been too busy in the past months and I couldn't focus on web2py.test.

 I'm planning to getting back to it next month.


  On Wed, 18 Feb 2015 17:25:11 -0300 Niphlod  wrote 
 the idea behind the project was to have BDD done. Vinicius was covering
 already unittesting. IMHO web applications (or, at least, the ones I code)
 rely on too many pieces you can't test without a live browser. Once that
 concept sinks in, you'll quickly realize that unittesting is too limited
 when coupled with a real browser, hence BDD.
 Behave is just one library, and IMHO is more usable than Lettuce (or was
 at the time at least), but given it is/was a project from scratch, it's not
 an hard requirement, more of a personal choice.
 
 
 
 
  --
  Resources:
  - http://web2py.com
  - http://web2py.com/book (Documentation)
  - http://github.com/web2py/web2py (Source code)
  - https://code.google.com/p/web2py/issues/list (Report Issues)
  ---
  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/d/optout.
 

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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/d/optout.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: How to copy and move a file from the admin interface?

2015-02-19 Thread Derek
I thought you could just rename the file and it would move it. ex: file.txt 
renamed to /static/file.txt would move the file to static.

On Thursday, February 19, 2015 at 1:25:48 PM UTC-7, Massimo Di Pierro wrote:

 Please open a ticket. We should add the funtionality

 On Wednesday, 18 February 2015 10:12:45 UTC-6, François Delpierre wrote:

 Hi,

 From the admin interface, it's easy to create a new file or to delete it, 
 but how do I move one to an other folder, or just copy an existing one to a 
 new file name?
 This is one of the few operation I still need a shell on the server for.


 Regards,



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: sessions2trash.py

2015-02-19 Thread Niphlod
you found a bug that seems just a typo. Fixing it works, but not 
completely: it tries to delete only the parent folder of a session file 
that got deleted (and quite frankly a bit slow, checking for every file). 
I'll simplify with an example: the new storage scheme is roughly

appname/sessions/ABC/CDE/ip_uuid

Fixing the typo seems to cover only the case where ip_uuid gets deleted 
because it expired, and if it's the only file in there, CDE gets checked 
and if empty it gets removed but it leaves ABC even if at that point is 
empty too.

try this https://www.dropbox.com/s/4080g390sa5byw6/sessions2trash.py?dl=0 
one instead: it gets the job done (I'm submitting a PR right now)


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: Web2py freezes when uploading a file greater than IS_LENGTH maxsize

2015-02-19 Thread Willoughby
https://groups.google.com/d/topic/web2py/WatEyE8UwDI/discussion

On Thursday, February 19, 2015 at 5:53:45 AM UTC-5, William Chen wrote:

 Hi all,

 *Background:*
 I have created a file upload form where you can upload any file smaller 
 than 1MB. 

 This is the db field for the file:

 Field('file1', 'upload', requires = IS_LENGTH(minsize=0, maxsize=1048576, 
 error_message='File is too huge.')),

 *Problem:*
 When I try to upload a huge file larger than 1MB, Web2py freezes up for up 
 to 2 minutes, before finally returning to the form showing the 
 error_message that 'file is too huge'. I am unable to access any other part 
 of my application when web2py freezes. 

 *Question:*
 Is there any way to work around this problem? For example, is there anyway 
 to check the size of file before uploading it? 


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: github wiki?

2015-02-19 Thread Niphlod
who's going to be the content manager ? 
As long as entries are publicly available but the author creating them 
doesn't maintain them, it's going to have the exact same issues of 
web2pyslices.com.

On Thursday, February 19, 2015 at 9:30:50 PM UTC+1, Massimo Di Pierro wrote:

 What do people think about using?

 https://github.com/web2py/web2py/wiki



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: sessions2trash.py

2015-02-19 Thread Niphlod
PS: from my humble calculations inside session there can be AT MOST 560 
folders that can contain each one 560 folders. it's not that much for a 
production environment, but I get the argument of keeping the dev 
environment clean.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: return javascript alert from contorler without redirection

2015-02-19 Thread Leonel Câmara
This will always go to a new page because you're following a link. You need 
to make this an ajax call associated with the onclick of the button. Then 
you can simply use response.flash to use the regular alerts web2py already 
provides or response.js and you don't even need to return anything else.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: return javascript alert from contorler without redirection

2015-02-19 Thread Mirek Zvolský
If you call controller function and return something from this function, it 
will allways create new page (if you return string, it will be returned 
directly, if dictionary, it will be returned through the templating engine).

You can

1) test privileges before (when you create the page at first) and
a) immediately hide the button
--or-- b) have a hidden element div style=display: none;no 
privileges/div and show it using javascript when user clicks

--or-- (if you don't want test privileges before, but after the click)

2) use ajax call (see ajax chapter of the book), which can return
a) script
--or-- b) innerHTML for some element






Dne čtvrtek 19. února 2015 9:15:09 UTC+1 Yebach napsal(a):

 Hello

 I have a button for user to export some data from db. If he does not have 
 the right privileges (that is checked on server) I would like to return an 
 alert (possible modal or smth) without redirection after he clicks ok

 So far I have an alert but user is redirected to an empty page afterwards


 This is my button in html

 div class=btn-group style=margin-bottom: 20px; margin-top: 10px;
 !--  button onclick= class=btn btn-primaryspan 
 class=glyphicon glyphicon-export/spannbsp;nbsp;{{ =T('Export EXCEL') 
 }}/button --
 {{=A(T('iCal export'), _class='btn btn-primary', 
 _href=URL('script','iCalDownload',  args = request.args[0]))}}
 /div

 and my controler

 def iCalDownoload():
  if user has privilages:
  blah blah blah
  else:
  return SCRIPT(alert('You do not have the right privileges to 
 download. Please contact administrator: in...@algit.si javascript:'))



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


Re: [web2py] Re: return javascript alert from contorler without redirection

2015-02-19 Thread Vid Ogris
on button click i am returning a file. Should it be any different with it.
Also my response.flash or session.flash message is not working.Any ideas
why?

2015-02-19 12:47 GMT+01:00 Leonel Câmara leonelcam...@gmail.com:

 This will always go to a new page because you're following a link. You
 need to make this an ajax call associated with the onclick of the button.
 Then you can simply use response.flash to use the regular alerts web2py
 already provides or response.js and you don't even need to return anything
 else.

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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/Q63J8bcFz80/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




-- 
Lep pozdrav

Vid Ogris

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: not web2py question - test timezone detection

2015-02-19 Thread Leonel Câmara
I got

Europe/London

Which is correct since Lisbon is in the same timezone as London.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


Re: [web2py] Re: return javascript alert from contorler without redirection

2015-02-19 Thread Vid Ogris
Are you suggesting using  ajax

button onclick= ajax('{{=URL(script,iCalDownload,  args =
request.args[0])}}',[], '') class=btn btn-primaryspan class=glyphicon
glyphicon-export/spannbsp;nbsp;{{ =T('Export iCal') }}/button

because the return from my function is

return exported_chunks_zip.getvalue()

2015-02-19 13:06 GMT+01:00 Vid Ogris vid.og...@gmail.com:

 on button click i am returning a file. Should it be any different with it.
 Also my response.flash or session.flash message is not working.Any ideas
 why?

 2015-02-19 12:47 GMT+01:00 Leonel Câmara leonelcam...@gmail.com:

 This will always go to a new page because you're following a link. You
 need to make this an ajax call associated with the onclick of the button.
 Then you can simply use response.flash to use the regular alerts web2py
 already provides or response.js and you don't even need to return anything
 else.

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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/Q63J8bcFz80/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




 --
 Lep pozdrav

 Vid Ogris





-- 
Lep pozdrav

Vid Ogris

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: return javascript alert from contorler without redirection

2015-02-19 Thread Leonel Câmara
That won't work, the easiest way is to use some kind of jquery file 
download plugin.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: how to use groupby and sum() in query or grid?

2015-02-19 Thread Michael Beller
Thank you but I get the following error with that approach:
type 'exceptions.TypeError' list indices must be integers, not Expression

However, I did get this to work:
t = db.items
q = t.id0
usum = t.sales.sum()

usum.tablename = 'items'
usum.readable = True
usum.represent = False
usum.formatter = lambda value:value
usum.label = T('Sales')
usum.table = t

grid = SQLFORM.grid(q,
fields=[t.country, t.state, usum],
groupby=t.country|t.state,
orderby=[t.country, t.state],
)

list = []
list.append(['country','state','sales'])
for row in db(t).select(t.country, t.state, usum, 
groupby=t.country|t.state):
list.append([row.items.country, row.items.state, row[usum]])


On Thursday, February 19, 2015 at 12:29:19 AM UTC-8, 黄祥 wrote:

 please try :
 sum_items = db.items.sales.sum()
 db().select(sum_items, groupby = db.items.country)[sum_items]

 best regards,
 stifan


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


Re: [web2py] Re: Testing and web2py - especially appadmin

2015-02-19 Thread Richard Vézina
Thanks!

You maybe right about TDD being less applicable web app... At least in case
of controller, for subfunction though input values can be mocked in case of
a compute function or a represent function... But doctest maybe enough for
that kind of testing...

Richard

On Wed, Feb 18, 2015 at 3:25 PM, Niphlod niph...@gmail.com wrote:

 the idea behind the project was to have BDD done. Vinicius was covering
 already unittesting. IMHO web applications (or, at least, the ones I code)
 rely on too many pieces you can't test without a live browser. Once that
 concept sinks in, you'll quickly realize that unittesting is too limited
 when coupled with a real browser, hence BDD.
 Behave is just one library, and IMHO is more usable than Lettuce (or was
 at the time at least), but given it is/was a project from scratch, it's not
 an hard requirement, more of a personal choice.


  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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/d/optout.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: not web2py question - test timezone detection

2015-02-19 Thread Dave S


On Thursday, February 19, 2015 at 12:57:50 AM UTC-8, Mirek Zvolský wrote:

 If you want to help,
 can you access
 http://praha.alwaysdata.net/testjstz/testjstz
 and see what this will write in your country? -- for me: Europe/Berlin.



America/Los_Angeles

which is correct (I'm 50-ish miles from the Hollywood Bowl, 30-ish from 
Disneyland, an hour and a half from Seaworld).

/dps

 


 Here is source - my web2py code with jstz library (timezone detect from 
 browser):
 def testjstz():
 return 'htmlhead/headbodyscript src=
 https://cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.4/jstz.min.js
 /scriptscriptdocument.write(jstz.determine().name());/script/body/html'

 If you are more active, you can test it from second browsers or through 
 web proxy:

 Web proxies - examples:
 https://hide.me/en/proxy
 https://www.filterbypass.me/
 http://www.webproxy.net/
 www.where*isip*.net/ will write where the ip of the proxy is located.

 Thank you.
 Mirek


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: github wiki?

2015-02-19 Thread Massimo Di Pierro
I agree. what do you propose


On Thursday, 19 February 2015 15:14:53 UTC-6, Niphlod wrote:

 who's going to be the content manager ? 
 As long as entries are publicly available but the author creating them 
 doesn't maintain them, it's going to have the exact same issues of 
 web2pyslices.com.

 On Thursday, February 19, 2015 at 9:30:50 PM UTC+1, Massimo Di Pierro 
 wrote:

 What do people think about using?

 https://github.com/web2py/web2py/wiki



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: sessions2trash.py

2015-02-19 Thread Niphlod
correction, too humble. My analysis degree never came to reality :P it's 
not 560, it's 3360

On Thursday, February 19, 2015 at 10:12:09 PM UTC+1, Niphlod wrote:

 PS: from my humble calculations inside session there can be AT MOST 560 
 folders that can contain each one 560 folders. it's not that much for a 
 production environment, but I get the argument of keeping the dev 
 environment clean.




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Deep linking with components

2015-02-19 Thread Richard
Hello,

I may be ignorant, but to me it seems that there is a missing 
functionnality in components called deep linking in Angularjs world. I 
start tu use components a lot for end-user data retreiving, you pick an 
item in one drop box factory form then another and bang you access an 
updated components with the disired data. It works great though, we can't 
share the the selected data page by cut/paste the url since it stays the 
same...

Is there a way to workaround that except embed an link of the updated 
component (which I already do sometimes)?

Thanks

Richard

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: DAL database adapter only validates datetime on read.

2015-02-19 Thread MDSIII
Thanks, makes sense. And yeah, validate_and_insert() works as documented.


On Wednesday, February 18, 2015 at 12:53:32 PM UTC-8, Niphlod wrote:

 that's pretty much expected: the general rule is that if you want your 
 fields validated at insert level, you shouldn't use insert() but 
 validate_and_insert().
 this, however, it's only an issue with SQLite (mainly) because it doesn't 
 have a native datetime field, so it doesn't complain even if you try to 
 insert in it a string value, as 'foobar'. other backends (with native 
 support) will happily reject the insert because they do their own 
 validation .




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] bootstrap 3?

2015-02-19 Thread Michael Lam
Hi, I'm creating a web app by using the welcome app as a template - there's 
an external theme, HTML, etc. I want to use which seems to be using 
Bootstrap 3. Web2py had bootstrap3 support sometime in 2014, but it seemed 
to have been reverted in favour of an early release amid discussion whether 
the implementation was good.

So, as a user...there are a few natural questions. I looked and while there 
are answers around, not sure how applicable they are to 2.9.12-release.

I know some of these questions might not make sense, I'm still at the 
investigation phase.
The assumption is, I would not need to use the view part of the welcome 
app, but would pretty much want to retain the default models and 
controllers as a template.

1. with the above assumption, what would I be missing and are they mostly 
on the view side? (e.g. would {{=response.toolbar()}} work?)
2. if I want to continue to use most gluon facilities, approximately how 
much of that would work with BS3?
3. is there something I would absolutely need to copy from the welcome 
app's view part?

Thanks!
Michael

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Admin Authentication Security

2015-02-19 Thread Tom
I currently have the admin app configured to be only accessible from a single 
dynamic IP, however I intend to relax this a bit. Prior to doing so I tested 
the authentication methods by entering false passwords for admin several times. 
As expected my IP shows up in the hosts.deny file after several attempts, 
however once I enter the correct password the IP address is immediately removed 
from hosts.deny and I can login. It seems to me this kind of defeats the 
purpose of having a hosts.deny file. A work around solution could be to write a 
cron job that picks up the IP address from hosts.deny and block that IP, but 
the current set up in web2py surprises me. Is this the intent ?

Also the flash messages indicating that the account is blocked or that too many 
login attempts have been made seems not in line with security standards 
recommending no change in user messages once an account is blocked, where can I 
find the location to change these messages to a single consistent login failure 
message ?

Kind regards,

Tom

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] challenge of the day

2015-02-19 Thread Massimo Di Pierro
say you have a script (for example a python program created with argparse) 
that lists the options with the -h option. Can you write Python function 
that takes as input the output of the script and generate a web2py form, 
parses the form.vars and calls the script with the proper arguments?

For example
convert -v -d=3 input output

into

form = SQLFORM.factory(Field('v','boolean',default=False), 
Field('d','integer',default=3))
if form.process().accepted:
command = command
if form.vars.v: command+= -v
if form.vars.d: command+=-d=%s % form.vars.d
   




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: github wiki?

2015-02-19 Thread Niphlod
uhm, I propose another POV: what issue does the wiki suggestion needs to 
solve ?


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: openlayers java scriptcode and web2py

2015-02-19 Thread Massimo Di Pierro
I am not sure why you are using LOAD and response.js. It seems 
un-necessary. Also I am not sure it is a good idea to put JS in 
controllers. Instead I would do:

def index():
  return dict()

def map_data():
  return response.json([.])

and have an index.html that includes all the JS you need and the calls

jQuery(function(){
   jQuery.getJSON('{{=URL('map_data')}}',function(data_in_json) {
  // display the data_in_json in MAP
   });
});



On Thursday, 19 February 2015 04:54:58 UTC-6, Serbulent Ocal wrote:


 I am new in this group.

 I am struggling with to put the openlayers java script code to web2py 
 controller (test.py) together. My aim is to combine them and I was 
 wondering

 how to put them together to show the tiles as base and the map on top of 
 it?

 test.py:

 for url in 
 ['http://dev.openlayers.org/theme/default/style.css','http://dev.openlayers.org/examples/style.css','http://dev.openlayers.org/OpenLayers.js']:
 response.files.append(url)

 def map():
 mymap = DIV(_id=map, _class=smallmap)

 response.js = var map, layer;
 function init() {
 map = new OpenLayers.Map('map');
 layer = new OpenLayers.Layer.OSM (Simple OSM Map);
 map.addLayer(layer);
 map.setCenter(new OpenLayers.LonLat(-71.147, 42.472).transform(
 new OpenLayers.Projection(EPSG:4326),
 map.getProjectionObject()
 ), 12
 );
  };
  init();
  return locals()
 def index():
 mymap = LOAD ('test', 'map.load', ajax=True)return locals()

 openlayers (tile.html)

  !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
   HTML
HEAD
   TITLEOpenLayers/TITLE
META content=text/html; charset=windows-1252 http-equiv=Content-Type
   script src=http://openlayers.org/api/OpenLayers.js;/script
   META name=GENERATOR content=MSHTML 9.00.8112.16540/HEAD
BODY
  DIV style=WIDTH: 100%; HEIGHT: 100% id=map/DIV
  SCRIPT type=text/javascript defer
 var map = new OpenLayers.Map('map');
 var wms = new OpenLayers.Layer.WMS( OpenLayers WMS,
 http://vmap0.tiles.osgeo.org/wms/vmap0;, {layers: 'basic'} );
 var dm_wms = new OpenLayers.Layer.WMS(
 Canadian Data,
 http://www2.dmsolutions.ca/cgi-bin/mswms_gmap;,
 {
 layers: bathymetry,land_fn,park,drain_fn,drainage, +
 prov_bound,fedlimit,rail,road,popplace,
 transparent: true,
 format: image/png
 },
 {isBaseLayer: false}
 );
 map.addLayers([wms, dm_wms]);
 map.zoomToMaxExtent();
   /SCRIPT
   /BODY/HTML



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: how to change grid name?

2015-02-19 Thread Massimo Di Pierro
You are using the generic.html view. That only works in development and it 
is not a recommended policy in production. It is telling you that you have 
a variable called grid and displaying the object.

You need to make your own view and embed the grid with {{=grid}} so that it 
won't display the name of the variable (grid).

On Wednesday, 18 February 2015 23:42:34 UTC-6, Oliver Holloway wrote:

 The smartgrid seems to be taking the name of the table, capitalizing it, 
 and adding es to it, which is funny because the table name is already 
 plural ('programs').

 Anyway, how do I set the grid name?


 https://lh5.googleusercontent.com/-ZFNQcHh5c1s/VOV3aQzqlDI/K-s/M-MvatJzdFM/s1600/grid_name.PNG




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: is main site hacked?

2015-02-19 Thread Massimo Di Pierro
No. Apparently coinbase which I used to accept bitcoins has added new 
policies.

On Wednesday, 18 February 2015 17:14:11 UTC-6, Alex Ar wrote:

 First time looking at web2py. 

 This button could not be generated. Help 
 https://www.coinbase.com/external_redirect?link=https%3A%2F%2Fsupport.coinbase.comsignature=2b3e71a85b300325118665602b21e9470c9ce414The
  
 first page contains a semi-hidden fourth button on the right tab, just 
 under sites powered by with text This button could not be generated. 
 Help 
 https://www.coinbase.com/external_redirect?link=https%3A%2F%2Fsupport.coinbase.comsignature=2b3e71a85b300325118665602b21e9470c9ce414
  
 that points to coinbase. Is this intentional?


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: Good Practices - Custom Auth (default table) VS. Defining Own Auth Tables (for different user level)

2015-02-19 Thread Massimo Di Pierro
I would never recommend splitting auth_user in multiple tables. It just 
makes everything else more complex. Moreover the roles you describe are not 
always exclusive and therefore you may end up with duplication of data.

On Thursday, 19 February 2015 10:57:32 UTC-6, Jon M. wrote:

 Peaceful Greetings Web2Py Group!

 In my first glances of practicing and implementing this awesome framework, 
 came across with some doubts with the *authorization* topic.

 In general database, server and services good practices, hand to hand with 
 security, What do you think that is the best? (based on experience with 
 hardcore data transmissions)

 Customize the '*user_table*' so the Auth library can do it's job done, 
 adding fields and have all almighty admins, mid-admins of certain realms, 
 and users of the different realms that are in the server, distinguished but 
 stored in the same '*user_table*'

 Or, split that table, so each one out of 3 can have its own table.

 I'm learning DBs on the way too, sorry if the question level bothers 
 anyone. Kinda new in production environments... I know that it might be 
 some answer out there, but I wonder about actual epoch IT solutions and 
 experiences, having in mind the possible future scenarios. It's kinda scary 
 to me, but awesome and challenging at the same time.

 Thanks a lot for your attention! :D

 Nice day | afternoon | night!


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


Re: [web2py] Re: Testing and web2py - especially appadmin

2015-02-19 Thread Richard Vézina
Thanks Mark,

I like pytest, it is pretty flexible...

Richard

On Thu, Feb 19, 2015 at 11:01 AM, Mark Graves mgrave...@gmail.com wrote:

 You may also consider pytest bdd.

 Its a pytest plugin that brings in BDD gherkin syntax and executable
 specifications.

 A nice complement/alternative to behave.


 On Thursday, February 19, 2015 at 9:29:19 AM UTC-6, Richard wrote:

 Thanks!

 You maybe right about TDD being less applicable web app... At least in
 case of controller, for subfunction though input values can be mocked in
 case of a compute function or a represent function... But doctest maybe
 enough for that kind of testing...

 Richard

 On Wed, Feb 18, 2015 at 3:25 PM, Niphlod nip...@gmail.com wrote:

 the idea behind the project was to have BDD done. Vinicius was covering
 already unittesting. IMHO web applications (or, at least, the ones I code)
 rely on too many pieces you can't test without a live browser. Once that
 concept sinks in, you'll quickly realize that unittesting is too limited
 when coupled with a real browser, hence BDD.
 Behave is just one library, and IMHO is more usable than Lettuce (or was
 at the time at least), but given it is/was a project from scratch, it's not
 an hard requirement, more of a personal choice.


  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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.
 For more options, visit https://groups.google.com/d/optout.


  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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/d/optout.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


Re: [web2py] Re: Testing and web2py - especially appadmin

2015-02-19 Thread Mark Graves
You may also consider pytest bdd.

Its a pytest plugin that brings in BDD gherkin syntax and executable 
specifications.

A nice complement/alternative to behave.


On Thursday, February 19, 2015 at 9:29:19 AM UTC-6, Richard wrote:

 Thanks!

 You maybe right about TDD being less applicable web app... At least in 
 case of controller, for subfunction though input values can be mocked in 
 case of a compute function or a represent function... But doctest maybe 
 enough for that kind of testing...

 Richard

 On Wed, Feb 18, 2015 at 3:25 PM, Niphlod nip...@gmail.com javascript: 
 wrote:

 the idea behind the project was to have BDD done. Vinicius was covering 
 already unittesting. IMHO web applications (or, at least, the ones I code) 
 rely on too many pieces you can't test without a live browser. Once that 
 concept sinks in, you'll quickly realize that unittesting is too limited 
 when coupled with a real browser, hence BDD. 
 Behave is just one library, and IMHO is more usable than Lettuce (or was 
 at the time at least), but given it is/was a project from scratch, it's not 
 an hard requirement, more of a personal choice.


  -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 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/d/optout.




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Bug: SQLFORM.accepts() breaks formstyle when widgets are defined

2015-02-19 Thread tim . nyborg
I'm using a custom formstyle to apply bootstrap3 to my forms (a modified 
copy of the built-in bootstrap3_inline).  Importantly, it adds the 
form-control class to each input.

This works fine, until you define a widget for a field, and have it fail 
validation.

db.define_table('test',
Field('one', 'string', requires=IS_MATCH('STUFF')),
Field('two', 'string', requires=IS_MATCH('STUFF'), 
widget=SQLFORM.widgets.string.widget),
)

def index():
# Set variables for the default view

form = SQLFORM(db.test, formstyle='bootstrap3_inline')  
form.process()

return dict(form=form)

Despite being identical fields, with identical widgets, field two loses its 
formatting.  Why?  Because of the following code at the bottom of 
SQLFORM.accepts()

elif (not ret) and (not auch):
# auch is true when user tries to delete a record
# that does not pass validation, yet it should be deleted
for fieldname in self.fields:

field = (self.table[fieldname]
 if fieldname in self.table.fields
 else self.extra_fields[fieldname])
### this is a workaround! widgets should always have default not 
None!
if not field.widget and field.type.startswith('list:') and \
not OptionsWidget.has_options(field):
field.widget = self.widgets.list.widget
if field.widget and fieldname in request_vars:
if fieldname in self.request_vars:
value = self.request_vars[fieldname]
elif self.record:
value = self.record[fieldname]
else:
value = field.default
row_id = '%s_%s%s' % (
self.table, fieldname, SQLFORM.ID_ROW_SUFFIX)
widget = field.widget(field, value)
parent = self.field_parent[row_id]
if parent:
parent.components = [widget]
if self.errors.get(fieldname):
parent._traverse(False, hideerror)
self.custom.widget[fieldname] = widget


If a field's widget is defined, it overwrites it, for reasons mysterious to 
me.  This occurs *after* the formstyle is applied.

If I remove that source code, or remove the widget between form setup and 
validation:


def index():
# Set variables for the default view

form = SQLFORM(db.test, formstyle='bootstrap3_inline')  
db.test.two.widget=None  
form.process()

return dict(form=form)


Then everything works fine.  

What is the point of that code at the end of accepts(), and is this working 
as designed?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: sessions2trash.py

2015-02-19 Thread Annet
Hi Niphlod,

Thanks for your reply.

I tested the sessions2trash.py from:

https://github.com/web2py/web2py/

The script deletes the sessions but does not delete the folder
structure, so the empty folders still pile up.

It does return a different output:

Last login: Thu Feb 19 12:37:33 on ttys000
lionserver:~ mymac$ cd /Users/mymac/web2py_develop
lionserver:web2py_develop mymac$ python web2py.py -M -S init -R 
scripts/sessions2trash.py -A -vv -o
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2015
Version 2.9.11-stable+timestamp.2014.09.15.23.35.11
Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
PostgreSQL(pg8000), MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), 
Ingres(pyodbc), IMAP(imaplib)
key: 
applications/init/sessions/111/0c0/127.0.0.1-1e9c8383-9da1-49ff-9b80-cb1b01e9292b
expiration: 3600 seconds
last visit: 2015-02-19 12:37:56
age: 10760 seconds
status: trashed

lionserver:web2py_develop mymac$ 



Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: not web2py question - test timezone detection

2015-02-19 Thread Jim S
America/Chicago

...which is correct for me.

-Jim

On Thursday, February 19, 2015 at 2:57:50 AM UTC-6, Mirek Zvolský wrote:

 If you want to help,
 can you access
 http://praha.alwaysdata.net/testjstz/testjstz
 and see what this will write in your country? -- for me: Europe/Berlin.

 Here is source - my web2py code with jstz library (timezone detect from 
 browser):
 def testjstz():
 return 'htmlhead/headbodyscript src=
 https://cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.4/jstz.min.js
 /scriptscriptdocument.write(jstz.determine().name());/script/body/html'

 If you are more active, you can test it from second browsers or through 
 web proxy:

 Web proxies - examples:
 https://hide.me/en/proxy
 https://www.filterbypass.me/
 http://www.webproxy.net/
 www.where*isip*.net/ will write where the ip of the proxy is located.

 Thank you.
 Mirek


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.