[web2py] Re: error: 'No module named sanitizer' after upgrading to 2.16.1

2017-11-21 Thread Massimo Di Pierro
check that you have
web2py/gluon/sanitizer.py
maybe you accidentally deleted it or maybe the user does not have read 
permission.
Another option is that you app does a non thread safe os.chdir()


On Monday, 20 November 2017 15:46:07 UTC-6, Ton Sjerps wrote:
>
> After upgrading from 2.15.4 it gave the ticket below.
> Unfortunately putting it back to the previous or an even older version did 
> not solve the problem.
> Searching the web it seems to be related to python libs *html5lib *and 
> *bleach* 
> reinstalling or updating them with 'pip install -U bleach' does not seem 
> to help and neither does installing a previous version of the html5lib with 
> 'pip install html5lib==1.0b9'
>
> The problem exists while testing locally on my laptop as well as on the 
> server. 
> The server I could only get back up and running by restoring it to the 
> backup off last night.
> (restored to version 2.14.6-stable+timestamp.2016.05.10.00.21.47  
> Apache/2.4.18 (Ubuntu), Python 2.7.12) 
>
> Anybody any suggestions on what the problem is and how to tackle it?
>
> web2py™ Version 2.16.1-stable+timestamp.2017.11.14.05.54.25 
> Python Python 2.7.14: D:\Python27\python.exe (prefix: D:\Python27) 
> Traceback 
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
>
>
>
> Traceback (most recent call last):
>   File "F:\5-PCPROG\web2py_src\web2py\gluon\restricted.py", line 219, in 
> restricted
> exec(ccode, environment)
>   File "F:/5-PCPROG/web2py_src/web2py/applications/apa/controllers/orders.py" 
> , line 3, 
> in 
> from sanitizer import sanitize
>   File "F:\5-PCPROG\web2py_src\web2py\gluon\custom_import.py", line 104, in 
> custom_importer
> raise ImportError(e1, import_tb)  # there an import error in the module
> ImportError: (ImportError('No module named sanitizer',),  0x04E69748>)
>
>

-- 
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: Janrain recently broken (and how to fix)

2017-11-21 Thread Massimo Di Pierro
thanks Anthony

On Wednesday, 15 November 2017 14:00:12 UTC-6, Anthony wrote:
>
> If anyone is using web2py's Janrain integration, it looks like Janrain 
> recently made a change that breaks the web2py code. I submitted a pull 
> request to fix it, but in the meantime, a temporary workaround is to add 
> the following in the user() function (before the call to auth()):
>
> if request.post_vars.token:
> del request.get_vars.token
>
> The problem is that Janrain is now passing the token to the web2py URL via 
> both a POST variable and the query string. One of those two must be deleted 
> before calling auth() for the current web2py code to work.
>
> 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.


Re: [web2py] Re: how to create pdf report in web2py???

2017-11-21 Thread Ramos
Does someone have a web2py working example with reportbro???

Thank you

On Friday, 8 September 2017 18:39:31 UTC+1, Alex wrote:
>
> We created a user group at 
> https://groups.google.com/forum/#!forum/reportbro
> Don't hesitate to post in case you have any questions.
>
> I added the custom save example from above to our demos:
>
> https://github.com/jobsta/reportbro-designer/blob/master/demos/custom_save.html
>
> On Friday, September 1, 2017 at 12:08:53 AM UTC+2, Massimo Di Pierro wrote:
>>
>> Nice!
>>
>> On Saturday, 26 August 2017 08:19:30 UTC-5, Alex wrote:
>>>
>>> We created a report tool since creating pdf reports in a web application 
>>> is a common problem and none of the existing solutions were optimal for us. 
>>> We needed something that is easy to integrate, easy to use (to design the 
>>> reports) and easy to maintain (e.g. to create new versions of an existing 
>>> report template).
>>>
>>> https://www.reportbro.com
>>>
>>> The designer to create report templates is a javascript plugin which can 
>>> easily be integrated in a web application. Server-side we developed a 
>>> python package - which you can either download or install via pip - to 
>>> create the pdf (or xlsx) file with a given report template and data. 
>>> Because it's python it is easy to use in an existing web2py app.
>>>
>>> We appreciate any kind of feedback!
>>>
>>> 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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: restful service + auth on same application/ different controllers = gives Not authorized message

