[web2py] Generator for web2py

2016-02-16 Thread Graham Ranson
Further to my previous posting I have just published the details of my 
generator tool in web2pyslices.

Just download and read through the how to use document at least.

I will, yet again, point out that this is a work in progress with lots of 
gaps and almost certainly a few bugs and certainly with a lot of diagnostics 
that really will go soon. My excuse is that I really haven't had a lot of 
tmie to work on it over the past three months or so - blame that on the 
warmest and wettest December (probably bot since records began...) which has 
had an impact on some of my other horticultural and small-scale sheep 
raising activities - fortunately most of the plants and sheep have 
survived...

And again, don't be too concerned about the quality of the code: firstly it 
will be changed quite a lot in the not too distant future; and secondly it 
is my first Python program.

If anyone is interested then please let me have your comments and ideas.

graham


-- 
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] form.vars details

2016-02-16 Thread Ayman Absi
Hello,

>From Web2Py documentation I read this "accepts stores those variables that 
pass validation into form.vars" but I can't find any documentation tells 
what form.vars looks like. for example in some places in the document we 
can find that there is form.vars.id.

Is there any place I can find complete documentation about form.vars?

Thank you

-- 
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] Problems nginx on centos

2016-02-16 Thread Esau Hernandez Valles


Hi Forum: 


I tell you that I have a server with Centos 7.1 nginx 1.6.3 and mysql 
5.6.28. Web2py versión is: 2.13.4-stable+timestamp.2015.12.26.04.59.39
My app saves sessions on bd.  I put the following stament in db.py

session.connect(request, response, db)

Maybe it is preferable to store sessions in files.  I don´t know.

 


My configuration file is : (nginx.conf).

user nginx;

worker_processes auto;

error_log /var/log/nginx/error.log;

pid /run/nginx.pid;


events {

   worker_connections 2046;

}


http {

   log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

 '$status $body_bytes_sent "$http_referer" '

 '"$http_user_agent" "$http_x_forwarded_for"';


access_log  /var/log/nginx/access.log  main;


sendfileon;

   tcp_nopush  on;

   tcp_nodelay on;

   keepalive_timeout   95;

   types_hash_max_size 2048;


#client_body_buffer_size 10K;

  #client_header_buffer_size 1k;

 #client_max_body_size 8m;

  #large_client_header_buffers 2 1k;


include /etc/nginx/mime.types;

   default_typeapplication/octet-stream;


# Load modular configuration files from the /etc/nginx/conf.d directory.

   # See http://nginx.org/en/docs/ngx_core_module.html#include

   # for more information.

   # include /etc/nginx/conf.d/*.conf;


server {

   listen   80 default_server;

   listen   [::]:80 default_server;

   server_name  XXX.XXX.XXX.XXX;  #I changed this intentionally

   root /usr/share/nginx/html;


# Load configuration files for the default server block.

   # include /etc/nginx/default.d/*.conf;


   

location ~* /(\w+)/static/ {

   root /root/myapp/applications/;

}


location / {

   include uwsgi_params;

   uwsgi_pass unix:/run/uwsgi/myapp.sock;

}


error_page 404 /404.html;

   location = /40x.html {

   }


error_page 500 502 503 504 /50x.html;

   location = /50x.html {

   }

   }


server {

   listen 443;

   server_name xxx.xxx.xxx.xxx; # I changed this intentionally


ssl on;

   ssl_certificate /etc/nginx/ssl/myapp.crt;

   ssl_certificate_key /etc/nginx/ssl/myapp.key;


ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

   ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";

   ssl_prefer_server_ciphers on;


location / {

   include uwsgi_params;

   uwsgi_pass unix:/run/uwsgi/myapp.sock;

   }

   }

}



I addition, I have a task. This clears sessions every two minutes.

MAIL=root
*/2 * * * * python /root/myapp/web2py.py -S Lia -M -R /root/myapp/scripts/
sessions2trash.py -A -o



I prefer to use jquery ajax function. I do not use web2py ajax function. I 
do this in order to better control the messages and sample windows. 

Here Javascript code:

*function *MostrarDetalle(NumID){
$('#messageModal').modal('show');
*var *parametros = {'var_NumID': NumID};
$.ajax({
url: "{{=URL(c='Pedidos', f='getdetalleGrid', args=request.args)}}",
dataType:'html',
type: 'POST',
data: parametros,
success: OnsuccessMostrarDetalle,
error: OnerrorMostrarDetalle
});

*return false*;
}

*function *OnsuccessMostrarDetalle(data){
document.getElementById("bodymodaledit").innerHTML = data;
$('#messageModal').modal('hide');
$('#detallePedido').modal('show');
setTimeout(*function *() {$('#det_pedido_Cod_Articulo').focus();}, 1000)
;

}

*function *OnerrorMostrarDetalle(e){
*var *cadena = '  Se encontraron 
errores  ' + e.message + ' ';
document.getElementById("bodymodaledit").innerHTML = cadena;
$('#messageModal').modal('hide');
$('#detallePedido').modal('show');
} 


My problema is:

When I have 10 or 15 users on line,  the following message appears at times 
in client browser:


*This webpage has a redirect loop*


In Spanish:

*Esta página tiene un bucle de redirección. *

Here some images:






Still I do not understand why this situation and I can not identify 
completely. I need your help to identify the problem.

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] CAS with OpenSSL-Certificates

2016-02-16 Thread frankbunt4711
I'm trying to get CAS auth working with "https://.."; but it is giving me 
problems. Below is my setup

1. Environment is ArchLinux (Banana M2) + RocketServer + Web2py: 
Web2Py 2.13.4, Rocket 1.2.6, Python 2.7.10
All databases running on SQLite, default app path.

2. I have one web2py app that acts as a CAS provider:
db.py with auth = Auth(db) und auth.define_tables(username=True, 
signature=False)
default.py with def user(): return dict(form=auth())

3. I have another consumer web2py app that uses the CAS-web2py app as CAS 
provider for authentication. 
db.py with auth=Auth(db,cas_provider='https://.../default/user_cas/cas'), 
auth.define_tables(username=True, signature=False)

4. The Web2py-Framework is started using OpenSSL-Certificates
'python2 web2py -a 'password' -c server.crt -k server.key -i 0.0.0.0  -p 
443' 


Problem:
1. When I use the login in the CAS-application I can manage the users 
(login an add new user)
2. When I use the consumer application I can login using the CAS-provider 
application, but the user is not added in the table db.auth_user of the 
consumer application.
So if I write a dataset in an table with the 'auth_signature'-field there 
is the 'IntegrityError: FOREIGN KEY contraint failed'

-- 
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] Reporting app with Web2Py

2016-02-16 Thread lungupconstantin
Hi everyone,

First of all I would like to say thanks to Massimo and the entire community 
for the great job you're doing :)

