Paolo Amboni | 5 May 09:36 2016
Picon

matplotlib passing parameters from the view

I'm trying to build a single function (in a controller) that generate different matplotlib graph..

So the function that generate the stream works fine:
def grafico(title='title',xlab='x',ylab='y' data=.... ):
     fig=Figure()
     ....
     return stream.getvalue()


the function that call the privious works fine but not as i want:


def graf_comp_gior():
    test_id=1 # I need to set the id on the fly
    print response.args # Always none why?
    print response.vars #Always none why?

    rows = db(db.tat.id_test==test_id).select()
    tat=pd.DataFrame(rows.as_list())
    .... #manupulate the data as i need

    graf=grafico(........)
    
    return graf

This is the view with the embedded graph works fine:

{{{extend 'layout.html'}}
<h1>TAT completi per l'analisi {{=variabili['anal']}}</h1>
{{=IMG(_src=URL('graf_comp_gior',args=[argomenti[0],vars=dict('id'=argomenti[0])]))}} How can i pass some data to the previous function?

Do i need to store them in a session?
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Chris Guest | 5 May 02:32 2016
Picon

Not seeing logging.error messages in nginx error_log

Not seeing logging.error in nginx error_log


I have a mostly successful install of web2py application with uwsgi and nginx on centos using setup-web2py-nginx-uwsgi-centos70.sh .

But I can't figure out how to configure nginx, uwsgi and wsgihandler.py so that logging.error messages appear in the error_log file. 
I have been able to configure it so that nginx [notice] and [info] messages appear but these are generated by nginx itself and are not coming from logging.notice or logging.info calls in the web2py application. 
 
Can someone post a recipe as to how this is done?

Thanks,
Chris

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Kirill Shatalaev | 4 May 23:40 2016
Picon

Strange trouble with password_reset

Hello, I'm using web2py 2.14.5-stable+timestamp.2016.04.14.03.26.16

mail = logging for testing purposes.

So, controller:

def user():
return dict(form=auth())
Registering new user goes as it must. Email verification (this is console output):
2016-05-05 01:21:14,601 - web2py - WARNING - email not sent ---------------------------------------- From: noreply-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org To: hhh-0XxdDUfNhE4@public.gmane.org Subject: Email verification Click on the link http://127.0.0.1:8000/myblog/default/user/verify_email/17b4d0ed-4af0-4c28-ae77-e6d9b14e109b to verify your email ----------------------------------------

Click this link, so user successfully registered and can login.

But when I try to retrieve_password this is result email:

2016-05-05 01:24:46,313 - web2py - WARNING - email not sent
----------------------------------------
From: noreply-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org
To: hhh-0XxdDUfNhE4@public.gmane.org
Subject: 

None
----------------------------------------

So its subject and body is absolutely empty. The reset password key is created for user  hhh-0XxdDUfNhE4@public.gmane.org and I can see it on my database.

What can I do to fix 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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Jim S | 4 May 21:32 2016

View SQL generated by SQLFORM.grid

I pass a query to SQLFORM.grid.  Is there a way to see the SQL that last executed on behalf of the grid?  I'm trying to tune my db for the SQL statement used to show the list of records.

-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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Antonio Salazar | 4 May 20:48 2016
Picon

User group names based on username instead of id

I've disabled user group creation, but now I need user-specific permissions, so I'm going to re-enable it and create the missing user groups. I'd really like the groups to be user_[username] instead of user_[user_id].
Is there an upgrade-friendly way to base the group name on something other than the user id?

I know it's best practice to use the id because it's unique, but in my case, the username is also unique and invariable. I'd bear the slight risk of inconsistency in exchange for human-readable group names.

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Vic Ding | 3 May 16:48 2016
Picon

create file outside of web2py using IDE

Hi all,

I am using Pycharm together with web2py. I created a model file models/db1.py in IDE and sync it back to the server through SSH. The file is pickup by the server (I can see it in the web IDE) however, I get a complain when visiting the site

name 'db' is not defined

How can I deal with this situation?

Thanks!

Cheers,
Vic

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Vic Ding | 3 May 19:28 2016
Picon

db is not defined in other model files

Hi all,

I have a weird problem with web2py on apache. I created db1.py and created defined tables in it and it works fine. I created another model, name is my_list.py and it does not work. Error is db is not defined in my_list.py. Any idea what the problem might be?
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Kenneth | 4 May 04:10 2016
Picon
Gravatar

Enabling Unicode characters in URL

Hello there,

I'd like to create URLs in unicode characters and I get "Invalid Request" error when I do. I tried to reconfigure on Nginx side but wasn't able to work it properly.

For example, this curl call will output "Invalid Request".

curl http://localhost:8080/与

Grateful if there is a solution to detect and read URLs in unicode characters. 

My Web2Py server is currently running Nginx and WSGI.

Cheers,


--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
aetagothno | 4 May 03:53 2016
Picon

opening new file within controller and uploading to uploads?

I would like to open and write to a new file after accessing form variables passed from views...

I've been trying to find a similar problem, but not much luck ..

I suppose I can create another table with tempfile field of type uploads, and then do a database controller within the controller..

However I am wondering if there is an alternative way, where I just create the file object and send it to the uploads folder?


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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Krzysztof Socha | 3 May 17:22 2016
Picon

Flash messages not showing correctly

I have issues with showing "flash"-type messages recently. First I could not get them to show at all. I updated several files in my application based on the recent version of web2py (R-2.14.5), such as web2py.js, web2py-ajax.html, and the like.

Now it shows the flash message, but the formatting is all wrong. It just shows it on top of the page. Some digging revealed that the flash messages are put in a DIV with class="flash", while web2py.js is expecting class="w2p_flash". Anyone has an idea why it is like that and what to do to fix it?

Krzysztof.

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Antonio | 3 May 16:30 2016
Picon

How to add response headers to cache file?

Hello again, 
I'm not really sure that I fomulated correctly the question, so sorry for that.
I'm using web2py to get some data with which to create a dictionary that I'll later use on a mobile app. The thing is that it takes a while to get all the information (which will stay the same for long periods of time) so I decided to create an application cache on disk.

Before adding the cache everything worked fine. I just had to add 
    response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
    response.headers['Access-Control-Allow-Origin'] = "*"
    response["Access-Control-Allow-Methods"] = "POST, GET, OPTIONS"

The problem is that once I added the cache, the first time I load the app it worked fine, but the second and the following times I get this error:
XMLHttpRequest cannot load http://127.0.0.1:8000/Prueba/gfs/index.json?latitude=43.4879176&longitude=-3.80055544. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8200' is therefore not allowed access.


Is there a way to add headers to the response when getting the information from the cache files?
Thanks in advance.

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Gmane