2017-11-21 Thread Dave S


On Tuesday, November 21, 2017 at 4:38:12 AM UTC-8, Anthony wrote:
>
>
>>> #requests.packages.urllib3.disable_warnings()  # - uncomment if you use 
>>> a self-signed cert over https 
>>> r = session.get(url_login, verify=True) #set verify=False if you use a 
>>> self-signed 
>>> cert over https
>>>
>>>
>> I'm not sure about this.  As is, it produces a ticket for "get() takes no 
>> keyword arguments".  Taking out the verify, I get a result of 'None'.  That 
>> doesn't seem to be useful to me.
>>
>
> In the above code, session is an instance of the requests.Session class, 
> and its .get() method does indeed take keyword arguments, as shown here: 
> http://docs.python-requests.org/en/v1.0.4/user/advanced/#session-objects. 
> The keyword arguments are actually passed to the requests object itself -- 
> the "verify" keyword is documented here: 
> http://docs.python-requests.org/en/master/user/advanced/#ssl-cert-verification
> .
>
> Anthony
>


More proof that there's always more to learn.

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.


[web2py] Re: restful service + auth on same application/ different controllers = gives Not authorized message

2017-11-21 Thread Dave S

On Tuesday, November 21, 2017 at 5:10:28 AM UTC-8, Leandro Sebastian 
Salgueiro wrote:
 

> it seems now that my "quick" workaround was not that simple (unless there 
> is a magical solution somewhere) and is easier to direclty implement JWT on 
> all my microservices and frontend.
>
>>
>>>
Web2py does JWT fairly easily (for the experiments I've done so far), if it 
helps you do an alternative quick workaround.

/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: restful service + auth on same application/ different controllers = gives Not authorized message

2017-11-21 Thread Leandro Sebastian Salgueiro
Thanks Anthony, All,

I know that what I'm trying to do here is kind of twisted ..

I have a quite complex structure of microservices on backend that needs to 
be accessed by Frontend. my final idea (at the end of the project) is to 
use JWT on every microservice but in the meanwhile (as i need a basic 
protection for beta testers) i was hoping to have a second controller 
working as a proxy and let web2py to handle auth.

in an ideal world :-) i was thinking that API will share auth with default 
controller, as it is part of the same app,  so if user is logged in it can 
use the API to make calls to the other endpoints... (in this way only 
web2py is exposed and i keep the other microservices protected inside the 
LAN). 
By the way when i try each controller from browser it works ok... the 
problem is the communication between controllers.. but after all these 
explanations i have a much better view of what is going on..

it seems now that my "quick" workaround was not that simple (unless there 
is a magical solution somewhere) and is easier to direclty implement JWT on 
all my microservices and frontend.

thanks a lot for all these comments...

BR

Leandro



Le mardi 21 novembre 2017 13:47:40 UTC+1, Anthony a écrit :
>
> What are you really trying to do? Is the API simply being called from the 
> browser, or are other types of clients calling it? If that latter, you 
> might look into using JWT auth, as session based authentication doesn't 
> work well for non-browser clients unless you get them to maintain a session 
> by passing the session cookie back and forth. If the only client is the 
> browser, just have it make Ajax calls directly to the API endpoints -- no 
> reason to pass requests through an endpoint in another controller.
>
> Anthony
>
> On Monday, November 13, 2017 at 9:14:00 AM UTC-5, Leandro Sebastian 
> Salgueiro wrote:
>>
>> HI,
>>
>> I have two controllers on the same app:
>>
>> TestApp
>> |
>> |---default.py
>> |---api.py
>>
>> api is a restful service that will call other services. For security 
>> reasons I would like that all call to these services are passed by the api 
>> restful. (it will work like a proxy in this case)
>>
>> I did try the following :
>>
>> in default.py :
>>
>> @auth.requires_login()
>> def index():
>> import requests
>> json = requests.get(URL('api', 'apps', host=True))
>> return {"json": json.content}
>>
>>
>> in api.py:
>>
>> import requests
>> apps_url = 'http://localhost:8091/apps'
>>
>>
>> @auth.requires_login()
>>
>> @request.restful()
>> def apps():
>> response.view = 'generic.json'
>> def GET(*args,**vars):
>> r = requests.get(apps_url)
>> return r
>> return dict(GET=GET)
>>
>>
>> If i test this without the api's login decorator everything works fine. 
>> However I can access this restful from anywhere else... 
>> I added then the requires_login to api controller and then i test both 
>> URLs independently from browser, it works ok (login to web2py ->  go to 
>> /api/apps -> get my results) however if I do the GET request using 
>> requests.get from default controller i get a* Non Authorized *message 
>> and redirect to login form.
>>
>> what i'm missing here? i thought that if I was in the same app, auth 
>> session would be shared among different controllers... 
>>
>> any hint on this would be the most welcomed..
>> Thanks in advanced.
>> Leandro
>>
>>
>>
>>