I am building  a Reporting application for my graduation paper for an 
example company with Web2Py. I am using MySQL (a reporting DB and a 
denormalized datamart for ROLAP to use for Python Cubes 
http://cubes.databrewery.org/ ) and Web2Py.  I've managed to set up 
everything to get it working but I'm not sure whether I'm doing it the 
*right* way.

Currently, I have the following setup:

*Controller*

def getcostdata():
 db.executesql (*get data on costs, for example*)
 transform data
 plotting library internals

*View*
view data using plot library/html

Questions:
1. Should I use session variable and retrieve data from a dictionary - 
build some kind of cache (that expires at a certain interval) so multiple 
views won't run the same query multiple times needlessly?
2. I've seen some people say that functions like this should be placed 
inside a model or a module? Is there a difference in performance : 
controller vs. model vs. module?
3. I would like to reuse the information from a function in another place 
in my app but not load it needlessly -> module?
4. How can call a function from another controller ?

Hope this makes sense.

Thank you in advance,
Constantin

-- 
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 use Hightcharts in Web2py?

2016-02-16 Thread Jinyan Li
I try to use Column with drilldown chart from Hightcharts for my website

I put 





in layout.html

also I put
response.files.insert(3,URL('static','js/highcharts.js'))
response.files.insert(4,URL('static','js/highcharts-3d.js'))
response.files.insert(5,URL('static','js/highcharts-more.js'))
response.files.insert(6,URL('static','js/modules/data.js'))
response.files.insert(7,URL('static','js/modules/drilldown.js'))
in web2py_ajax.html

and then I try to create a Column with drilldown chart in a testpage, but 
nothing is shown

-- 
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: form.vars details

2016-02-16 Thread Massimo Di Pierro
There are three web2py.gluon.storage.Storage objects (extend dict):

request.post_vars (stores variables submitted via POST)
request.get_vars (stores variables submitted via GET)
request.vars (a superset)

repeated variables are stored as lists. For example

POST a=1&b=2&b=3

results in 

request.post_vars == request.vars == Storage(dict(a='1',b=['2','3']))

When a form is submitted request.post_vars are filtered by the validator 
and moved into form.vars. If the form is a create form, form.vars.id is 
added to the Storage. That is all.

On Tuesday, 16 February 2016 08:31:05 UTC-6, Ayman Absi wrote:
>
> Hello,
>
> From Web2Py documentation I read this "accepts stores those variables 
> that pass validation into form.vars" but I can't find any documentation 
> tells what form.vars looks like. for example in some places in the document 
> we can find that there is form.vars.id.
>
> Is there any place I can find complete documentation about form.vars?
>
> Thank you
>

-- 
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 Hightcharts in Web2py?

2016-02-16 Thread Massimo Di Pierro
You should use or the other else files are included twice and something may 
break. Anyway, the best way is using 







in layout.html after  before . Make sure you use them in

jQuery(function(){

... code here ...

});

On Tuesday, 16 February 2016 08:31:05 UTC-6, Jinyan Li wrote:
>
> I try to use Column with drilldown chart from Hightcharts for my website
>
> I put 
> 
> 
> 
> 
> 
> in layout.html
>
> also I put
> response.files.insert(3,URL('static','js/highcharts.js'))
> response.files.insert(4,URL('static','js/highcharts-3d.js'))
> response.files.insert(5,URL('static','js/highcharts-more.js'))
> response.files.insert(6,URL('static','js/modules/data.js'))
> response.files.insert(7,URL('static','js/modules/drilldown.js'))
> in web2py_ajax.html
>
> and then I try to create a Column with drilldown chart in a testpage, but 
> nothing is shown
>

-- 
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] Generator for web2py

2016-02-16 Thread Carlos Cesar Caballero Díaz
Hi Graham, I am very interested, but I can't find it in web2pyslices 
(maybe it still in moderation).


Greetings.

El 16/02/16 a las 09:01, Graham Ranson escribió:

Further to my previous posting I have just published the details of my
generator tool in web2pyslices.

Just download and read through the how to use document at least.

I will, yet again, point out that this is a work in progress with lots of
gaps and almost certainly a few bugs and certainly with a lot of diagnostics
that really will go soon. My excuse is that I really haven't had a lot of
tmie to work on it over the past three months or so - blame that on the
warmest and wettest December (probably bot since records began...) which has
had an impact on some of my other horticultural and small-scale sheep
raising activities - fortunately most of the plants and sheep have
survived...

And again, don't be too concerned about the quality of the code: firstly it
will be changed quite a lot in the not too distant future; and secondly it
is my first Python program.

If anyone is interested then please let me have your comments and ideas.

graham





--
Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

--
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: one select form multiple table

2016-02-16 Thread Imre
Thanks, it works but is tuple. How can I make a table from this records in 
view?

2016. február 1., hétfő 18:49:20 UTC+1 időpontban Alfonso Serra a 
következőt írta:
>
> I want to make a form which can search in  multiple db tables. The tables 
>> has a same structure.
>>
>  
> the form is only one since your inputs are a single search field isnt it?
>
> so what you would do is:
>
> form = SQLFORM.factory(Field("search", "string", notnull=True)).process()
> results = []
> if form.accepted:
>search = form.vars.search.split(";")[0] # a little bit of protection
>results = db.executesql("SELECT field1 as searchfield FROM table1 UNION 
> SELECT field2 from table2 WHERE searchfield LIKE %" + search + "%";)
>
>
>
>  
>

-- 
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: show_if logical operators

2016-02-16 Thread rajjmatthur
stumble upon this post.  For some reason, this don't work:

*model:*

db.define_table('mytable',
Field('name', type='list:string',requires=IS_IN_SET 
(['red', 'blue','yellow']),widget=lambda field, value: 
SQLFORM.widgets.checkboxes.widget(field, value, 
_style='bootstrap3_inline_factory', label=True)),
Field("roles", "text")

*default:*
db.mytable.roles.show_if = (db.mytable.name.belongs(['red']))

or even:

db.mytable.roles.show_if = (db.mytable.name =='red')



On Tuesday, June 16, 2015 at 7:52:30 AM UTC-4, kecajk...@gmail.com wrote:
>
> Works! Thanks. 
> Is it also possible for SQLFORM.factory? 
>
> On Wednesday, 10 June 2015 16:06:47 UTC+2, Anthony wrote:
>>
>> Try:
>>
>> db.table1.order.show_if = db.table1.colour.belongs(['red', 'blue'])
>>
>> Anthony
>>
>> On Tuesday, June 2, 2015 at 6:09:20 AM UTC-4, kecajk...@gmail.com wrote:
>>>
>>> Hi, 
>>>
>>> I'm using show_if to hide a filed of my form under certain conditions.
>>> Per web2py guide, show_if uses simple query, but it doesn't work for 
>>> logical oprators like "and" "or".
>>> In below example i would like to display field "order" just when colour 
>>> is set to "blue" or "red".
>>>
>>> db.define_table('table1', Field('colour', 
>>> requires=IS_IN_SET(['blue','red','yellow'])), Field('order'))
>>>
>>> ## That works fine
>>> db.table1.order.show_if = (db.table1.colour=='red')
>>>
>>> #that doesn't work returning error " 'Query' object has no attribute 
>>> 'tablename'"
>>> db.table1.order.show_if = (db.table1.colour=='red') | 
>>> (db.table1.colour=='blue')
>>>
>>> form=SQLFORM(db.table1)
>>>
>>>
>>> Any ideas?
>>>
>>> Also is it possible to use show_if with SQLFORM.factory ? I don't need 
>>> database for that form, but i want to use show_if.
>>>
>>> Thanks.
>>>
>>

-- 
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: CAS with OpenSSL-Certificates

2016-02-16 Thread Niphlod
imho 2.7.10 and its certificate validation done by default is messing the 
consumer app. But you wouldn't absolutely be able to log in the consumer 
app...

On Tuesday, February 16, 2016 at 3:31:05 PM UTC+1, Frank Bunt wrote:
>
> I'm trying to get CAS auth working with "https://.."; but it is giving me 
> problems. Below is my setup
>
> 1. Environment is ArchLinux (Banana M2) + RocketServer + Web2py: 
> Web2Py 2.13.4, Rocket 1.2.6, Python 2.7.10
> All databases running on SQLite, default app path.
>
> 2. I have one web2py app that acts as a CAS provider:
> db.py with auth = Auth(db) und auth.define_tables(username=True, 
> signature=False)
> default.py with def user(): return dict(form=auth())
>
> 3. I have another consumer web2py app that uses the CAS-web2py app as CAS 
> provider for authentication. 
> db.py with auth=Auth(db,cas_provider='https://.../default/user_cas/cas'), 
> auth.define_tables(username=True, signature=False)
>
> 4. The Web2py-Framework is started using OpenSSL-Certificates
> 'python2 web2py -a 'password' -c server.crt -k server.key -i 0.0.0.0  -p 
> 443' 
>
>
> Problem:
> 1. When I use the login in the CAS-application I can manage the users 
> (login an add new user)
> 2. When I use the consumer application I can login using the CAS-provider 
> application, but the user is not added in the table db.auth_user of the 
> consumer application.
> So if I write a dataset in an table with the 'auth_signature'-field there 
> is the 'IntegrityError: FOREIGN KEY contraint failed'
>

-- 
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: Problems nginx on centos

2016-02-16 Thread Niphlod
leave nginx a part for now. start simple. run the included webserver, hit 
the page, see what happens. if it redirects, then it's your app's fault. if 
not, some weird config of nginx. and start from there upwards.

-- 
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: one select form multiple table

2016-02-16 Thread Alfonso Serra

executesql always return tuples and thats ok unless you need to to hide 
columns, remove elements, edit or add data and such. 
To turn a tuple into a list is just result = list(result)

To return a table web2py has many "magic" methods like SQLFORM.grid or 
SQLFORM.smartgrid that will only work if you are able to construct an union 
query using DAL.

Because you are using executesql you will have to code your view or create 
a custom function with web2py helpers to generate the desired html.

Theres a chapter 
about
 
combining rows but i dont know if thats what you are looking for.

-- 
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: charts on web2py

2016-02-16 Thread Junior Phanter
Use highcharts
http://www.highcharts.com

Example:

*ON CONTROLLER*

def chart():

dados_chart="[{name: 'Batata', y: 12},{name: 'Tomate', y: 8},{name:
'Mamão', y: 12}]" #Change this dynamically

dados_map={}
dados_map["dados"]=dados_chart

chart="""

Highcharts.setOptions({
lang:{
downloadJPEG: "Download em imagem JPG",
downloadPDF: "Download em documento PDF",
downloadPNG: "Download em imagem PNG",
downloadSVG: "Download em vetor SVG",
loading: "Lendo...",
noData: "Sem dados para mostrar",
printChart: "Imprimir Gráfico",
}
});

// Build the chart
$('#chart').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie'
},
title: {
text: 'Meu Gráfico'
},
tooltip: {
pointFormat: '{series.name}: {point.percentage:.1f}%%'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: true
}
},
credits:{enabled:false},
series: [{
name: 'Vendar por porcentagem',
colorByPoint: true,
data: %(dados)s
}]
});


""" %dados_map
return dict(chart=XML(chart))

*ON VIEW*

{{extend 'layout.html'}}




{{=chart}}

2016-02-15 12:52 GMT-03:00 :

> I used google charts using a simple bar chart since I couldn't find a
> workable example on the slice using pygal etc. But google chart seems
> little slow in loading on the browser and I believe it may be due to
> loading the js file from the remote site. Does anyone have the same
> experience? If so, how did they resolve it. I tried to load the js file
> locally but was unable to make that to work.
>
>
>
> On Monday, January 25, 2016 at 8:32:01 AM UTC-5, Diego Tostes wrote:
>>
>> thanks!
>>
>>
>> 2016-01-22 1:10 GMT-02:00 Junior Phanter :
>>
>>> Example using just google chart api, without google-charts-plug-in
>>>
>>> on controller
>>>
>>> def chart():
>>> title="My Chart"
>>> data=XML('[ ["item", "value"], ["apple", 1], ["potato", 1.5],
>>> ["watermelon", 0.5]]') #convert list in string and string in XML
>>> return dict(title=title, data=data)
>>>
>>> on view (chart.html)
>>>
>>> {{extend 'layout.html'}}
>>>
>>> 
>>>
>>> https://www.gstatic.com/charts/loader.js";>
>>>
>>> 
>>>   google.charts.load('current', {'packages':['corechart']});
>>>   google.charts.setOnLoadCallback(drawChart);
>>>   function drawChart() {
>>>
>>> var data = google.visualization.arrayToDataTable({{=data}});
>>>
>>> var options = {
>>>   title: '{{=title}}'
>>> };
>>>
>>> var chart = new
>>> google.visualization.PieChart(document.getElementById('my_chart'));
>>>
>>> chart.draw(data, options);
>>>   }
>>> 
>>>
>>>
>>> 2016-01-21 18:01 GMT-03:00 Diego Tostes :
>>>
 i am trying to use google chart plugin, but the example at
 http://www.web2pyslices.com/slice/show/1721/google-charts-plugin, it
 is not so clear to me.

 anybody can show me a example with a controller and a view?

 i need a simple line chart.

 rgds

 diego

 2016-01-21 17:36 GMT-02:00 Diego Tostes :

> thanks for all!
>
>
> 2016-01-21 14:17 GMT-02:00 Alex :
>
>> my favorite chart library:
>> https://www.amcharts.com/
>> very beautiful, easy to use, good documentation and friendly license
>> (allows usage of free version even for commercial websites).
>>
>> Alex
>>
>> --
>> 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+un...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.
>

Re: [web2py] Re: charts on web2py

2016-02-16 Thread rajjmatthur
I got a blank screen. lol

On Tuesday, February 16, 2016 at 12:54:53 PM UTC-5, Junior Phanter wrote:
>
> Use highcharts
> http://www.highcharts.com
>
> Example:
>
> *ON CONTROLLER*
>
> def chart():
>
> dados_chart="[{name: 'Batata', y: 12},{name: 'Tomate', y: 8},{name: 
> 'Mamão', y: 12}]" #Change this dynamically
>
> dados_map={}
> dados_map["dados"]=dados_chart
>
> chart="""
> 
> Highcharts.setOptions({
> lang:{
> downloadJPEG: "Download em imagem JPG",
> downloadPDF: "Download em documento PDF",
> downloadPNG: "Download em imagem PNG",
> downloadSVG: "Download em vetor SVG",
> loading: "Lendo...",
> noData: "Sem dados para mostrar",
> printChart: "Imprimir Gráfico",
> }
> });
>
> // Build the chart
> $('#chart').highcharts({
> chart: {
> plotBackgroundColor: null,
> plotBorderWidth: null,
> plotShadow: false,
> type: 'pie'
> },
> title: {
> text: 'Meu Gráfico'
> },
> tooltip: {
> pointFormat: '{series.name}: {point.percentage:.1f}%%'
> },
> plotOptions: {
> pie: {
> allowPointSelect: true,
> cursor: 'pointer',
> dataLabels: {
> enabled: false
> },
> showInLegend: true
> }
> },
> credits:{enabled:false},
> series: [{
> name: 'Vendar por porcentagem',
> colorByPoint: true,
> data: %(dados)s
> }]
> });
> 
>
> """ %dados_map
> return dict(chart=XML(chart))
>
> *ON VIEW*
>
> {{extend 'layout.html'}}
>  type="text/javascript">
>  type="text/javascript">
> 
> 
> {{=chart}}
>
> 2016-02-15 12:52 GMT-03:00 >:
>
>> I used google charts using a simple bar chart since I couldn't find a 
>> workable example on the slice using pygal etc. But google chart seems 
>> little slow in loading on the browser and I believe it may be due to 
>> loading the js file from the remote site. Does anyone have the same 
>> experience? If so, how did they resolve it. I tried to load the js file 
>> locally but was unable to make that to work.
>>
>>  
>>
>> On Monday, January 25, 2016 at 8:32:01 AM UTC-5, Diego Tostes wrote:
>>>
>>> thanks!
>>>
>>>
>>> 2016-01-22 1:10 GMT-02:00 Junior Phanter :
>>>
 Example using just google chart api, without google-charts-plug-in

 on controller

 def chart():
 title="My Chart"
 data=XML('[ ["item", "value"], ["apple", 1], ["potato", 1.5], 
 ["watermelon", 0.5]]') #convert list in string and string in XML
 return dict(title=title, data=data)

 on view (chart.html)

 {{extend 'layout.html'}}

 

 https://www.gstatic.com/charts/loader.js";>

 
   google.charts.load('current', {'packages':['corechart']});
   google.charts.setOnLoadCallback(drawChart);
   function drawChart() {

 var data = google.visualization.arrayToDataTable({{=data}});

 var options = {
   title: '{{=title}}'
 };

 var chart = new 
 google.visualization.PieChart(document.getElementById('my_chart'));

 chart.draw(data, options);
   }
 


 2016-01-21 18:01 GMT-03:00 Diego Tostes :