-- 
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: restful service + auth on same application/ different controllers = gives Not authorized message

2017-11-21 Thread Anthony
What are you really trying to do? Is the API simply being called from the 
browser, or are other types of clients calling it? If that latter, you 
might look into using JWT auth, as session based authentication doesn't 
work well for non-browser clients unless you get them to maintain a session 
by passing the session cookie back and forth. If the only client is the 
browser, just have it make Ajax calls directly to the API endpoints -- no 
reason to pass requests through an endpoint in another controller.

Anthony

On Monday, November 13, 2017 at 9:14:00 AM UTC-5, Leandro Sebastian 
Salgueiro wrote:
>
> HI,
>
> I have two controllers on the same app:
>
> TestApp
> |
> |---default.py
> |---api.py
>
> api is a restful service that will call other services. For security 
> reasons I would like that all call to these services are passed by the api 
> restful. (it will work like a proxy in this case)
>
> I did try the following :
>
> in default.py :
>
> @auth.requires_login()
> def index():
> import requests
> json = requests.get(URL('api', 'apps', host=True))
> return {"json": json.content}
>
>
> in api.py:
>
> import requests
> apps_url = 'http://localhost:8091/apps'
>
>
> @auth.requires_login()
>
> @request.restful()
> def apps():
> response.view = 'generic.json'
> def GET(*args,**vars):
> r = requests.get(apps_url)
> return r
> return dict(GET=GET)
>
>
> If i test this without the api's login decorator everything works fine. 
> However I can access this restful from anywhere else... 
> I added then the requires_login to api controller and then i test both 
> URLs independently from browser, it works ok (login to web2py ->  go to 
> /api/apps -> get my results) however if I do the GET request using 
> requests.get from default controller i get a* Non Authorized *message and 
> redirect to login form.
>
> what i'm missing here? i thought that if I was in the same app, auth 
> session would be shared among different controllers... 
>
> any hint on this would be the most welcomed..
> Thanks in advanced.
> Leandro
>
>
>
>

-- 
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: restful service + auth on same application/ different controllers = gives Not authorized message

2017-11-21 Thread Anthony

>
>
>> #requests.packages.urllib3.disable_warnings()  # - uncomment if you use 
>> a self-signed cert over https 
>> r = session.get(url_login, verify=True) #set verify=False if you use a 
>> self-signed 
>> cert over https
>>
>>
> I'm not sure about this.  As is, it produces a ticket for "get() takes no 
> keyword arguments".  Taking out the verify, I get a result of 'None'.  That 
> doesn't seem to be useful to me.
>

In the above code, session is an instance of the requests.Session class, 
and it's .get() method does indeed take keyword arguments, as shown 
here: http://docs.python-requests.org/en/v1.0.4/user/advanced/#session-objects. 
The keyword arguments are actually passed to the requests object itself -- 
the "verify" keyword is documented 
here: 
http://docs.python-requests.org/en/master/user/advanced/#ssl-cert-verification.

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] Re: threading Lock

2017-11-21 Thread Pierre
well, i am not very religious but i think i'll have to pray anyway or throw 
everything to the 'fire' as a disaster prevention 
policy.just kidding
let's be optimistic and believe in something..i like matplotlib but i 
prefer visual python: it is capable to display content on a website too

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