> i am trying to use google chart plugin, but the example at 
> http://www.web2pyslices.com/slice/show/1721/google-charts-plugin, it 
> is not so clear to me.
>
> anybody can show me a example with a controller and a view?
>
> i need a simple line chart.
>
> rgds
>
> diego
>
> 2016-01-21 17:36 GMT-02:00 Diego Tostes :
>
>> thanks for all!
>>
>>
>> 2016-01-21 14:17 GMT-02:00 Alex :
>>
>>> my favorite chart library:
>>> https://www.amcharts.com/
>>> very beautiful, easy to use, good documentation and friendly license 
>>> (allows usage of free version even for commercial websites).
>>>
>>> Alex
>>>
>>> -- 
>>> 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://g

[web2py] zip file length problem

2016-02-16 Thread Yebach
Hello

I have a following problem

When I try to serve a zip file to user i get the following error

Uncompressed size\nTypeError: object of type \'NoneType\' has no len()

There is data to be compressed, but there is lots of it so this I believe 
is causing the problem

my code is the following:

def exportLssOut():
scriptId = request.args[0]
userId = auth.user_id
ExportConditionsCheck(userId)
query = db(db.scripts.id == scriptId).select(db.scripts.sc_engine_output, 
db.scripts.sc_lls,
 
db.scripts.sc_menu_data, db.scripts.sc_errors).first()

engineOutData = query['sc_engine_output']
llsData = query['sc_lls']
jsonDb = query['sc_menu_data']
jsonErrors = query['sc_errors']
#
import zipfile, cStringIO
exported_chunks_zip = cStringIO.StringIO()
zipf = zipfile.ZipFile(exported_chunks_zip, "w", 
compression=zipfile.ZIP_STORED )
   
zipf.writestr('%s_lls.txt' % str(scriptId), llsData)
zipf.writestr('%s_out.txt' % str(scriptId), engineOutData)
zipf.writestr('%s_json.txt' % str(scriptId), jsonDb)
zipf.writestr('%s_json_err.txt' % str(scriptId), jsonErrors)

zipf.close()

moment =  datetime.datetime.now().strftime('%Y%m%dT%H%M%S') 
response.headers['Content-Type']='multipart/x-zip'
response.headers['Content-Disposition']='attachment; 
filename=ExportLLSOUT_%s.zip'% (moment) 
#formatedDateTime = '%s%s%sT%s%s%s' % (dateTimeNow.year, dateTimeNow.month, 
dateTimeNow.day ,dateTimeNow.hour,dateTimeNow.minute,dateTimeNow.second ) 
return exported_chunks_zip.getvalue()



any suggestions?

thank you



-- 
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: zip file length problem

2016-02-16 Thread Niphlod
how much is "lots" ? if it was a memory problem, the traceback would 
probably return something else... also... what's the line that raises the 
error ?

On Tuesday, February 16, 2016 at 8:00:14 PM UTC+1, Yebach wrote:
>
> Hello
>
> I have a following problem
>
> When I try to serve a zip file to user i get the following error
>
> Uncompressed size\nTypeError: object of type \'NoneType\' has no len()
>
> There is data to be compressed, but there is lots of it so this I believe 
> is causing the problem
>
> my code is the following:
>
> def exportLssOut():
> scriptId = request.args[0]
> userId = auth.user_id
> ExportConditionsCheck(userId)
> query = db(db.scripts.id == scriptId).select(db.scripts.sc_engine_output, 
> db.scripts.sc_lls,
>  
> db.scripts.sc_menu_data, db.scripts.sc_errors).first()
> 
> engineOutData = query['sc_engine_output']
> llsData = query['sc_lls']
> jsonDb = query['sc_menu_data']
> jsonErrors = query['sc_errors']
> #
> import zipfile, cStringIO
> exported_chunks_zip = cStringIO.StringIO()
> zipf = zipfile.ZipFile(exported_chunks_zip, "w", 
> compression=zipfile.ZIP_STORED )
>
> zipf.writestr('%s_lls.txt' % str(scriptId), llsData)
> zipf.writestr('%s_out.txt' % str(scriptId), engineOutData)
> zipf.writestr('%s_json.txt' % str(scriptId), jsonDb)
> zipf.writestr('%s_json_err.txt' % str(scriptId), jsonErrors)
> 
> zipf.close()
> 
> moment =  datetime.datetime.now().strftime('%Y%m%dT%H%M%S') 
> response.headers['Content-Type']='multipart/x-zip'
> response.headers['Content-Disposition']='attachment; 
> filename=ExportLLSOUT_%s.zip'% (moment) 
> #formatedDateTime = '%s%s%sT%s%s%s' % (dateTimeNow.year, 
> dateTimeNow.month, dateTimeNow.day 
> ,dateTimeNow.hour,dateTimeNow.minute,dateTimeNow.second ) 
> return exported_chunks_zip.getvalue()
>
>
>
> any suggestions?
>
> thank you
>
>
>
>

-- 
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: zip file length problem

2016-02-16 Thread Yebach

My mistake,

I was looking at the wrong line of code, there is no data that comes to 
zipf.writestr

I apologize

Thank you anyway


Sorry for not being factual about my problem

On Tuesday, February 16, 2016 at 8:40:59 PM UTC+1, Niphlod wrote:
>
> how much is "lots" ? if it was a memory problem, the traceback would 
> probably return something else... also... what's the line that raises the 
> error ?
>
> On Tuesday, February 16, 2016 at 8:00:14 PM UTC+1, Yebach wrote:
>>
>> Hello
>>
>> I have a following problem
>>
>> When I try to serve a zip file to user i get the following error
>>
>> Uncompressed size\nTypeError: object of type \'NoneType\' has no len()
>>
>> There is data to be compressed, but there is lots of it so this I believe 
>> is causing the problem
>>
>> my code is the following:
>>
>> def exportLssOut():
>> scriptId = request.args[0]
>> userId = auth.user_id
>> ExportConditionsCheck(userId)
>> query = db(db.scripts.id == 
>> scriptId).select(db.scripts.sc_engine_output, db.scripts.sc_lls,
>>  
>> db.scripts.sc_menu_data, db.scripts.sc_errors).first()
>> 
>> engineOutData = query['sc_engine_output']
>> llsData = query['sc_lls']
>> jsonDb = query['sc_menu_data']
>> jsonErrors = query['sc_errors']
>> #
>> import zipfile, cStringIO
>> exported_chunks_zip = cStringIO.StringIO()
>> zipf = zipfile.ZipFile(exported_chunks_zip, "w", 
>> compression=zipfile.ZIP_STORED )
>>
>> zipf.writestr('%s_lls.txt' % str(scriptId), llsData)
>> zipf.writestr('%s_out.txt' % str(scriptId), engineOutData)
>> zipf.writestr('%s_json.txt' % str(scriptId), jsonDb)
>> zipf.writestr('%s_json_err.txt' % str(scriptId), jsonErrors)
>> 
>> zipf.close()
>> 
>> moment =  datetime.datetime.now().strftime('%Y%m%dT%H%M%S') 
>> response.headers['Content-Type']='multipart/x-zip'
>> response.headers['Content-Disposition']='attachment; 
>> filename=ExportLLSOUT_%s.zip'% (moment) 
>> #formatedDateTime = '%s%s%sT%s%s%s' % (dateTimeNow.year, 
>> dateTimeNow.month, dateTimeNow.day 
>> ,dateTimeNow.hour,dateTimeNow.minute,dateTimeNow.second ) 
>> return exported_chunks_zip.getvalue()
>>
>>
>>
>> any suggestions?
>>
>> thank you
>>
>>
>>
>>

-- 
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: Reporting app with Web2Py

2016-02-16 Thread Anthony

>
> *Controller*
>
> def getcostdata():
>  db.executesql (*get data on costs, for example*)
>  transform data
>  plotting library internals
>
> *View*
> view data using plot library/html
>
> Questions:
> 1. Should I use session variable and retrieve data from a dictionary - 
> build some kind of cache (that expires at a certain interval) so multiple 
> views won't run the same query multiple times needlessly?
>

Sure, but keep in mind the session is for a single user. If you want to 
share the results of a query across multiple users, use the cache instead.
 

> 2. I've seen some people say that functions like this should be placed 
> inside a model or a module? Is there a difference in performance : 
> controller vs. model vs. module?
>

Not sure what you mean by "functions like this." Controller actions should 
be used for the purpose of generating responses to HTTP requests at a 
particular URL. If you have a function that needs to be used more 
generally, move it to a model or module and call it from a controller or 
wherever else it is needed.

Putting functions in modules (rather than model files) will be a little 
more efficient (no need to redefine on every request), but probably not too 
big a deal, particularly for just a few small functions.
 

> 3. I would like to reuse the information from a function in another place 
> in my app but not load it needlessly -> module?
>

Sure.
 

> 4. How can call a function from another controller ?
>

Depends what you mean. If you want to make a direct function call, put the 
function in a model or module and call it from whichever controllers need 
it. Alternatively, you could make an internal HTTP request to the URL of 
the other controller, but that's probably not what you're looking to do.

Anthony

-- 
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] Progress bars and session

2016-02-16 Thread Alfonso Serra
Im trying to make a progress bar by reading and writing a session variable:

There are 2 controllers:
Get session.progress
def getprogress():
print "getprogress:", session.progress
return session.progress

This one takes 5 seconds to perform and changes session.progress each one.
def progress():
# when a form is submitted, change progress each second
if request.post_vars:
for i in range(5):
session.progress = i
print "main:", session.progress
sleep(1)
return "done"
else:
session.progress = -1
return locals()

At the view, there are two ajax calls. One that triggers "getprogress" each 
second, and another one that triggers "progress" when a random form is 
submitted.

at the browser's console, getprogress only returns -1

at the python console i get a log like this:
getprogress: -1
getprogress: -1
main: 0
getprogress: -1
main: 1
getprogress: -1
main: 2
getprogress: -1
main: 3
getprogress: -1
main: 4
getprogress: -1

getprogress should be changing since im writing the session variable.

If im changing a session variable in a controller why hasnt changed when i 
ask for it on another one?

Should i be using cron jobs or threads to make a progress bar?

Thank you very much.

-- 
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] SQLFORM.factory - form.process().accepted fails first time but works after that

2016-02-16 Thread Jim S
I have a simple SQLFORM.factory form.

Sometimes when I click on the submit button the 
form.process(keepvalues=True).accepted returns False - clicking on enter 
immediately following results in it returning True.  I'm not getting any 
error or flash messages.

I don't know where to begin looking for my problem.

Here is the relevant code:

fields = []
fields.append(Field('brix_level', 'decimal(5,2)', required=True, requires=
IS_FLOAT_IN_RANGE(70, 99),
 default=wo.brix_level))

form = SQLFORM.factory(*fields)

form.element(_name='brix_level').update(_class='form-control')

if form.process(keepvalues=True).accepted:

Sometimes it will return False, and then re-submitting with no changes on 
screen, it will return True.

This is happening in my form that is in a LOADed Component in a bootstrap 
modal window.

Sequence of events:

1. Click button to display the modal window and the form.
2. Change brix level from 86 to 85
3. Click on submit

form.process().accepted returns False

brix level on the form field returns to 86

4. Change brix level from 86 to 85
5. Click on Submit

Everything works fine...

Any ideas what I'm missing?

-Jim

-- 
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] apache2/pam/pwauth to remove www-data from shadow group

2016-02-16 Thread kwebb
'm trying to get UNIX logins working using pam.  I was able to get the user 
login to work if I add www-data to the shadow group.  To get this working, 
I had to add www-data to the shadow group.  This is considered a bad 
practice, and pwauth is possibly the solution.  I was able to confgure 
pwauth and test it with htaccess to get it working.  In my apache config I 
added:

  AddExternalAuth pwauth /usr/sbin/pwauth
  SetExternalAuthMethod pwauth pipe

  

  Order deny,allow
  Allow from all

AuthType Basic
AuthName "Restricted"
AuthBasicProvider external
AuthExternal pwauth
require valid-user
  

Next, in gluon/contrib/login_methods, I changed the pam service in the 
authenticate() call:

return authenticate(username, password, service='pwauth')

>From /var/log/auth.log I get:

Feb 16 14:10:27 tibs2 unix_chkpwd[11030]: check pass; user unknown
Feb 16 14:10:27 tibs2 unix_chkpwd[11030]: password check failed for user 
(kwebb)
Feb 16 14:10:27 tibs2 apache2: pam_unix(pwauth:auth): authentication 
failure; logname= uid=33 euid=33 tty= ruser= rhost= user=kwebb

It works if I go back and add www-data to the shadow group in /etc/passwd. 
 I've also found some references to this in an Ubuntu 14.04 install
for web2py which I am trying to avoid:

usermod -a -G shadow www-data

Here is my pam config file for pwauth:

#
# The PAM configuration file for the `pwauth' service
#

# Disallows other than root logins when /etc/nologin exists
# (Replaces the `NOLOGINS_FILE' option from login.defs)
auth requisite pam_nologin.so

# Standard Un*x authentication.
@include common-auth

# Standard Un*x account
@include common-account

-- 
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: SQLFORM.factory - form.process().accepted fails first time but works after that

2016-02-16 Thread Anthony
Can you attach a minimal app that reproduces the problem?

On Tuesday, February 16, 2016 at 4:17:04 PM UTC-5, Jim S wrote:
>
> I have a simple SQLFORM.factory form.
>
> Sometimes when I click on the submit button the 
> form.process(keepvalues=True).accepted returns False - clicking on enter 
> immediately following results in it returning True.  I'm not getting any 
> error or flash messages.
>
> I don't know where to begin looking for my problem.
>
> Here is the relevant code:
>
> fields = []
> fields.append(Field('brix_level', 'decimal(5,2)', required=True, requires=
> IS_FLOAT_IN_RANGE(70, 99),
>  default=wo.brix_level))
>
> form = SQLFORM.factory(*fields)
>
> form.element(_name='brix_level').update(_class='form-control')
>
> if form.process(keepvalues=True).accepted:
>
> Sometimes it will return False, and then re-submitting with no changes on 
> screen, it will return True.
>
> This is happening in my form that is in a LOADed Component in a bootstrap 
> modal window.
>
> Sequence of events:
>
> 1. Click button to display the modal window and the form.
> 2. Change brix level from 86 to 85
> 3. Click on submit
>
> form.process().accepted returns False
>
> brix level on the form field returns to 86
>
> 4. Change brix level from 86 to 85
> 5. Click on Submit
>
> Everything works fine...
>
> Any ideas what I'm missing?
>
> -Jim
>

-- 
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: Progress bars and session

2016-02-16 Thread Anthony
During a single request, the "session" object is just a copy of the session 
data stored in the session file. Any updates to the session during a 
request are not written back out to the session file until after the 
request has completed. So, in the progress() function, you are not updating 
the session file itself every second, you are only updating that request's 
local copy of the session data. Repeated calls to getprogress() will 
therefore only see the original value from the session.

Anthony

On Tuesday, February 16, 2016 at 4:15:06 PM UTC-5, Alfonso Serra wrote:
>
> Im trying to make a progress bar by reading and writing a session variable:
>
> There are 2 controllers:
>
> Get session.progress
> def getprogress():
> print "getprogress:", session.progress
> return session.progress
>
> This one takes 5 seconds to perform and changes session.progress each one.
> def progress():
> # when a form is submitted, change progress each second
> if request.post_vars:
> for i in range(5):
> session.progress = i
> print "main:", session.progress
> sleep(1)
> return "done"
> else:
> session.progress = -1
> return locals()
>
> At the view, there are two ajax calls. One that triggers "getprogress" 
> each second, and another one that triggers "progress" when a random form is 
> submitted through ajax to avoid redirection.
>
> at the browser's console, getprogress only returns -1
>
> at the python console i get a log like this:
> getprogress: -1
> getprogress: -1
> main: 0
> getprogress: -1
> main: 1
> getprogress: -1
> main: 2
> getprogress: -1
> main: 3
> getprogress: -1
> main: 4
> getprogress: -1
>
> getprogress should be changing since im writing the session variable.
>
> If im changing a session variable in a controller why hasnt changed when i 
> ask for it on another one?
>
> Should i be using cron jobs or threads to make a progress bar? Whats the 
> best way?
>
> Thank you very much.
>
>

-- 
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: Progress bars and session

2016-02-16 Thread Anthony
Here's a hack that might work:

def progress():
# when a form is submitted, change progress each second
if request.post_vars:
for i in range(5):
session.progress = i
# Write to the session file and unlock/close it.
session._try_store_in_file(request, response)
print "main:", session.progress
sleep(1)
# Re-open and re-lock the session file.
session.connect()
return "done"
else:
session.progress = -1
return locals()

Note, this is not part of the public API and writing/closing/reconnecting 
to the session multiple times per request is not an officially supported 
feature.

Anthony

On Tuesday, February 16, 2016 at 6:24:20 PM UTC-5, Anthony wrote:
>
> During a single request, the "session" object is just a copy of the 
> session data stored in the session file. Any updates to the session during 
> a request are not written back out to the session file until after the 
> request has completed. So, in the progress() function, you are not updating 
> the session file itself every second, you are only updating that request's 
> local copy of the session data. Repeated calls to getprogress() will 
> therefore only see the original value from the session.
>
> Anthony
>
> On Tuesday, February 16, 2016 at 4:15:06 PM UTC-5, Alfonso Serra wrote:
>>
>> Im trying to make a progress bar by reading and writing a session 
>> variable:
>>
>> There are 2 controllers:
>>
>> Get session.progress
>> def getprogress():
>> print "getprogress:", session.progress
>> return session.progress
>>
>> This one takes 5 seconds to perform and changes session.progress each one.
>> def progress():
>> # when a form is submitted, change progress each second
>> if request.post_vars:
>> for i in range(5):
>> session.progress = i
>> print "main:", session.progress
>> sleep(1)
>> return "done"
>> else:
>> session.progress = -1
>> return locals()
>>
>> At the view, there are two ajax calls. One that triggers "getprogress" 
>> each second, and another one that triggers "progress" when a random form is 
>> submitted through ajax to avoid redirection.
>>
>> at the browser's console, getprogress only returns -1
>>
>> at the python console i get a log like this:
>> getprogress: -1
>> getprogress: -1
>> main: 0
>> getprogress: -1
>> main: 1
>> getprogress: -1
>> main: 2
>> getprogress: -1
>> main: 3
>> getprogress: -1
>> main: 4
>> getprogress: -1
>>
>> getprogress should be changing since im writing the session variable.
>>
>> If im changing a session variable in a controller why hasnt changed when 
>> i ask for it on another one?
>>
>> Should i be using cron jobs or threads to make a progress bar? Whats the 
>> best way?
>>
>> Thank you very much.
>>
>>

-- 
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 set default country in dropdown list

2016-02-16 Thread Winter Kryz



I created a module Countries.py with all the country names, imported into 
my model db.py and 

from applications.Egressum.modules.
countries import *
...
 Field ('countries', requires = IS_IN_SET(COUNTRIES), default='United 
States'),

then when I go to execute it, I get the following error

 (1025, "Error on rename of 
'./Kryz@0024db_egressum_we2py/#sql-3348_193e111' to 
'./Kryz@0024db_egressum_we2py/Person' (errno: 150)") 
What am I doing wrong?
Thanks!

-- 
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: Progress bars and session

2016-02-16 Thread Alfonso Serra
Thanks Anthony, it does work.

The hack is easy to implement, but to represent the insertion of 30k 
records into the database, writing the session file and connecting 30k 
times might not be optimal.

Theres a chapter about the Scheduler that may work for this. Ill read about 
it, it has something to report percentages  


Does anyone knows any resource to implement a progress bar in web2py? (not 
just for uploading files)

Thanks
Best 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] problem with sessions2trash.py

2016-02-16 Thread peter
I want to clean up sessions every 5 minutes.

When I do

nohup python web2py.py -S app -M -R scripts/sessions2trash.py &

replacing app with my apps name, I get

Traceback (most recent call last):
  File "web2py.py", line 18, in ?
import gluon.widget
  File "/opt/web-apps/web2py/gluon/__init__.py", line 15, in ?
from globals import current
  File "/opt/web-apps/web2py/gluon/globals.py", line 84
self.write(EMPTY_DICT if self.bin else MARK+DICT)
   ^
SyntaxError: invalid syntax


I am running Web2py version 2.8.2

Any Ideas?

Thanks
Peter

-- 
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: one select form multiple table

2016-02-16 Thread Richard Vézina
I think like this you make you union search without worry about SQL
injection :

results = db(db.table1.field1 ==
'%{0}%'.format(form.vars.search)).select(db.table1.field1.with_alias('searchfield'))
  |
  db(db.table2.field2 ==
'%{0}%'.format(form.vars.search)).select(db.table2.field2.with_alias('searchfield'))


You may want to play with & and | depending if you want include duplicate
or not...

Though, I am not sure about you database design if you need to do such
thing since having the name of differents user host in table name is
smelling, I would rather add a column in one of the table indicating which
one between the 2 persons the host is own by and combine all the records
into that single "normalized" table...

Richard

On Tue, Feb 16, 2016 at 12:13 PM, Alfonso Serra 
wrote:

>
> executesql always return tuples and thats ok unless you need to to hide
> columns, remove elements, edit or add data and such.
> To turn a tuple into a list is just result = list(result)
>
> To return a table web2py has many "magic" methods like SQLFORM.grid or
> SQLFORM.smartgrid that will only work if you are able to construct an union
> query using DAL.
>
> Because you are using executesql you will have to code your view or create
> a custom function with web2py helpers to generate the desired html.
>
> Theres a chapter
> about
> combining rows but i dont know if thats what you are looking for.
>
> --
> 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] problem with sessions2trash.py

2016-02-16 Thread Richard Vézina
hmm hmm, 2.8.2 is pretty old... I am not sure, but I think I remember read
about issue in sessions2trash script... I would start by investigating if
that was really the case...

Richard

On Tue, Feb 16, 2016 at 7:33 PM, peter  wrote:

> I want to clean up sessions every 5 minutes.
>
> When I do
>
> nohup python web2py.py -S app -M -R scripts/sessions2trash.py &
>
> replacing app with my apps name, I get
>
> Traceback (most recent call last):
>   File "web2py.py", line 18, in ?
> import gluon.widget
>   File "/opt/web-apps/web2py/gluon/__init__.py", line 15, in ?
> from globals import current
>   File "/opt/web-apps/web2py/gluon/globals.py", line 84
> self.write(EMPTY_DICT if self.bin else MARK+DICT)
>^
> SyntaxError: invalid syntax
>
>
> I am running Web2py version 2.8.2
>
> Any Ideas?
>
> Thanks
> Peter
>
> --
> 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] problem with sessions2trash.py

2016-02-16 Thread Richard Vézina
Found this :
https://groups.google.com/forum/?hl=zh-TW#!topic/web2py/w742DgCajIo

May apply, sorry I don't understand why google group display in asian
language but the thread message are in plain english...

I didn't find any report of session2trash issue other then that...

Richard

On Tue, Feb 16, 2016 at 9:48 PM, Richard Vézina  wrote:

> hmm hmm, 2.8.2 is pretty old... I am not sure, but I think I remember read
> about issue in sessions2trash script... I would start by investigating if
> that was really the case...
>
> Richard
>
> On Tue, Feb 16, 2016 at 7:33 PM, peter  wrote:
>
>> I want to clean up sessions every 5 minutes.
>>
>> When I do
>>
>> nohup python web2py.py -S app -M -R scripts/sessions2trash.py &
>>
>> replacing app with my apps name, I get
>>
>> Traceback (most recent call last):
>>   File "web2py.py", line 18, in ?
>> import gluon.widget
>>   File "/opt/web-apps/web2py/gluon/__init__.py", line 15, in ?
>> from globals import current
>>   File "/opt/web-apps/web2py/gluon/globals.py", line 84
>> self.write(EMPTY_DICT if self.bin else MARK+DICT)
>>^
>> SyntaxError: invalid syntax
>>
>>
>> I am running Web2py version 2.8.2
>>
>> Any Ideas?
>>
>> Thanks
>> Peter
>>
>> --
>> 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: charts on web2py

2016-02-16 Thread Junior Phanter
you Inserts jquery in your view?
It works for me...


​

2016-02-16 15:40 GMT-03:00 :

> I got a blank screen. lol
>
>
> On Tuesday, February 16, 2016 at 12:54:53 PM UTC-5, Junior Phanter wrote:
>
>> Use highcharts
>> http://www.highcharts.com
>>
>> Example:
>>
>> *ON CONTROLLER*
>>
>> def chart():
>>
>> dados_chart="[{name: 'Batata', y: 12},{name: 'Tomate', y: 8},{name:
>> 'Mamão', y: 12}]" #Change this dynamically
>>
>> dados_map={}
>> dados_map["dados"]=dados_chart
>>
>> chart="""
>> 
>> Highcharts.setOptions({
>> lang:{
>> downloadJPEG: "Download em imagem JPG",
>> downloadPDF: "Download em documento PDF",
>> downloadPNG: "Download em imagem PNG",
>> downloadSVG: "Download em vetor SVG",
>> loading: "Lendo...",
>> noData: "Sem dados para mostrar",
>> printChart: "Imprimir Gráfico",
>> }
>> });
>>
>> // Build the chart
>> $('#chart').highcharts({
>> chart: {
>> plotBackgroundColor: null,
>> plotBorderWidth: null,
>> plotShadow: false,
>> type: 'pie'
>> },
>> title: {
>> text: 'Meu Gráfico'
>> },
>> tooltip: {
>> pointFormat: '{series.name}: {point.percentage:.1f}%%'
>> },
>> plotOptions: {
>> pie: {
>> allowPointSelect: true,
>> cursor: 'pointer',
>> dataLabels: {
>> enabled: false
>> },
>> showInLegend: true
>> }
>> },
>> credits:{enabled:false},
>> series: [{
>> name: 'Vendar por porcentagem',
>> colorByPoint: true,
>> data: %(dados)s
>> }]
>> });
>> 
>>
>> """ %dados_map
>> return dict(chart=XML(chart))
>>
>> *ON VIEW*
>>
>> {{extend 'layout.html'}}
>> > type="text/javascript">
>> > type="text/javascript">
>> 
>> 
>> {{=chart}}
>>
>> 2016-02-15 12:52 GMT-03:00 :
>>
>>> I used google charts using a simple bar chart since I couldn't find a
>>> workable example on the slice using pygal etc. But google chart seems
>>> little slow in loading on the browser and I believe it may be due to
>>> loading the js file from the remote site. Does anyone have the same
>>> experience? If so, how did they resolve it. I tried to load the js file
>>> locally but was unable to make that to work.
>>>
>>>
>>>
>>> On Monday, January 25, 2016 at 8:32:01 AM UTC-5, Diego Tostes wrote:

 thanks!


 2016-01-22 1:10 GMT-02:00 Junior Phanter :

> Example using just google chart api, without google-charts-plug-in
>
> on controller
>
> def chart():
> title="My Chart"
> data=XML('[ ["item", "value"], ["apple", 1], ["potato", 1.5],
> ["watermelon", 0.5]]') #convert list in string and string in XML
> return dict(title=title, data=data)
>
> on view (chart.html)
>
> {{extend 'layout.html'}}
>
> 
>
> https://www.gstatic.com/charts/loader.js";>
>
> 
>   google.charts.load('current', {'packages':['corechart']});
>   google.charts.setOnLoadCallback(drawChart);
>   function drawChart() {
>
> var data = google.visualization.arrayToDataTable({{=data}});
>
> var options = {
>   title: '{{=title}}'
> };
>
> var chart = new
> google.visualization.PieChart(document.getElementById('my_chart'));
>
> chart.draw(data, options);
>   }
> 
>
>
> 2016-01-21 18:01 GMT-03:00 Diego Tostes :
>
>> i am trying to use google chart plugin, but the example at
>> http://www.web2pyslices.com/slice/show/1721/google-charts-plugin, it
>> is not so clear to me.
>>
>> anybody can show me a example with a controller and a view?
>>
>> i need a simple line chart.
>>
>> rgds
>>
>> diego
>>
>> 2016-01-21 17:36 GMT-02:00 Diego Tostes :
>>
>>> thanks for all!
>>>
>>>
>>> 2016-01-21 14:17 GMT-02:00 Alex :
>>>
 my favorite chart library:
 https://www.amcharts.com/
 very beautiful, easy to use, good documentation and friendly
 license (allows usage of free version even for commercial websites).

 Alex

 --
 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 

[web2py] Re: How to set default country in dropdown list

2016-02-16 Thread Dave S
On Tuesday, February 16, 2016 at 3:51:47 PM UTC-8, Winter Kryz wrote:
>
>
>
>
> I created a module Countries.py with all the country names, imported into 
> my model db.py and 
>
> from applications.Egressum.modules.
> countries import *
> ...
>  Field ('countries', requires = IS_IN_SET(COUNTRIES), default='United 
> States'),
>
> then when I go to execute it, I get the following error
>
>  (1025, "Error on rename of 
> './Kryz@0024db_egressum_we2py/#sql-3348_193e111' to 
> './Kryz@0024db_egressum_we2py/Person' (errno: 150)") 
> What am I doing wrong?
> Thanks!
>
>


The 'rename' in the error message makes me think it is a migration error.   
In moving to the set usage, you've changed the table layout, and that 
requires a migration.  But I'm not a MySql guru, and don't know the error 
numbers, so I'm just going by the text of the message.

However, a quick google turns up 
http://stackoverflow.com/questions/160233/what-does-mysql-error-1025-hy000-error-on-rename-of-foo-errorno-150-me>
which I hope you can make sense of.

/dps

-- 
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: star or favorite an event or list

2016-02-16 Thread Dave S
On Tuesday, February 16, 2016 at 1:32:29 PM UTC-8, rajjm...@gmail.com wrote:
>
> Anyway ever did a star or favorite on something that is saved by reference 
> user to display later. Similar to craiglist or this google group even (like 
> attached)
>
>
>
Does this post help?
https://groups.google.com/d/msg/web2py/9AI7WLX88u0/2WpR6WhhEQAJ>

/dps
 

-- 
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] problem with sessions2trash.py

2016-02-16 Thread Dave S


On Tuesday, February 16, 2016 at 6:51:47 PM UTC-8, Richard wrote:
>
> Found this : 
> https://groups.google.com/forum/?hl=zh-TW#!topic/web2py/w742DgCajIo
>
> May apply, sorry I don't understand why google group display in asian 
> language but the thread message are in plain english...
>

Change the hl=zh-TW in the URL to hl=en
 

>
> I didn't find any report of session2trash issue other then that...
>
> Richard
>
> On Tue, Feb 16, 2016 at 9:48 PM, Richard Vézina  > wrote:
>
>> hmm hmm, 2.8.2 is pretty old... I am not sure, but I think I remember 
>> read about issue in sessions2trash script... I would start by investigating 
>> if that was really the case...
>>
>> Richard
>>
>> On Tue, Feb 16, 2016 at 7:33 PM, peter > > wrote:
>>
>>> I want to clean up sessions every 5 minutes.
>>>
>>> When I do
>>>
>>> nohup python web2py.py -S app -M -R scripts/sessions2trash.py &
>>>
>>> replacing app with my apps name, I get
>>>
>>> Traceback (most recent call last):
>>>   File "web2py.py", line 18, in ?
>>> import gluon.widget
>>>   File "/opt/web-apps/web2py/gluon/__init__.py", line 15, in ?
>>> from globals import current
>>>   File "/opt/web-apps/web2py/gluon/globals.py", line 84
>>> self.write(EMPTY_DICT if self.bin else MARK+DICT)
>>>^
>>> SyntaxError: invalid syntax
>>>
>>>
>>> I am running Web2py version 2.8.2
>>>
>>> Any Ideas?
>>>
>>> Thanks
>>> Peter
>>>
>>> -- 
>>> 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.


[web2py] My web2py app adjusts according to the browser on mobile and look odd? How to load it like Chrome?

2016-02-16 Thread RAGHIB R
The background-image and everything looks curbed, not suited according to 
browser. How to always open a standard size like that which opens in google 
chrome?

-- 
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] problem with sessions2trash.py

2016-02-16 Thread Richard Vézina
Maybe, but don't understand why Mr Google provide me with this link in the
first place...

But anyway, thanks point this tricks...

:)

Richard

On Tue, Feb 16, 2016 at 10:34 PM, Dave S  wrote:

>
>
> On Tuesday, February 16, 2016 at 6:51:47 PM UTC-8, Richard wrote:
>>
>> Found this :
>> https://groups.google.com/forum/?hl=zh-TW#!topic/web2py/w742DgCajIo
>>
>> May apply, sorry I don't understand why google group display in asian
>> language but the thread message are in plain english...
>>
>
> Change the hl=zh-TW in the URL to hl=en
>
>
>>
>> I didn't find any report of session2trash issue other then that...
>>
>> Richard
>>
>> On Tue, Feb 16, 2016 at 9:48 PM, Richard Vézina 
>> wrote:
>>
>>> hmm hmm, 2.8.2 is pretty old... I am not sure, but I think I remember
>>> read about issue in sessions2trash script... I would start by investigating
>>> if that was really the case...
>>>
>>> Richard
>>>
>>> On Tue, Feb 16, 2016 at 7:33 PM, peter  wrote:
>>>
 I want to clean up sessions every 5 minutes.

 When I do

 nohup python web2py.py -S app -M -R scripts/sessions2trash.py &

 replacing app with my apps name, I get

 Traceback (most recent call last):
   File "web2py.py", line 18, in ?
 import gluon.widget
   File "/opt/web-apps/web2py/gluon/__init__.py", line 15, in ?
 from globals import current
   File "/opt/web-apps/web2py/gluon/globals.py", line 84
 self.write(EMPTY_DICT if self.bin else MARK+DICT)
^
 SyntaxError: invalid syntax


 I am running Web2py version 2.8.2

 Any Ideas?

 Thanks
 Peter

 --
 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] problem with sessions2trash.py

2016-02-16 Thread Dave S


On Tuesday, February 16, 2016 at 8:44:12 PM UTC-8, Richard wrote:
>
> Maybe, but don't understand why Mr Google provide me with this link in the 
> first place...
>
>
If you were searching from the usual GG search box, it is surprising.  If 
you searched using a general google search, it depends 

 

> But anyway, thanks point this tricks...
>
> :)
>
> Richard
>
> I don't claim to be clever (okay, so I'm B- clever) or sharp-eyed, but 
sometimes I catch things.  Not so quickly in my own writing.

/dps

 

> On Tue, Feb 16, 2016 at 10:34 PM, Dave S 
> > wrote:
>
>>
>>
>> On Tuesday, February 16, 2016 at 6:51:47 PM UTC-8, Richard wrote:
>>>
>>> Found this : 
>>> https://groups.google.com/forum/?hl=zh-TW#!topic/web2py/w742DgCajIo
>>>
>>> May apply, sorry I don't understand why google group display in asian 
>>> language but the thread message are in plain english...
>>>
>>
>> Change the hl=zh-TW in the URL to hl=en
>>  
>>
>>>
>>> I didn't find any report of session2trash issue other then that...
>>>
>>> Richard
>>>
>>> On Tue, Feb 16, 2016 at 9:48 PM, Richard Vézina  
>>> wrote:
>>>
 hmm hmm, 2.8.2 is pretty old... I am not sure, but I think I remember 
 read about issue in sessions2trash script... I would start by 
 investigating 
 if that was really the case...

 Richard

 On Tue, Feb 16, 2016 at 7:33 PM, peter  wrote:

> I want to clean up sessions every 5 minutes.
>
> When I do
>
> nohup python web2py.py -S app -M -R scripts/sessions2trash.py &
>
> replacing app with my apps name, I get
>
> Traceback (most recent call last):
>   File "web2py.py", line 18, in ?
> import gluon.widget
>   File "/opt/web-apps/web2py/gluon/__init__.py", line 15, in ?
> from globals import current
>   File "/opt/web-apps/web2py/gluon/globals.py", line 84
> self.write(EMPTY_DICT if self.bin else MARK+DICT)
>^
> SyntaxError: invalid syntax
>
>
> I am running Web2py version 2.8.2
>
> Any Ideas?
>
> Thanks
> Peter
>
> -- 
> 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+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.


[web2py] Re: Customize the RESTFUL service output

2016-02-16 Thread Dave S
On Saturday, February 13, 2016 at 9:33:57 AM UTC-8, Mamisoa Andriantafika 
wrote:
>
> Ok here is my answer:
>
>
It took a while to make your answer work for me, partly because my POST() 
procedure didn't have a return.  Eventually I got it figured out,
after lots of flipping back and forth between screens.

Thanks!

/dps

-- 
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.