Re: [web2py] py4web jwt ?

2021-02-26 Thread Richard Vézina
Thanks

On Fri, Feb 26, 2021 at 1:43 PM Kevin Keller  wrote:

> Look for the email thread with the following title in the py4web google
> group and you ll find a way:
>
> Sample Code simple JWT Auth for pydal API
>
>
> in the
>
>
> [image: cloudHQ] <https://www.free-email-tracker.com> Powered by
> cloudHQ <https://www.free-email-tracker.com>
>
> Am Fr., 26. Feb. 2021 um 19:39 Uhr schrieb Richard Vézina <
> ml.richard.vez...@gmail.com>:
>
>> UP!
>>
>> Is py4web has jwt token mechanism??
>>
>> Evaluating py4web currently (yes getting back to good stuff loved web2py
>> and pydal)...
>>
>> I would need py4web to support jwt (https://jwt.io/). I recall that been
>> implement in web2py
>>
>> Not found anything in the doc about it :
>> https://py4web.com/_documentation/static/en/chapter-11.html
>>
>> Thanks
>>
>> Richard
>>
>> On Thu, Feb 20, 2020 at 2:19 PM Val K  wrote:
>>
>>> As I know py2web already stores _session_token as jwt, no?
>>>
>>> On Thursday, February 20, 2020 at 10:00:00 PM UTC+3, Kevin Keller wrote:
>>>>
>>>> With a Spa the routing is done in Javascript in the Browser.
>>>>
>>>> So Javascript or Vue / React etc need. To check if the user has a
>>>> access or id_token and if not redirect to the login page to obtain it.
>>>>
>>>> Doing crud and be able to secure those crud rest routes will be
>>>> critical for productivity.
>>>>
>>>> So we need a simple jwt token minting engine that at least can spit out
>>>> a access token for prototyping and and easy way to switch over to other IAM
>>>> solutions with py4web for production that can do the token minting.
>>>>
>>>> That is something I am currently working on the whole oidc auth part
>>>> make it easy and I also want to make it available for web2py.
>>>>
>>>> I have updated and got the oauth2 login provider working with Okta
>>>> yesterday and web2py.
>>>>
>>>> Will share this. Code asap and sent a push to git to have that provider
>>>> updated and at some providers for different IAM solutions for both web2py
>>>> and py4web going forward.
>>>>
>>>> Will try to share an example with py4web asap once I have something
>>>> working.
>>>>
>>>> Will probaly be on the. Weekend.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Thu, 20 Feb 2020, 10:42 Val K,  wrote:
>>>>
>>>>> check request.content_type - is that 'application/json' ?
>>>>>
>>>>> On Thursday, February 20, 2020 at 9:28:43 PM UTC+3, Ramos wrote:
>>>>>>
>>>>>> getting this from py4web as an api.
>>>>>> [image: image.png]
>>>>>> Is not what i would like to see from a SPA standpoint.
>>>>>>
>>>>>> Regards
>>>>>> António
>>>>>>
>>>>>>
>>>>>> Em qui., 20 de fev. de 2020 às 18:03, Val K 
>>>>>> escreveu:
>>>>>>
>>>>>>> It seems it depends on request.content_type
>>>>>>>
>>>>>>> https://github.com/web2py/py4web/blob/e6b3d5e10e15976af153c4a4e6b349a02fe6c2a9/py4web/utils/auth.py#L35
>>>>>>>
>>>>>>> --
>>>>>>> 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 web...@googlegroups.com.
>>>>>>> To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/msgid/web2py/9608a9ab-d338-4580-9d02-31b9b9a30782%40googlegroups.com
>>>>>>> .
>>>>>>>
>>>>>> --
>>>>> Resources:
>>>>> - http://web2py.com
>>>>> - http://web2py.com/book (Documentation)
>>>>> - http://git

Re: [web2py] py4web jwt ?

2021-02-26 Thread Richard Vézina
UP!

Is py4web has jwt token mechanism??

Evaluating py4web currently (yes getting back to good stuff loved web2py
and pydal)...

I would need py4web to support jwt (https://jwt.io/). I recall that been
implement in web2py

Not found anything in the doc about it :
https://py4web.com/_documentation/static/en/chapter-11.html

Thanks

Richard

On Thu, Feb 20, 2020 at 2:19 PM Val K  wrote:

> As I know py2web already stores _session_token as jwt, no?
>
> On Thursday, February 20, 2020 at 10:00:00 PM UTC+3, Kevin Keller wrote:
>>
>> With a Spa the routing is done in Javascript in the Browser.
>>
>> So Javascript or Vue / React etc need. To check if the user has a access
>> or id_token and if not redirect to the login page to obtain it.
>>
>> Doing crud and be able to secure those crud rest routes will be critical
>> for productivity.
>>
>> So we need a simple jwt token minting engine that at least can spit out a
>> access token for prototyping and and easy way to switch over to other IAM
>> solutions with py4web for production that can do the token minting.
>>
>> That is something I am currently working on the whole oidc auth part make
>> it easy and I also want to make it available for web2py.
>>
>> I have updated and got the oauth2 login provider working with Okta
>> yesterday and web2py.
>>
>> Will share this. Code asap and sent a push to git to have that provider
>> updated and at some providers for different IAM solutions for both web2py
>> and py4web going forward.
>>
>> Will try to share an example with py4web asap once I have something
>> working.
>>
>> Will probaly be on the. Weekend.
>>
>>
>>
>>
>>
>>
>> On Thu, 20 Feb 2020, 10:42 Val K,  wrote:
>>
>>> check request.content_type - is that 'application/json' ?
>>>
>>> On Thursday, February 20, 2020 at 9:28:43 PM UTC+3, Ramos wrote:

 getting this from py4web as an api.
 [image: image.png]
 Is not what i would like to see from a SPA standpoint.

 Regards
 António


 Em qui., 20 de fev. de 2020 às 18:03, Val K 
 escreveu:

> It seems it depends on request.content_type
>
> https://github.com/web2py/py4web/blob/e6b3d5e10e15976af153c4a4e6b349a02fe6c2a9/py4web/utils/auth.py#L35
>
> --
> 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 web...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/9608a9ab-d338-4580-9d02-31b9b9a30782%40googlegroups.com
> .
>
 --
>>> 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 web...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/77ac539d-a83e-4931-ae79-424c3a4711fd%40googlegroups.com
>>> 
>>> .
>>>
>> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/1e3387f6-bf14-406f-9c6b-306a06630961%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAKk5xSzm%3DeCCd24Z0ZXF%3DtikA5Z_GXUet1SDGeEMPGVH%3DdRt1A%40mail.gmail.com.


Re: [web2py] web2py 2.19.1 is OUT

2020-03-25 Thread Richard Vézina
KEEP GOING!! WEB2PY!!

:D

On Wed, Mar 25, 2020 at 4:42 AM Nico Zanferrari  wrote:

> Hi Jim,
>
> you should use the latest available Python version and the web2py sources
> (and possibly a full web server) for Production and complex / unusual
> development.
> But using the binaries is much simpler and quicker if you're just learning
> web2py or testing your existing code with different python versions. For a
> newbie, even properly installing Python could be a nightmare! Also, in this
> way you're sure you don't risk any damage on your system and you can do it
> even if you're not an administrator.
>
> Nico
>
> Il giorno mer 25 mar 2020 alle ore 03:36 Massimo Di Pierro <
> massimo.dipie...@gmail.com> ha scritto:
>
>> So far yes.
>> Nico has been working on new binaries and a new system for packing them.
>> The plan is to ship both 2.7 and 3.7.
>>
>> On Tuesday, 24 March 2020 18:49:06 UTC-7, jim kaubisch wrote:
>>>
>>> Hi Nico,
>>>
>>> Just want to make sure I understand.
>>>
>>> You say 'web2py 2.19.1 binaries come "with embedded Python 2.7.16 or
>>> 3.7.4" ' ??
>>> My reading is that one MUST get web2py source in order to use other
>>> versions of Python? Am I understanding correctly?
>>>
>>> We are on macOS Catalina, python 3.7.6 and, given that python 3.8.2
>>> claims better integration with Catalina and python.org saying "We plan to
>>> continue to provide bugfix releases for 3.7.x until mid 2020...", going
>>> back to 3.7.4 doesn't appeal.
>>>
>>> Thanks
>>> Jim
>>>
>>>
>>> On Sunday, March 22, 2020 at 4:01:40 PM UTC-7, Nico Zanferrari wrote:

 Hello,

 the 2.19.1 web2py binaries are ready to be tested & used, with embedded
 Python 2.7.16 or 3.7.4. Grab them from my repository
  .
 It has taken me a lot of time for updating to the latest PyInstaller
 3.6 and find a new missing import ;-)

 @Massimo: please update the Legacy and Normal binaries on
 http://www.web2py.com/init/default/download accordingly.

 Cheers,
 Nico


 Il giorno dom 22 mar 2020 alle ore 03:50 Lovedie JC 
 ha scritto:

> I've updated it.
> Flawless
> 
> Good work. Much appreciated.
> Regards
>
> On Sun, Mar 22, 2020, 04:28 Christian Varas 
> wrote:
>
>> Thanks! 
>>
>> El El sáb, 21 de mar. de 2020 a la(s) 18:52, Massimo Di Pierro <
>> massimo...@gmail.com> escribió:
>>
>>> Sorry it took so long.
>>>
>>> Web2py 2.19.1 is finally out.
>>>
>>> It contains many small bug fixes including better support for python
>>> 3.6, 3.7, and 3.8
>>>
>>> https://travis-ci.org/github/web2py/web2py
>>>
>>> --
>>> 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 web...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/c432d75b-bfdc-414c-b110-f6e7bfc0265d%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> 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 web...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/web2py/CA%2Bs%2BuJsMSc4GhYHR9VpsJycKAdCzSr8vQK30WwBPmJOLQg2BLA%40mail.gmail.com
>> 
>> .
>>
> --
> 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 web...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/CAAcHJF8dZTRrYnLmfVwmq_gZe6Gz3w%2BiqXRxT1h2qdE7X_6Dgg%40mail.gmail.com
> 

Re: [web2py] Re: any travis expert can help debug failures?

2019-09-05 Thread Richard Vézina
Sorry, I would help more, but I have not much time... I am not using web2py
full time anymore... I am happy to see you pursue with py4web... I am eager
to find time to try it... Seems really fast!

:)

Richard

On Mon, Aug 19, 2019 at 3:57 PM Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Yes
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/caeaa6d0-c8e1-49ec-bd37-59ac54635e80%40googlegroups.com
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAKk5xSz5u_bJDkq1CxSuttS03vfHOwTy6ZyExehgQqzL56_hkA%40mail.gmail.com.


Re: [web2py] Re: any travis expert can help debug failures?

2019-08-19 Thread Richard Vézina
Did you fix it?

On Sun, Aug 18, 2019 at 2:40 AM Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> I think I fixed. Travis updated the docker image and broke some stuff.
>
> On Saturday, 17 August 2019 22:13:57 UTC-7, Massimo Di Pierro wrote:
>>
>> Any idea why web2py on travisci is failing to connect to sql databases?
>>
>> https://travis-ci.org/web2py/pydal/builds
>>
>>
>> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/b83cb6ec-e64d-4af5-aaa8-4d88a39461a5%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAKk5xSzRkfsdSttG42bj6dp2oj3L%3DChxtPo8ZC%2Bze0J50-Evdw%40mail.gmail.com.


Re: [web2py] install script for web2py using python 3

2019-02-06 Thread Richard Vézina
That what I thought... It easy to messup with pip pip3 or python python3
also with virtualenv it even trickier because the pipenv use the python and
pip for the actual version installed... So you might end pass from pip3 in
the os and pip in the pipenv and you still use py3 in both...

On Wed, Feb 6, 2019 at 10:12 AM Ben Lawrence  wrote:

> Hi, it works now... I missed a pip3... works on a newly spun ubuntu 18.04
> instance on vultr.com
>
>
>
> #!/bin/bash
>
> echo 'setup-web2py-nginx-uwsgi-ubuntu-precise.sh'
>
> echo 'Requires Ubuntu > 12.04 or Debian >= 8 and installs Nginx + uWSGI +
> Web2py'
>
> # Check if user has root privileges
>
> if [[ $EUID -ne 0 ]]; then
>
>echo "You must run the script as root or using sudo"
>
>exit 1
>
> fi
>
> # parse command line arguments
>
> nopassword=0
>
> nocertificate=0
>
> while [ "$#" -gt 0 ]; do
>
>   case "$1" in
>
> --no-password) nopassword=1; shift 1;;
>
> --no-certificate) nocertificate=1; shift 1;;
>
>   esac
>
> done
>
> # Get Web2py Admin Password
>
> if [ "$nopassword" -eq 0 ]
>
> then
>
>   echo -e "Web2py Admin Password: \c "
>
>   read -s PW
>
>   printf "\n"  # fix no new line artifact of "read -s" to avoid cleartext
> password
>
> fi
>
> # Upgrade and install needed software
>
> apt-get update
>
> apt-get -y upgrade
>
> apt-get autoremove
>
> apt-get autoclean
>
> apt-get -y install nginx-full
>
> apt-get -y install build-essential python3-dev libxml2-dev python3-pip
> unzip
>
> pip3 install setuptools --no-use-wheel --upgrade
>
> PIPPATH=`which pip3`
>
> $PIPPATH install --upgrade uwsgi
>
> # Create common nginx sections
>
> mkdir /etc/nginx/conf.d/web2py
>
> echo '
>
> gzip_static on;
>
> gzip_http_version   1.1;
>
> gzip_proxiedexpired no-cache no-store private auth;
>
> gzip_disable"MSIE [1-6]\.";
>
> gzip_vary   on;
>
> ' > /etc/nginx/conf.d/web2py/gzip_static.conf
>
> echo '
>
> gzip on;
>
> gzip_disable "msie6";
>
> gzip_vary on;
>
> gzip_proxied any;
>
> gzip_comp_level 6;
>
> gzip_buffers 16 8k;
>
> gzip_http_version 1.1;
>
> gzip_types text/plain text/css application/json application/x-javascript
> text/xml application/xml application/xml+rss text/javascript;
>
> ' > /etc/nginx/conf.d/web2py/gzip.conf
>
> # Create configuration file /etc/nginx/sites-available/web2py
>
> echo 'server {
>
> listen  80;
>
> server_name $hostname;
>
> ###to enable correct use of response.static_version
>
> location ~* ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ {
>
> alias /home/www-data/web2py/applications/$1/static/$2;
>
> expires max;
>
> ### if you want to use pre-gzipped static files (recommended)
>
> ### check scripts/zip_static_files.py and remove the comments
>
> # include /etc/nginx/conf.d/web2py/gzip_static.conf;
>
> }
>
> ###
>
>
> ###if you use something like myapp = dict(languages=['en', 'it',
> 'jp'], default_language='en') in your routes.py
>
> #location ~* ^/(\w+)/(en|it|jp)/static/(.*)$ {
>
> #alias /home/www-data/web2py/applications/$1/;
>
> #try_files static/$2/$3 static/$3 =404;
>
> #}
>
> ###
>
>
>
> location / {
>
> #uwsgi_pass  127.0.0.1:9001;
>
> uwsgi_pass  unix:///tmp/web2py.socket;
>
> include uwsgi_params;
>
> uwsgi_param UWSGI_SCHEME $scheme;
>
> uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
>
>
> ###remove the comments to turn on if you want gzip compression
> of your pages
>
> # include /etc/nginx/conf.d/web2py/gzip.conf;
>
> ### end gzip section
>
>
> ### remove the comments if you use uploads (max 10 MB)
>
> #client_max_body_size 10m;
>
> ###
>
> }
>
> }
>
> server {
>
> listen 443 default_server ssl;
>
> server_name $hostname;
>
> ssl_certificate /etc/nginx/ssl/web2py.crt;
>
> ssl_certificate_key /etc/nginx/ssl/web2py.key;
>
> ssl_prefer_server_ciphers on;
>
> ssl_session_cache shared:SSL:10m;
>
> ssl_session_timeout 10m;
>
> ssl_ciphers
> ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA;
>
> ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
>
> keepalive_timeout70;
>
> location / {
>
> #uwsgi_pass  127.0.0.1:9001;
>
> uwsgi_pass  unix:///tmp/web2py.socket;
>
> include uwsgi_params;
>
> uwsgi_param UWSGI_SCHEME $scheme;
>
> uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
>
> ###remove the comments to turn on if you want gzip compression
> of your pages
>
> # include /etc/nginx/conf.d/web2py/gzip.conf;
>
> ### end gzip section
>
> ### remove the comments if you 

Re: [web2py] install script for web2py using python 3

2019-02-05 Thread Richard Vézina
Share you change here, we may point you in the right direction, so you can
submit a PR on github... It shouldn't be hard to get the actual script to
work.

Richard

On Tue, Feb 5, 2019 at 2:28 PM Ben Lawrence  wrote:

> HI
> If anyone has a working install script for web2py using python3 + a
> webserver, can you please share with me?
> I am using setup-web2py-nginx-uwsgi-ubuntu.sh and modified it to use
> python3 but the emporer uwsgi service always fails (with no error code).
> thank you in advance.
> Ben
>
> --
> 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: Slightly on-topic -- CMSs

2019-01-16 Thread Richard Vézina
My thoughs about CMS (they all sucks).

They are maintains by the one who put them in place (prog side and content
side), so you gonna find challenge in bringing someone to maintain the
content in it out of IT and in IT you will find it difficult to find
someone who wants maintain the content... So their only purpose is not
having to recall the CSS to apply to each piece of the content to not break
the visual of the much simple traditional web site that you could create to
handle the limited content that will ever be publish in the CMS...

I might be a bit rough about CMS here, but I had been a big believer back
in the 2000's (2002-3 and the couples of years after that until I stumble
on RoR and discover frameworks paradigm)...

Frameworks make just more sens as you can craft only what you need and
extend them as much as you need...

Now I am not saying to remplace CMS by custom app is always a good idea, as
it is a waste of time recreate WordPress, Drupal et al.

But I am advocate that you evaluate the need for a CMS carefull and write
down the client real requirements and what the expect, if they expect you
to handle the design and content and the site they expect is pretty
simple... CMS is a bad idea... As they are difficult to design to look
different than the competition... If the needs are so specific that you
will end customizing with a bunch of plugin a Word Press installation and
make it a nightmare to maintain over time, I say, your client need you
service as an app developer and frameworks are you best bet...

About Python CMS, I recall the venerable Plone to be one of the only back
in time, still is I guess... On Django side you can get many CMS Django
applications I would look there for modern CMS... But again, most risk of
not be exactly what you want and require a lot of customization...

Good luck




On Wed, Jan 16, 2019 at 7:59 PM Dave S  wrote:

>
>
> On Thursday, January 10, 2019 at 11:13:56 PM UTC-8, Dave S wrote:
>>
>>
>>
>> On Tuesday, January 8, 2019 at 8:14:27 PM UTC-8, Dave S wrote:
>>>
>>> I'd like to ask a couple questions of those of you running a Content
>>> Management System in conjunction with web2py applications.
>>>
>>> 1.  What do you consider important in a CMS?
>>> 2.  Who's in charge? (no, not names, what roles in the organization
>>> handle the CMS and what roles the application?)
>>> 3.  How do you handle changes on one side so that the other side keeps
>>> up?
>>> 4.  How happy are you with your CMS?
>>> 5.  What do you wish was different?
>>> 6.  Does the application think the CMS is just a special purpose
>>> database, or does the CMS affect the application logic?
>>>
>>> I think that's enough to get me started with building a picture.  I
>>> appreciate your thoughts and assistance.
>>>
>>>
>> I'm particularly interested in comments about the Wordpress CMS.
>>
>> /dps
>>
>>
>
> The downside of Wordpress (and Joobal and Drupal, the other members of
> what seems to be the Big 3 per WikiP) is PHP.  Any good pointers to a
> Python implementation?
>
> And for completeness, is SharePoint considered a CMS?
>
> /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.
>

-- 
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: Bug in tools.py

2018-12-14 Thread Richard Vézina
Note that import string if it would be necessary would have to be deal with
in _compat module where web2py sort out compatibility issue between python2
and 3 : https://github.com/web2py/web2py/blob/master/gluon/_compat.py

I am pretty sure the .strip() problem you describe would had be sorted
since quite sometime...



On Wed, Dec 12, 2018 at 2:42 PM Ben Duncan  wrote:

> Ok, got it fixed. WAS too busy studying the forest of code to notice
> my mistake .
> The "or not" threw me
>
> Thanks ...
>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Wed, Dec 12, 2018 at 1:08 PM Marcelo Huerta 
> wrote:
>
>> Please open your nearest Python interpreter and type at the ">>> " prompt:
>>
>> help("".strip)
>>
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] lgoin_bare WTF???

2018-12-14 Thread Richard Vézina
I would suggest you to use the new way of customizing auth tables :

"""

The simplest way is to add extra fields:

## after auth = Auth(db)
auth.settings.extra_fields['auth_user']= [
  Field('address'),
  Field('city'),
  Field('zip'),
  Field('phone')]
## before auth.define_tables(username=True)

"""
http://web2py.com/books/default/chapter/29/09/access-control#Customizing-Auth


On Thu, Dec 13, 2018 at 4:19 PM Ben Duncan  wrote:

> Ok, I THINK the error is due to our custome tables
> ie: Group is defined as :
>
> db.define_table('auth_group',
> Field('group_id', type='integer'),
> Field('role', type='string', length=50),
> Field('description', type='string', length=256),
> Field('company_number', type='integer', default=0),
> Field('created_on', type='datetime'),
> Field('created_by', type='string', length=50),
> Field('modified_on', type='datetime'),
> Field('modified_by', type='string', length=50),
> Field('notes', type='text'),
> primarykey=['group_id'],
> migrate=False)
>
> SO (Correct me if I am wrong) it's trying to use the "self.user.id" which
> is not defined, since these are cutome tables.
>
> If so, how to I go about correcting this ?
>
> As always, thanks ...
>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Thu, Dec 13, 2018 at 3:06 PM Ben Duncan  wrote:
>
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>> Argg ... spoke to soon :
>>
>> Errors :
>>
>> web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
>> Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
>> Traceback
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>> 17.
>> 18.
>>
>> Traceback (most recent call last):
>>   File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
>> exec(ccode, environment)
>>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
>> , line 
>> 205, in 
>>   File "/data/web2py/web2py/gluon/globals.py", line 421, in 
>> self._caller = lambda f: f()
>>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
>> , line 
>> 25, in user_bare
>> user = auth.login_bare(username, cryptpassword)
>>   File "/data/web2py/web2py/gluon/tools.py", line 2283, in login_bare
>> self.login_user(user)
>>   File "/data/web2py/web2py/gluon/authapi.py", line 739, in login_user
>> self.update_groups()
>>   File "/data/web2py/web2py/gluon/authapi.py", line 503, in update_groups
>> table_membership.user_id == self.user.id).select()
>>   File 
>> "/opt/rh/python27/root/usr/lib/python2.7/site-packages/pyDAL-17.11-py2.7.egg/pydal/objects.py",
>>  line 109, in __getattr__
>> raise AttributeError
>> AttributeError
>>
>> Error snapshot [image: help]
>> 
>>
>> ()
>>
>> inspect attributes
>> Frames
>>
>>-
>>
>>*File /data/web2py/web2py/gluon/restricted.py in restricted at line
>>219* code arguments variables
>>-
>>
>>*File /data/web2py/web2py/applications/Mec/controllers/default.py in
>> at line 205* code arguments variables
>>-
>>
>>*File /data/web2py/web2py/gluon/globals.py in  at line 421*
>>code arguments variables
>>-
>>
>>*File /data/web2py/web2py/applications/Mec/controllers/default.py in
>>user_bare at line 25* code arguments variables
>>-
>>
>>*File /data/web2py/web2py/gluon/tools.py in login_bare at line 2283*
>>code arguments variables
>>-
>>
>>*File /data/web2py/web2py/gluon/authapi.py in login_user at line 739*
>>code arguments variables
>>-
>>
>>*File /data/web2py/web2py/gluon/authapi.py in update_groups at line
>>503* code arguments variables
>>-
>>
>>*File
>>
>> /opt/rh/python27/root/usr/lib/python2.7/site-packages/pyDAL-17.11-py2.7.egg/pydal/objects.py
>>in __getattr__ at line 109* code arguments variables
>>Function argument list
>>
>>(self=>None, 'address_3': None, 'notes': None}>, k='id')
>>Code listing
>>
>>104.
>>105.
>>106.
>>107.
>>108.
>>109.
>>110.
>>111.
>>112.
>>113.
>>
>>
>>def __getattr__(self, k):
>>try:
>>return self.__getitem__(k)
>>except KeyError:
>>raise AttributeError
>>
>>def __copy__(self):
>>return Row(self)
>>
>>Variables
>>builtinAttributeError 
>>
>> Context
>>
>> locals request session response
>> In file: /data/web2py/web2py/applications/Mec/controllers/default.py
>>
>> 1.
>>
>>  at 0x7f1259ef06b0, file 
>> 

Re: [web2py] Re: Future of web2py

2018-11-19 Thread Richard Vézina
You are right, I found some that there wierd things occuring some times as
the left side bar completly disappeared... My guess is that this is some
glitches that may be existing for some browser/OS??

I think from my standpoint that the issue is that the framework is Signle
app vue... I am not ready to create an app that would be only single
view... Although for the dashboard it make sens.

It definetly somethings I would study... Would I use it, I don't know, it
depends how easy it would be to pick it up and how relyable it been
designed to be.



On Fri, Nov 16, 2018 at 7:01 PM Antonio Salazar 
wrote:

> As a user, it looks nice but has horrible usability.
>
>- Simply moving the cursor to the wrong place can slide the whole
>dashboard several centimeters to the side.
>- Activating the right panel scrolls the left panel trigger as if
>going *beyond* the left border of the screen. You have to hide the right
>panel if you want to unhide the left.
>- In general, elements needlessly shifting from under your cursor
>using sluggish JavaScript animations.
>
> There's nice things here, sure, but please don't learn UX from this.
>
> On Thursday, November 15, 2018 at 3:44:59 PM UTC-6, 黄祥 wrote:
>>
>> perhaps can learn from this:
>> https://flatlogic.com/admin-dashboards/sing-app-vue-dashboard
>> https://github.com/flatlogic/sing-app-vue-dashboard
>>
>> best regards,
>> stifan
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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: Future of web2py

2018-11-15 Thread Richard Vézina
I wonder how the glue will be made for this to be consider a framework??

It all sound really interesting although as far as I understand we will
have to code in vues.js for most part... If SQLForm is gone I feel a lot of
the web2py simplicity to start with will be lost...

How this to be framework will reside related to the server side restful /
client side app paradigm ?

Thanks

Richard

On Mon, May 29, 2017 at 7:29 PM Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> My plan is this
>
> It is based on bottle + gevent + gunicorn + rethinkdb + pydal + vue.js +
> some code ported from web2py (templates, helpers, validators,
> internationalization, scheduler)
>
> Unlike web2py it uses modules not execfile and this makes it 10x faster
> (this part is done) and code it no longer interpreted at every request.
> Only on change.
>
> Routes are declared using decorators like in bottle and flask.
>
> It will use rethinkdb for storing errors, sessions, and anything user
> defined. This allows to scale horizontally. Nothing gets stored on the file
> system any more. Ever. Unless you choose to use sqlite for your app.
>
> No more forms and grids generated server side. Possible and will probably
> backport SQLFrom and Gid but will discourage it. The default client will be
> in vue.js. The forms and grids will be generated client-side based on
> self-documenting APIs. This work must be done. It is not terribly hard just
> pedantic.
>
> It has a redesigned admin. Not necessarily better but leaner. This part is
> also done although it may need restyling.
>
> I am ditching a lot of the web2py auth logic. Nobody really uses groups
> and permissions and the way it is done may not be the best way for
> everybody. Instead I will default to auth0 integration.
>
> From a developer prospective the code will look very similar and I will be
> able to recycle 90% of the documentation.
>
> The problems are that web2py grew a bit bloated and typical programming
> patterns have shifted from postbacks to single page apps with form
> submission via API. Also web2py does not provide enough tools for scaling
> since uses filesystem by default. The new version will do less then current
> web2py but will remedy those issues and make it easier to make responsive
> and scalable apps.
>
> I am conflicted. I could use help to get this done quicker but I do not
> want to post something that is half done people are unhappy with. What I
> would like may not be what everybody likes but I am mostly building this in
> a way that would work well for myself and share in the hope it is useful to
> others. BSD license.
>
> If you are willing to help before the code is made public feel free to
> contact me personally.
>
> Massimo
>
>
>
>
>
>
> On Sunday, 28 May 2017 11:47:49 UTC-5, Oasis Agano wrote:
>>
>>
>> Is the new framework web3py if so when is the official launch?
>> On Sunday, May 28, 2017 at 2:32:01 AM UTC+2, Relsi Maron wrote:
>>>
>>>
>>> Hi Andrea,
>>>
>>> Yes, there will be a future for web2py!
>>>
>>> Web2py will remain being what it is. :)
>>>
>>> A new version, with support for Python 3, is about to come. Even though
>>> Massimo is developing a new framework, Web2py will continue to exist - with
>>> the same purpose for which it was created: to teach development.
>>>
>>> Cheers.
>>>
>>>
>>> Em sábado, 27 de maio de 2017 04:11:02 UTC-3, Andrea Fae' escreveu:

 Hello guys,
 I'd like to know if there will be future of web2py? Any information
 about it?
 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.
>

-- 
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] db structure graphical analysis tool

2018-10-03 Thread Richard Vézina
Does the old appreciate pygraphviz still work out of the box??

I thought we would keep support for it??

Thanks

Richard

On Sat, Jul 8, 2017 at 9:27 AM Paolo Valleri 
wrote:

> Hi Jurgis,
> web2py master has recently switched from pygraphviz to a js based
> solution. I would suggest you to adapt your change with current master
> branch and then publish a PR for an integration.
>
> Paolo
>
> On Friday, July 7, 2017 at 3:35:35 PM UTC+2, Ramos wrote:
>>
>> +1 good job
>>
>> 2017-07-07 12:19 GMT+01:00 Jurgis Pralgauskis :
>>
>>> Hi,
>>>
>>> in our DB we have ~300 tables. So I hacked into graph_model to filter
>>>  shown tables/fields.
>>> It was very helpfull for me when I joined the project with so many
>>> tables.
>>> The most common use case -- searching for possible join-paths between
>>> two tables, but also can filter by (fragments of) tablenames.
>>>
>>> It shows SVG by default (less memory consumption than png),
>>> and tables are hyperlinked to their admin pages.
>>>
>>> Also made beta plugin
>>> 
>>>  (the
>>> code is quite dirty and  not optimal, but does the job : ).
>>> src: controller
>>> ,
>>> view
>>> 
>>>
>>> screenshot
>>> 
>>>
>>> Would be glad if someone finds it usefull :)
>>> ps.: what is the best way to distribute it? http://www.web2pyslices.com/
>>> seems to be frozen for 1 year..
>>>
>>> --
>>> 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] redis in 2.16.1

2018-06-29 Thread Richard Vézina
Is in your issue web2py the only moving part?? Nothing change on OS and
Redis side??

As it mention in the final trace back above there seems to need a password
to be setup in your redis connection string... Perhap you forgot that you
set one or there is a default one defined in you Linux box or in the new
version of Redis

Richard

On Tue, Jun 19, 2018 at 9:17 PM, 黄祥  wrote:

> it seems session with redis not work in 2.16.1
> *e.g. create web2py from scratch name redis*
> *models/db.py*
> from gluon.contrib.redis_utils import RConn
> from gluon.contrib.redis_cache import RedisCache
> from gluon.contrib.redis_session import RedisSession
> rconn = RConn('localhost', 6379)
> cache.redis = RedisCache(redis_conn = rconn, debug = True)
> sessiondb = RedisSession(redis_conn = rconn, session_expiry = False)
> session.connect(request, response, db = sessiondb)
>
> *result in browser http://localhost:8000/redis/default/index
> *
> Traceback (most recent call last):
>   File "/Users/sugizo/web2py/gluon/main.py", line 461, in wsgibase
> session._try_store_in_db(request, response)
>   File "/Users/sugizo/web2py/gluon/globals.py", line 1224, in
> _try_store_in_db
> record_id = table.insert(**dd)
>   File "/Users/sugizo/web2py/gluon/contrib/redis_session.py", line 137, in
> insert
> newid = str(self.db.r_server.incr(self.serial))
>   File "/Users/MacBookPro/miniconda3/envs/python2_prod/lib/python2.
> 7/site-packages/redis/client.py", line 1011, in incr
> return self.execute_command('INCRBY', name, amount)
>   File "/Users/MacBookPro/miniconda3/envs/python2_prod/lib/python2.
> 7/site-packages/redis/client.py", line 667, in execute_command
> connection.send_command(*args)
>   File "/Users/MacBookPro/miniconda3/envs/python2_prod/lib/python2.
> 7/site-packages/redis/connection.py", line 610, in send_command
> self.send_packed_command(self.pack_command(*args))
>   File "/Users/MacBookPro/miniconda3/envs/python2_prod/lib/python2.
> 7/site-packages/redis/connection.py", line 585, in send_packed_command
> self.connect()
>   File "/Users/MacBookPro/miniconda3/envs/python2_prod/lib/python2.
> 7/site-packages/redis/connection.py", line 493, in connect
> self.on_connect()
>   File "/Users/MacBookPro/miniconda3/envs/python2_prod/lib/python2.
> 7/site-packages/redis/connection.py", line 567, in on_connect
> if nativestr(self.read_response()) != 'OK':
>   File "/Users/MacBookPro/miniconda3/envs/python2_prod/lib/python2.
> 7/site-packages/redis/connection.py", line 629, in read_response
> raise response
> ResponseError: invalid DB index
>
> also, is it possible to use redis secured with password in web2py?
> *e.g.*
> *redis.conf*
> requirepass password
>
> *models/db.py*
> rconn = RConn('localhost', 6379, 'password')
> #sessiondb = RedisSession(redis_conn = rconn, session_expiry = False)
> #session.connect(request, response, db = sessiondb)
>
> *result in browser http://localhost:8000/redis/default/index
> *
> Traceback (most recent call last):
>   File "/Users/sugizo/web2py/gluon/main.py", line 461, in wsgibase
> session._try_store_in_db(request, response)
>   File "/Users/sugizo/web2py/gluon/globals.py", line 1224, in
> _try_store_in_db
> record_id = table.insert(**dd)
>   File "/Users/sugizo/web2py/gluon/contrib/redis_session.py", line 137, in
> insert
> newid = str(self.db.r_server.incr(self.serial))
>   File "/Users/MacBookPro/miniconda3/envs/python2_prod/lib/python2.
> 7/site-packages/redis/client.py", line 1011, in incr
> return self.execute_command('INCRBY', name, amount)
>   File "/Users/MacBookPro/miniconda3/envs/python2_prod/lib/python2.
> 7/site-packages/redis/client.py", line 667, in execute_command
> connection.send_command(*args)
>   File "/Users/MacBookPro/miniconda3/envs/python2_prod/lib/python2.
> 7/site-packages/redis/connection.py", line 610, in send_command
> self.send_packed_command(self.pack_command(*args))
>   File "/Users/MacBookPro/miniconda3/envs/python2_prod/lib/python2.
> 7/site-packages/redis/connection.py", line 585, in send_packed_command
> self.connect()
>   File "/Users/MacBookPro/miniconda3/envs/python2_prod/lib/python2.
> 7/site-packages/redis/connection.py", line 493, in connect
> self.on_connect()
>   File "/Users/MacBookPro/miniconda3/envs/python2_prod/lib/python2.
> 7/site-packages/redis/connection.py", line 567, in on_connect
> if nativestr(self.read_response()) != 'OK':
>   File "/Users/MacBookPro/miniconda3/envs/python2_prod/lib/python2.
> 7/site-packages/redis/connection.py", line 629, in read_response
> raise response
> ResponseError: NOAUTH Authentication required.
>
> any hints?
>
> thx and best regards,
> stifan
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You 

Re: [web2py] managing latin characters

2018-06-18 Thread Richard Vézina
It depends... If it coming from the form you have nothing to do... If you
add them in your code as hardcoded value you have to encode them properly,
you don't just do 'ton text en français' as it gonna fails...

You always better work in english in your code anyway as it makes not much
sens to work with other language and use the magic T() sometimes you will
sometimes you will not and that mean that your app will be automatically
translate if you do use T() but not if you hardcoded thing in other then
english language...

If you do use other software source of information that are coming with
various encoding (they better support UTF-8) you will have to use
variable_name.decode(utf-8) once when you get the stuff in and
variable_name.encode(utf-8) when you push stuff in this other softwares...
If you do such thing I recommand you to search for python and endocing and
read the doc...

Richard

On Mon, Jun 18, 2018 at 3:40 PM, Andrea Fae'  wrote:

> How to manage latin character, like italian character like è,é, à, ò
> If I want to insert for example à it "translate" to “/xe0153"
> How to wotk with this type of charater...Do I need to change from utf-8
> to? 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.
>

-- 
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] Last version supporting Python 2.6

2018-06-18 Thread Richard Vézina
And previous version was : 2.14.6

On Mon, Jun 18, 2018 at 11:27 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> Changelog file in web2py folder :
>
> *## 2.15.1-4*
> - pydal 17.08
> *- dropped support for python 2.6*
> - dropped web shell
> - experimental python 3 support
> - experimental authapi for service login
> - allow ajax file uploads
> - more tests
> - more pep8 compliance
> - d3.js model visulization
> - improved scheduler
> - is_email support for internationalized Domain Names
> - improved used of cookies with CookieJar
> - SQLFORM.grid(showblobs=True)
> - import JS events (added w2p.componentBegin event)
> - added support for CASv3
> - allow first_name and last_name placeholders in verify_email message
> - added three-quote support in markmin
> - updated pg8000 driver (but we still recommend psycopg2)
> - compiled views use . separator not _ separator (must recompile code)
> - better serbian, french, and catalan translations
> - speed improvements (refactor of compileapp and pyc caching)
> - removed web shell (never worked as intended)
> - allow Expose(..., follow_symlink_out=False).
> - Updated fpdf to latest version
> - JWT support
> - import fabfile for remote deployment
> - scheduler new feature: you can now specify intervals with cron
> - gluon/* removed from sys.path. Applications relying on statements like
> e.g.
>   "from storage import Storage"
>   will need to be rewritten with
>   "from gluon.storage import Storage"
> - tests can only be run with the usual web2py.py --run_system_tests OR with
>   python -m unittest -v gluon.tests on the root dir
> - jQuery 3.2.1
> - PyDAL 17.07 including:
>   allow jsonb support for postgres
>   correctly configure adapters that need connection for configuration
>   better caching
>   updated IMAP adapter methods to new API
>   experimental suport for joinable subselects
>   improved Teradata support
>   improved mongodb support
>   overall refactoring
>   experimental support for Google Cloud SQL v2
>   new pymysql driver
>
> On Mon, Jun 18, 2018 at 10:48 AM, Carlos Cesar Caballero Díaz <
> carlos.caball...@cfg.jovenclub.cu> wrote:
>
>> Hi guys, what was the last web2py version supporting Python 2.6?
>>
>> Greetings.
>>
>>
>> --
>> 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] Last version supporting Python 2.6

2018-06-18 Thread Richard Vézina
Changelog file in web2py folder :

*## 2.15.1-4*
- pydal 17.08
*- dropped support for python 2.6*
- dropped web shell
- experimental python 3 support
- experimental authapi for service login
- allow ajax file uploads
- more tests
- more pep8 compliance
- d3.js model visulization
- improved scheduler
- is_email support for internationalized Domain Names
- improved used of cookies with CookieJar
- SQLFORM.grid(showblobs=True)
- import JS events (added w2p.componentBegin event)
- added support for CASv3
- allow first_name and last_name placeholders in verify_email message
- added three-quote support in markmin
- updated pg8000 driver (but we still recommend psycopg2)
- compiled views use . separator not _ separator (must recompile code)
- better serbian, french, and catalan translations
- speed improvements (refactor of compileapp and pyc caching)
- removed web shell (never worked as intended)
- allow Expose(..., follow_symlink_out=False).
- Updated fpdf to latest version
- JWT support
- import fabfile for remote deployment
- scheduler new feature: you can now specify intervals with cron
- gluon/* removed from sys.path. Applications relying on statements like
e.g.
  "from storage import Storage"
  will need to be rewritten with
  "from gluon.storage import Storage"
- tests can only be run with the usual web2py.py --run_system_tests OR with
  python -m unittest -v gluon.tests on the root dir
- jQuery 3.2.1
- PyDAL 17.07 including:
  allow jsonb support for postgres
  correctly configure adapters that need connection for configuration
  better caching
  updated IMAP adapter methods to new API
  experimental suport for joinable subselects
  improved Teradata support
  improved mongodb support
  overall refactoring
  experimental support for Google Cloud SQL v2
  new pymysql driver

On Mon, Jun 18, 2018 at 10:48 AM, Carlos Cesar Caballero Díaz <
carlos.caball...@cfg.jovenclub.cu> wrote:

> Hi guys, what was the last web2py version supporting Python 2.6?
>
> Greetings.
>
>
> --
> 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] fetching events from DB using fullcalendar javascript event calendar

2018-06-13 Thread Richard Vézina
Here I had showed how I was dealing with fullcalendar :

https://groups.google.com/d/msg/web2py/GQFIMbNmp_M/ZiRHLUQ_UAAJ

Good luck

Richard

On Sun, Jun 10, 2018 at 4:40 PM, Andrea Fae'  wrote:

> I'm using web2py and now I'm fetching all calendar events from db using
> this code in a view:
>
> events: [
> {{for row in rowseventi:}}
> {
> title: '{{=row.evento.titolo}}',
> id: '{{=row.evento.id}}',
> resourceId: '{{=row.evento.risorsa}}',
> start: '{{=row.evento.inizio}}',
> end: '{{=row.evento.fine}}',
> recurring: '{{=row.evento.ricorrenza}}',
> // allDay: false,
> color : '{{=row.evento.colore}}',
> url: '{{=URL('mostra_evento',args=row.evento.id)}}',
>},
>{{pass}}]
>
> It's working perfectly but now I'd like to fetch only events regarding
> current view using this function https://fullcalendar.
> io/docs/events-function
>
> function( start, end, timezone, callback ) { }
>
> There are some example using php but I want only use python and PyDAL. Can
> someone give me some examples using only python and javascript?
>
> rowseventi it's an array retrieved from controller that contains all
> events...
>
> When I change the view with "next", "prev" or something else I'd like to
> fetch the new events based on the dates showed in the view.
>
> 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.
>

-- 
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] web2py with python3

2018-06-12 Thread Richard Vézina
That's what I thought... I see others give you tip, I think there few
things I can had good luck

Richard

On Tue, Jun 12, 2018 at 2:45 PM, yifan li  wrote:

> Hi Richard,
>
> Thank you for your reply. I'm using a window8 OS. My web2py version is
> 2.16.1 which is the latest version. After I download the zip file, I just
> execute 'web2py.exe' in terminal. There is no file called 'web2py.py' so
> that I'm not allowed to use 'python3  web2py.py' to run this booster
> file. What would you recommend next move from my current situation. Thank
> you!
>
> Best regards,
> Yifan
>
> On Tuesday, June 12, 2018 at 11:09:14 AM UTC-4, Richard wrote:
>
>> You update python in your system not web2py... What is your environement
>> windows|linux|mac? I guess since you use Anaconda you are under windows or
>> mac... web2py been ported to python 3.4+, but I am not sure it could be
>> considered production ready under python 3. I am not following progress
>> carefully since sometimes, but last time I check there were still issue
>> with paramiko lib that wasn't still ported to python 3 which I think migth
>> represent challenge for the hashing of the password under python 3... If
>> you rely on LDAP and don't manage you own password it not an issue. Other
>> then that, the only remaining constraints would be limited testing of
>> web2py under python 3 that would had prevent the exposition of some
>> remaining unported piece of code... So you migth experience some little
>> compatibility issue under python 3, but they should be consider corner
>> cases. I am sure if you report them there will be someone fixing them asap
>> and you can get them fixed by using the last trunk verion (not the stable
>> version)... For the same reason, I would recommanded to use the latest
>> trunk version if you intend to run under python 3 because there will be
>> less compatibility issues as there isn't been a new web2py version since
>> sometimes and there been many compatibilities issues fixed since then.
>>
>> If you use linux box most of them are ship with python 3 beside python 2
>> or even python 3 as default sometimes... If it is not the case, you can
>> start web2py with "python3 web2py.py ..."
>>
>>
>> Richard
>>
>> On Tue, Jun 12, 2018 at 10:19 AM, yifan li  wrote:
>>
>>> Hi everyone,
>>>
>>> I install latest version for web2py. But the python version in web2py is
>>> 2.7.9. However, I executed web2py in anaconda. My anaconda has python
>>> version 3.6 installed. How could I upgrade python version to 3.6 in web2py.
>>>
>>> Best regards,
>>> Yifan
>>>
>>> --
>>> 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] web2py with python3

2018-06-12 Thread Richard Vézina
You update python in your system not web2py... What is your environement
windows|linux|mac? I guess since you use Anaconda you are under windows or
mac... web2py been ported to python 3.4+, but I am not sure it could be
considered production ready under python 3. I am not following progress
carefully since sometimes, but last time I check there were still issue
with paramiko lib that wasn't still ported to python 3 which I think migth
represent challenge for the hashing of the password under python 3... If
you rely on LDAP and don't manage you own password it not an issue. Other
then that, the only remaining constraints would be limited testing of
web2py under python 3 that would had prevent the exposition of some
remaining unported piece of code... So you migth experience some little
compatibility issue under python 3, but they should be consider corner
cases. I am sure if you report them there will be someone fixing them asap
and you can get them fixed by using the last trunk verion (not the stable
version)... For the same reason, I would recommanded to use the latest
trunk version if you intend to run under python 3 because there will be
less compatibility issues as there isn't been a new web2py version since
sometimes and there been many compatibilities issues fixed since then.

If you use linux box most of them are ship with python 3 beside python 2 or
even python 3 as default sometimes... If it is not the case, you can start
web2py with "python3 web2py.py ..."


Richard

On Tue, Jun 12, 2018 at 10:19 AM, yifan li  wrote:

> Hi everyone,
>
> I install latest version for web2py. But the python version in web2py is
> 2.7.9. However, I executed web2py in anaconda. My anaconda has python
> version 3.6 installed. How could I upgrade python version to 3.6 in web2py.
>
> Best regards,
> Yifan
>
> --
> 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: Scheduler and far-away tasks

2018-06-11 Thread Richard Vézina
Hello Joe,

I am not using the scheduler primarilly because I never had time to
implemented it. But I miss so much all the things you mention... Let says
just configure a task to lock a user account on a specific date in the
future when you have employee termination in advance and you have no other
proper mean to recall that and don't want to pollute your calendar with a
bunch of todo thing...

The only flaw I see is relying on the tool and having some task not
performed as expect for some reason and not get properly inform that a
given task didn't succeed as expect... Depending of the criticallity of the
task this may have bad consequences...

Richard

On Mon, Jun 11, 2018 at 11:16 AM, Anthony  wrote:

> I suppose that should be fine. Tasks are stored in a database, so should
> be as durable as any other data you are storing.
>
> Alternatively, you might consider storing the reveal date with the item
> and running a regular task that simply selects all items with reveal dates
> equal to or earlier than the current day and updates those items to become
> visible. Or even just add a common filter that automatically filters out
> any records with a future reveal date.
>
> Anthony
>
>
> On Sunday, June 10, 2018 at 7:20:19 PM UTC-4, Joe Barnhart wrote:
>>
>> Are there any reasons I should not schedule tasks days, weeks, or months
>> in advance in the web2py scheduler?  It seems such a fantastic,
>> general-purpose tool that I'm using it for more and more things in the
>> site.
>>
>> Currently I'm considering using it to "reveal" embargo'ed items that
>> should not be seen until a certain date and time.  The reveal would involve
>> putting a task in the scheduler for the far-away date and having it create
>> a permission on a table at the moment of truth.
>>
>> Is there some reason this might be considered bad design, or poor use of
>> the scheduler?  Reliability is of high importance in my site, so design
>> that decreases reliability is to be avoided.
>>
>> -- Joe
>>
>> --
> 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] link to a grid

2018-05-10 Thread Richard Vézina
The error message is simple, you don't have a controller function named
static in you default controller file...

Richard

On Thu, May 10, 2018 at 6:59 AM, Andrea Fae'  wrote:

> Hello I have a grid with certain fields.
> In a filed there is a name of a pdf file that I have in the folder
> "static/Etichette". I have a lot of pdf file in this folder and I'd like,
> when I click this link, to open the related file...
>
> This is the grid
> grid = SQLFORM.grid(db.socio, links = [lambda row: A('Etichetta',
> _href=URL('static/Etichette', args=[row.etichetta]))], details=False,
> create=False, editable=False, deletable=False, maxtextlength=40)
>
>
> This is the table
>
> db.define_table('socio',
> Field('codice', type='integer', requires=[IS_NOT_EMPTY()]),
> Field('cognome', requires=[IS_NOT_EMPTY()]),
> Field('nome', requires=[IS_NOT_EMPTY()]),
> Field('intestazione', requires=[IS_NOT_EMPTY()]),
> Field('dnascita', requires=[IS_NOT_EMPTY()]),
> Field('indirizzo', requires=[IS_NOT_EMPTY()]),
> Field('cap', requires=[IS_NOT_EMPTY()]),
> Field('comune', requires=[IS_NOT_EMPTY()]),
> Field('provincia', requires=[IS_NOT_EMPTY()]),
> Field('telefono', requires=[IS_NOT_EMPTY()]),
> Field('codfisc', requires=[IS_NOT_EMPTY()]),
> Field('etichetta'),
> auth.signature,singular="Socio",plural="Soci",migrate='
> socio.table',
> format='%(intestazione)s')
>
> How can I do?
>
> I have this error
> invalid function (default/static)
>
> Yes...I know that there is something wrong but I don't know in this moment
> what...
>
> --
> 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] pyDAL "adapter" for Pandas syntax (phylosophical)

2018-05-04 Thread Richard Vézina
By include in pandas I mean add support to pydal in pandas so you can do
something like :

df = pd.DataFrame.from_pydal(db(...).select(...))

Richard

On Fri, May 4, 2018 at 1:10 AM, Jurgis Pralgauskis <
jurgis.pralgaus...@gmail.com> wrote:

> I'd like not to include sth into Pandas, but to adapt Pandas syntax for
> DAL (SELECT part mostly, in my case) :)
>
> --
> Jurgis Pralgauskis
> tel: 8-616 77613
>
> 2018-05-03 04:05 popiet "Richard Vézina" <ml.richard.vez...@gmail.com>
> rašė:
>
> I use this to merge join dal query :
>
> # merge_dicts is from here :
> # http://stackoverflow.com/questions/38987/how-can-i-
> merge-two-python-dictionaries-in-a-single-expression
> def merge_dicts(*dict_args):
> """
> Given any number of dicts, shallow copy and merge into a new dict,
> precedence goes to key value pairs in latter dicts.
> """
> result = {}
> for dictionary in dict_args:
> result.update(dictionary)
> return result
>
> db(db.table_1.id == something).select(db.table_1.ALL, db.table_2.ALL,
> db.table_3.ALL, db.table_4.ALL, join or left=[...]).as_list()
>
> df = pd.DataFrame([merge_dicts(r['table_1'],
>r['table_2'],
>r['table_3'],
>r[table_4]) for r in
> rows.as_list()])
>
> What you want would have to be include in pandas.
>
> Richard
>
> On Thu, May 3, 2018 at 2:49 AM, Jurgis Pralgauskis <
> jurgis.pralgaus...@gmail.com> wrote:
>
>> Bt if I want select cols/filter rows/aggregate/ join tables
>>  - with Pandas syntax directly from DB (for it to work as DAL, not with
>> another DAL syntax) ?
>>
>> --
>> Jurgis Pralgauskis
>> tel: 8-616 77613
>>
>> 2018-05-02, tr 22:22, Richard Vézina <ml.richard.vez...@gmail.com> rašė:
>>
>>> I am not sure I understand what you want...
>>>
>>> It a nice thing if Pandas use RAM it means that it use the fastest
>>> component of you computer... It should make Pandas fast...
>>>
>>> I am not sure what would involve overloading operators to use pyDAL...
>>> Pandas is used to transform data... If what you do on your dataframe has to
>>> be apply to your data would be really risky on the persistence stand
>>> point...
>>>
>>> To populate dataframe from web2py table :
>>>
>>> import pandas as pd
>>> rows = db(db.auth_user.id > 0).select(db.auth_user.ALL).as_list()
>>> df = pd.DataFrame(rows)
>>> df.columns  # Should be your fields names
>>>
>>> Richard
>>>
>>> On Tue, May 1, 2018 at 11:31 PM, Jurgis Pralgauskis <
>>> jurgis.pralgaus...@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> Pandas syntax seems very nice (short), and popular ...
>>>> But Pandas eat RAM..., and well, most of data is in DB...
>>>>
>>>> so I wonder, how hard would it be to overload operators to use pyDAL
>>>> (or other DAL/ORM)?
>>>>
>>>> what are the main challanges?
>>>>
>>>> --
>>>> 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 a topic in the
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/
>>> topic/web2py/DIeQ5U-pr6Q/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> web2py+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> Resources:
>> - http://web2py.c

Re: [web2py] pyDAL "adapter" for Pandas syntax (phylosophical)

2018-05-03 Thread Richard Vézina
I use this to merge join dal query :

# merge_dicts is from here :
#
http://stackoverflow.com/questions/38987/how-can-i-merge-two-python-dictionaries-in-a-single-expression
def merge_dicts(*dict_args):
"""
Given any number of dicts, shallow copy and merge into a new dict,
precedence goes to key value pairs in latter dicts.
"""
result = {}
for dictionary in dict_args:
result.update(dictionary)
return result

db(db.table_1.id == something).select(db.table_1.ALL, db.table_2.ALL,
db.table_3.ALL, db.table_4.ALL, join or left=[...]).as_list()

df = pd.DataFrame([merge_dicts(r['table_1'],
   r['table_2'],
   r['table_3'],
   r[table_4]) for r in
rows.as_list()])

What you want would have to be include in pandas.

Richard

On Thu, May 3, 2018 at 2:49 AM, Jurgis Pralgauskis <
jurgis.pralgaus...@gmail.com> wrote:

> Bt if I want select cols/filter rows/aggregate/ join tables
>  - with Pandas syntax directly from DB (for it to work as DAL, not with
> another DAL syntax) ?
>
> --
> Jurgis Pralgauskis
> tel: 8-616 77613
>
> 2018-05-02, tr 22:22, Richard Vézina <ml.richard.vez...@gmail.com> rašė:
>
>> I am not sure I understand what you want...
>>
>> It a nice thing if Pandas use RAM it means that it use the fastest
>> component of you computer... It should make Pandas fast...
>>
>> I am not sure what would involve overloading operators to use pyDAL...
>> Pandas is used to transform data... If what you do on your dataframe has to
>> be apply to your data would be really risky on the persistence stand
>> point...
>>
>> To populate dataframe from web2py table :
>>
>> import pandas as pd
>> rows = db(db.auth_user.id > 0).select(db.auth_user.ALL).as_list()
>> df = pd.DataFrame(rows)
>> df.columns  # Should be your fields names
>>
>> Richard
>>
>> On Tue, May 1, 2018 at 11:31 PM, Jurgis Pralgauskis <
>> jurgis.pralgaus...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> Pandas syntax seems very nice (short), and popular ...
>>> But Pandas eat RAM..., and well, most of data is in DB...
>>>
>>> so I wonder, how hard would it be to overload operators to use pyDAL (or
>>> other DAL/ORM)?
>>>
>>> what are the main challanges?
>>>
>>> --
>>> 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 a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/
>> topic/web2py/DIeQ5U-pr6Q/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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] pyDAL "adapter" for Pandas syntax (phylosophical)

2018-05-02 Thread Richard Vézina
I am not sure I understand what you want...

It a nice thing if Pandas use RAM it means that it use the fastest
component of you computer... It should make Pandas fast...

I am not sure what would involve overloading operators to use pyDAL...
Pandas is used to transform data... If what you do on your dataframe has to
be apply to your data would be really risky on the persistence stand
point...

To populate dataframe from web2py table :

import pandas as pd
rows = db(db.auth_user.id > 0).select(db.auth_user.ALL).as_list()
df = pd.DataFrame(rows)
df.columns  # Should be your fields names

Richard

On Tue, May 1, 2018 at 11:31 PM, Jurgis Pralgauskis <
jurgis.pralgaus...@gmail.com> wrote:

> Hi,
>
> Pandas syntax seems very nice (short), and popular ...
> But Pandas eat RAM..., and well, most of data is in DB...
>
> so I wonder, how hard would it be to overload operators to use pyDAL (or
> other DAL/ORM)?
>
> what are the main challanges?
>
> --
> 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] DAL return all Fields

2018-05-01 Thread Richard Vézina
Are you querying multiple table?? You can do a join... That way you will
have all the value for every fields the only catch is that when you join to
disambiguate fields names dal use table.field instead of just field as
field name so it migth happen that if you call "manually" vs
"programmatically" you field you forgot about that... You have to do
db.table['table.field']...

Richard

On Tue, May 1, 2018 at 11:22 AM, Maurice Waka <mauricew...@gmail.com> wrote:

> Thanks.
> It iterates well giving some fields data, but not all as needed. I get
> data from some 4 fields only. I have about 60 in some db. Plus there is
> this:
> 
>
> On Tue, 1 May 2018, 16:44 Richard Vézina <ml.richard.vez...@gmail.com>
> wrote:
>
>> for f, v in row:
>>
>> Should be
>>
>> for f, v in row.iteritems():
>>
>> k, v for key, value, but I use f instead of k because you will have
>> field_name and value in this for loop...
>>
>> Richard
>>
>> On Mon, Apr 30, 2018 at 11:39 PM, Maurice Waka <mauricew...@gmail.com>
>> wrote:
>>
>>> What would f, v be.
>>> I get this error : ValueError : too many values to unpack
>>>
>>> On Mon, 30 Apr 2018, 20:38 Richard Vézina <ml.richard.vez...@gmail.com>
>>> wrote:
>>>
>>>>
>>>>
>>>> On Mon, Apr 30, 2018 at 1:21 PM, Maurice Waka <mauricew...@gmail.com>
>>>> wrote:
>>>>
>>>>> Sorry I tried to clarify by my new question :
>>>>>
>>>>> If I have a column with data like db.persons with data like
>>>>> Carl
>>>>> Junior
>>>>> Maggie
>>>>> Tom
>>>>> Derrick
>>>>>
>>>>> And each column name has other fields with data such as:
>>>>> persons.name persons.age persons.location persons.occupation
>>>>> persons.interests
>>>>> Carl 23 London Neuroscientist brainy stuff
>>>>> Junior 25 Tokyo doctor medical research
>>>>> Maggie 33 Nairobi farmer GMO research
>>>>> Tom 25 Sydney teacher educational ideas
>>>>> Derrick 21 Chicago surgeon Cutting through
>>>>>
>>>>>
>>>>>
>>>>> I want to iterate through the column  persons.nameand randomly pick a
>>>>> name and using the rows object, display all data about the person.
>>>>>
>>>>> If I do
>>>>> rows_name = db().select(db.persons.name).column()
>>>>>
>>>>
>>>>
>>>> The above should be :
>>>>
>>>> fields = db.persons.fields
>>>> # You should have in fields a list of all fields names you migth want
>>>> to remove "id" field by filtering it or find index and pop it out of the
>>>> list
>>>> # ex.: fields.pop(fields.index('id'))
>>>>
>>>>
>>>>
>>>>>
>>>>>
>>>>> rows = db(db.persons.ALL).select()
>>>>>
>>>>
>>>> db(where_clause).select(fields_name_separated_by_comma)
>>>>
>>>> The above is completly wrong as you pass the fields instead of
>>>> specifying your where clause parameter...
>>>>
>>>> In you example you really only need select like this :
>>>>
>>>> def some_func_name()
>>>> rows = db(db.persons.id > 0).select(db.persons.ALL)
>>>>
>>>> rows_values = []
>>>> for row in rows:
>>>> row_value = []
>>>> for f, v in row:
>>>> if f != 'id':
>>>> row_value.append(v)
>>>> rows_values.append(row_value)
>>>> return rows_values
>>>>
>>>> ret = some_func_name()
>>>>
>>>> for r in ret:
>>>> print(' '.join(ret))
>>>>
>>>> I didn't tested it but the above should work...
>>>>
>>>> Good luck
>>>>
>>>>>
>>>>> for row in rows:
>>>>> if rows_name[0] == 'Maggie':
>>>>> for row in rows:
>>>>> return [row.age+' '+row.location+' '+row.occupation+'
>>>>> '+row.interests]
>>>>>
>>>>> The problem is that if I query 'Carl' which is the first item, I get
>>>>> the response but I cant query any other name .
>>>>> Regards
>>>>>
>

Re: [web2py] DAL return all Fields

2018-05-01 Thread Richard Vézina
for f, v in row:

Should be

for f, v in row.iteritems():

k, v for key, value, but I use f instead of k because you will have
field_name and value in this for loop...

Richard

On Mon, Apr 30, 2018 at 11:39 PM, Maurice Waka <mauricew...@gmail.com>
wrote:

> What would f, v be.
> I get this error : ValueError : too many values to unpack
>
> On Mon, 30 Apr 2018, 20:38 Richard Vézina <ml.richard.vez...@gmail.com>
> wrote:
>
>>
>>
>> On Mon, Apr 30, 2018 at 1:21 PM, Maurice Waka <mauricew...@gmail.com>
>> wrote:
>>
>>> Sorry I tried to clarify by my new question :
>>>
>>> If I have a column with data like db.persons with data like
>>> Carl
>>> Junior
>>> Maggie
>>> Tom
>>> Derrick
>>>
>>> And each column name has other fields with data such as:
>>> persons.name persons.age persons.location persons.occupation
>>> persons.interests
>>> Carl 23 London Neuroscientist brainy stuff
>>> Junior 25 Tokyo doctor medical research
>>> Maggie 33 Nairobi farmer GMO research
>>> Tom 25 Sydney teacher educational ideas
>>> Derrick 21 Chicago surgeon Cutting through
>>>
>>>
>>>
>>> I want to iterate through the column  persons.nameand randomly pick a
>>> name and using the rows object, display all data about the person.
>>>
>>> If I do
>>> rows_name = db().select(db.persons.name).column()
>>>
>>
>>
>> The above should be :
>>
>> fields = db.persons.fields
>> # You should have in fields a list of all fields names you migth want to
>> remove "id" field by filtering it or find index and pop it out of the list
>> # ex.: fields.pop(fields.index('id'))
>>
>>
>>
>>>
>>>
>>> rows = db(db.persons.ALL).select()
>>>
>>
>> db(where_clause).select(fields_name_separated_by_comma)
>>
>> The above is completly wrong as you pass the fields instead of specifying
>> your where clause parameter...
>>
>> In you example you really only need select like this :
>>
>> def some_func_name()
>> rows = db(db.persons.id > 0).select(db.persons.ALL)
>>
>> rows_values = []
>> for row in rows:
>> row_value = []
>> for f, v in row:
>> if f != 'id':
>> row_value.append(v)
>> rows_values.append(row_value)
>> return rows_values
>>
>> ret = some_func_name()
>>
>> for r in ret:
>> print(' '.join(ret))
>>
>> I didn't tested it but the above should work...
>>
>> Good luck
>>
>>>
>>> for row in rows:
>>> if rows_name[0] == 'Maggie':
>>> for row in rows:
>>> return [row.age+' '+row.location+' '+row.occupation+' '+
>>> row.interests]
>>>
>>> The problem is that if I query 'Carl' which is the first item, I get the
>>> response but I cant query any other name .
>>> 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 a topic in the
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit https://groups.google.
>>> com/d/topic/web2py/ynBOuIdufso/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> web2py+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>> I had been using python isle to test some modules. Now I just want to
>>> get a clearer code by removing the long codes.
>>>
>>>
>>> On Mon, 30 Apr 2018, 20:09 Richard Vézina <ml.richard.vez...@gmail.com>
>>> wrote:
>>>
>>>> Man this is convulated...
>>>>
>>>> Not sure what is in name4 "name4 is a list that contains items found in
>>>> db.health.name, as well as other dbs." what items are you referring
>>>> at?? What other dbs?
>>>>
>>>> Why are you connecting to sqlite by your own...
>>>>
>>>> This check is just weird :
>>>>
>>>> if id == item in name4:
>>>>
>>>> I would suggest you don't use function to achieve what yo

Re: [web2py] DAL return all Fields

2018-04-30 Thread Richard Vézina
On Mon, Apr 30, 2018 at 1:21 PM, Maurice Waka <mauricew...@gmail.com> wrote:

> Sorry I tried to clarify by my new question :
>
> If I have a column with data like db.persons with data like
> Carl
> Junior
> Maggie
> Tom
> Derrick
>
> And each column name has other fields with data such as:
> persons.name persons.age persons.location persons.occupation
> persons.interests
> Carl 23 London Neuroscientist brainy stuff
> Junior 25 Tokyo doctor medical research
> Maggie 33 Nairobi farmer GMO research
> Tom 25 Sydney teacher educational ideas
> Derrick 21 Chicago surgeon Cutting through
>
>
>
> I want to iterate through the column  persons.nameand randomly pick a
> name and using the rows object, display all data about the person.
>
> If I do
> rows_name = db().select(db.persons.name).column()
>


The above should be :

fields = db.persons.fields
# You should have in fields a list of all fields names you migth want to
remove "id" field by filtering it or find index and pop it out of the list
# ex.: fields.pop(fields.index('id'))



>
>
> rows = db(db.persons.ALL).select()
>

db(where_clause).select(fields_name_separated_by_comma)

The above is completly wrong as you pass the fields instead of specifying
your where clause parameter...

In you example you really only need select like this :

def some_func_name()
rows = db(db.persons.id > 0).select(db.persons.ALL)

rows_values = []
for row in rows:
row_value = []
for f, v in row:
if f != 'id':
row_value.append(v)
rows_values.append(row_value)
return rows_values

ret = some_func_name()

for r in ret:
print(' '.join(ret))

I didn't tested it but the above should work...

Good luck

>
> for row in rows:
> if rows_name[0] == 'Maggie':
> for row in rows:
> return [row.age+' '+row.location+' '+row.occupation+' '+
> row.interests]
>
> The problem is that if I query 'Carl' which is the first item, I get the
> response but I cant query any other name .
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.
> com/d/topic/web2py/ynBOuIdufso/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
> I had been using python isle to test some modules. Now I just want to get
> a clearer code by removing the long codes.
>
>
> On Mon, 30 Apr 2018, 20:09 Richard Vézina <ml.richard.vez...@gmail.com>
> wrote:
>
>> Man this is convulated...
>>
>> Not sure what is in name4 "name4 is a list that contains items found in
>> db.health.name, as well as other dbs." what items are you referring at??
>> What other dbs?
>>
>> Why are you connecting to sqlite by your own...
>>
>> This check is just weird :
>>
>> if id == item in name4:
>>
>> I would suggest you don't use function to achieve what you try to do it
>> just make it overcomplicated... Also never define functions in models files
>> it will slow down your app as models files are executed at each request.
>>
>> My guess is that if you end with the final list that you showed us is
>> because at some point you put the name of the fields you want instead of
>> the value attached to them...
>>
>> But seriously it very difficult to help...
>>
>> You could show us all the models that are important to the problem and
>> show us an example of what you want at the end.
>>
>>
>> I also don't know from you field name in health table what they content.
>>
>> So for example let say
>>
>>
>> You have a table name fruit
>>
>> rows = db(db.fruit.id > 0).select(db.fruit.ALL)
>>
>> With a fruit_name field
>>
>> for r in rows:
>> print('A {0} is a fruit blah blah blah. A {0} when its green is
>> bitter to taste. A {0} when ripe looks bright yellow and tastes
>> sweet.'.format(r.fruit_name)
>>
>> That's it!!
>>
>> Richard
>>
>>
>> On Sat, Apr 28, 2018 at 11:02 AM, Maurice Waka <mauricew...@gmail.com>
>> wrote:
>>
>>> Thanks, but I seem to be having a challenge when returning the rows from
>>> a specific id name or number. I tried this on a diff

Re: [web2py] DAL return all Fields

2018-04-30 Thread Richard Vézina
Man this is convulated...

Not sure what is in name4 "name4 is a list that contains items found in
db.health.name, as well as other dbs." what items are you referring at??
What other dbs?

Why are you connecting to sqlite by your own...

This check is just weird :

if id == item in name4:

I would suggest you don't use function to achieve what you try to do it
just make it overcomplicated... Also never define functions in models files
it will slow down your app as models files are executed at each request.

My guess is that if you end with the final list that you showed us is
because at some point you put the name of the fields you want instead of
the value attached to them...

But seriously it very difficult to help...

You could show us all the models that are important to the problem and show
us an example of what you want at the end.


I also don't know from you field name in health table what they content.

So for example let say


You have a table name fruit

rows = db(db.fruit.id > 0).select(db.fruit.ALL)

With a fruit_name field

for r in rows:
print('A {0} is a fruit blah blah blah. A {0} when its green is bitter
to taste. A {0} when ripe looks bright yellow and tastes
sweet.'.format(r.fruit_name)

That's it!!

Richard


On Sat, Apr 28, 2018 at 11:02 AM, Maurice Waka <mauricew...@gmail.com>
wrote:

> Thanks, but I seem to be having a challenge when returning the rows from a
> specific id name or number. I tried this on a different app as follows:
>
> Model:
>
> db.define_table( "health",
> Field('name', 'string'),
> Field('definition', 'text', length= 100,
> default="We'll update soon.", notnull=True),
> Field('abnvals', 'text', length= 100,default="We'll
> update soon.", notnull=True),
> Field('normvals', 'text', length= 100,default="We'll
> update soon.", notnull=True),
> def selections():
> code
> return name4# name4 is a list that contains items found in db.health.name,
> as well as other dbs.
>  def refer11():
> db = current.db
> rows = db(db.health).iterselect()
> for row in rows:
> id = row.name
> if id == item in name4:
> #return [', '.join(item) for item in rows]# Gives a list of the titles
> only as: ['name','definition','abnvals','normvals',]
> #return [item for item in rows]# Gives this: [
> #return row# gives this : 
> #return [item for item in row]# Gives a list of
> the titles only as: ['name','definition','abnvals','normvals',]
>
> When using sql speak, this works well:
> def refer11():
> id = 0
> location = ""
> conn = sqlite3.connect('wellness.db')
> c = conn.cursor()
> c.execute('select * from health')
> records = c.fetchall()
> for record in records:
> id = record[1]
> for item in name4:
> if id == item in name4:
> return record[2:]
>
> If row.name has e.g. apple, mango, guava, pineapple, then
>
> and the fields contain info about the fruits e.g.
>
> if id/row.name picks mango, i want a list of these:
>
> definition data: A mango is a fruit blah blah blah.
> abnvals data: A mango when its green is bitter to taste.
> normvals data: A mango when ripe looks bright yellow and tastes sweet.
>
> so when doing return row
> I should get ['A mango is a fruit blah blah blah. A mango when its green
> is bitter to taste. A mango when ripe looks bright yellow and tastes
> sweet.]
> and not
> ['name','definition','abnvals','normvals',]
>
> On Fri, Apr 27, 2018 at 6:16 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> for f in db.table.fields:
>> print f
>>
>> or
>>
>> rows = db(db.fruits.id > 0).select(db.fruits.ALL)  # ALL means all fields
>>
>> for r in rows:
>> print(r)
>>
>> You can control which field you want with the previous example
>>
>> myfields = [f for f in db.table.fields if SOME_FILTERING_CHECK_OVER_THE_
>> FIELD_YOU_WANT]
>>
>>
>> for r in rows:
>> for f in myfields:
>> print(r[f])
>>
>>
>> You can play around that you should be able to figure out how you can do
>> what you wanna do.
>>
>> Richard
>>
>> On Fri, Apr 27, 2018 at 10:08 AM, Maurice Waka <mauricew...@gmail.com>
>> wrote:
>>
>>> Addendum
>>>
>>> I want a single list of  the items (the data from all fields)
>>>
>>> regards
>>>
>>> On Fri, Apr 27, 2018 at 5:06 PM, Maurice Waka <mauricew...@gmail.com>
>>> wrote:
>>>
>>>> There are several fields in my db such

Re: [web2py] DAL return all Fields

2018-04-27 Thread Richard Vézina
for f in db.table.fields:
print f

or

rows = db(db.fruits.id > 0).select(db.fruits.ALL)  # ALL means all fields

for r in rows:
print(r)

You can control which field you want with the previous example

myfields = [f for f in db.table.fields if
SOME_FILTERING_CHECK_OVER_THE_FIELD_YOU_WANT]


for r in rows:
for f in myfields:
print(r[f])


You can play around that you should be able to figure out how you can do
what you wanna do.

Richard

On Fri, Apr 27, 2018 at 10:08 AM, Maurice Waka 
wrote:

> Addendum
>
> I want a single list of  the items (the data from all fields)
>
> regards
>
> On Fri, Apr 27, 2018 at 5:06 PM, Maurice Waka 
> wrote:
>
>> There are several fields in my db such as this:
>>
>> db.define_table('fruit', Field('id', 'reference auth_user'), 
>> Field('apple','boolean',label=T('Apple')), 
>> Field('apricot','boolean',label=T('Apricot')), 
>> Field('cherry','boolean',label=T('Cherry')), Field('fig','boolean', 
>> label=T('Fig')), Field('lychee','boolean', label=T('Lychee')), 
>> Field('peach','boolean', label=T('Peach')), Field('pear','boolean', 
>> label=T('Pear')), Field('plum','boolean', label=T('Plum')))
>> If i want to print items from a specific field i would do:
>>
>> rows = db(db.fruits)select()for row in rows:
>>  return row.apple
>>
>>
>> Now I want to return all data from all fields. How Can i go about it.
>>
>> I have tried:
>>
>> return rows and I get a blank screen.
>>
>> return [rows] and I get [].
>>
>> Kind 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 a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>> pic/web2py/-Hlx1yh-4MU/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> 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: Updated Version of web2py and sending emails stopped working

2018-04-27 Thread Richard Vézina
Can you show us your code (omit your credential)... You mention you use
Office 365, they might have made some change you may want to have a look in
the account config if SMTP has change. Or you could also try ot use the
SMTP of the FAI with a no-reply email...

Richard

On Thu, Apr 26, 2018 at 10:09 PM, James O' Driscoll <
james.odrisc...@gmail.com> wrote:

> I am not using AWS, just standard methods IMAP/SMTP.
>
> On Wed, 25 Apr 2018 at 7:36 am, Massimo Di Pierro <
> massimo.dipie...@gmail.com> wrote:
>
>> Notice that web2py in trunk supports sending emails from AWS+SNS
>>
>> just do
>>
>> mail.settings.server='aws'
>>
>> the sender email must be authorized in the SNS config
>>
>>
>>
>> On Wednesday, 4 April 2018 20:17:20 UTC-5, Dave S wrote:
>>>
>>>
>>>
>>> On Wednesday, April 4, 2018 at 6:13:06 PM UTC-7, Dave S wrote:



 On Wednesday, April 4, 2018 at 6:10:28 PM UTC-7, Dave S wrote:
>
>
>
> On Wednesday, April 4, 2018 at 5:08:22 PM UTC-7, James O' Driscoll
> wrote:
>>
>> Any insights??  Surely this is not preferable when people who have
>> clients and have to update web2py get no support.
>
>
> I updated from 2.14.6 to 2.15.4 with no issues to mail.  Not a very
> big jump, perhaps, but it went okay.
>
> Perhaps you can do a -M yourapp -S and try the commands by hand, and
> see if you get additional error messages.
>
> Is this code in a controller or a module?  Is it run during a normal
> request, or from the scheduler?
>
>
 Also, are you connecting to a third-party mail service such as Google
 or SparkPost?

>>>
>>> [I don't; I have an AWS Linux machine with a local sendmail, which may
>>> color my answers]
>>>
>>> And see Massimo's comments from last June:
>>> 
>>>
>>> /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 a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/
>> topic/web2py/Qf_LhJAsT7c/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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: web2py 2.16.1 is OUT

2018-04-24 Thread Richard Vézina
Here : https://github.com/web2py/web2py/issues/1911

On Tue, Apr 24, 2018 at 11:20 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> Also, to my understanding it only log an error, it no big deal, as long as
> the welcome app package is there... What we could do it to log an error
> when there is actually no welcome app pacakge as it break web2py
> functionality other then that as long as the welcome package is there the
> only issue is that it will be out dated which is not ideal, but might be
> better then having a broken app creation utility...
>
> I open an issue..
>
> Richard
>
> On Tue, Apr 24, 2018 at 11:09 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Yes but even then, in the end you don't want to create a new welcome
>> package if it not a new install as it gonna slow things down... So it will
>> end slow down thing and always create an new welcome package, no??
>>
>> I would leave it like that and add a NEWINSTALL empty file in the
>> repository...
>>
>> We definetly open an issue...
>>
>> Richard
>>
>> On Tue, Apr 24, 2018 at 8:51 AM, Carlos Cesar Caballero Díaz <
>> carlos.caball...@cfg.jovenclub.cu> wrote:
>>
>>> I think we should check if the file exists before try to delete it.
>>>
>>> or move the unlik() function to a new "try-except" block, something like:
>>>
>>> if welcome.w2p is correctly created:
>>>
>>> try:
>>>
>>> os.unlink('NEWINSTALL')
>>>
>>> except FileNotFoundError:
>>>
>>> nothing to do
>>>
>>> except:
>>>
>>> error removing 'NEWINSTALL' file
>>>
>>>
>>> Greetings.
>>>
>>> El 23/04/18 a las 13:33, Richard Vézina escribió:
>>>
>>> Actually it already inside a try... And it only logging an error...
>>> Should this be an error or a warning?? I guess this is done for the
>>> appadmin to allow it to create new app as it base on welcome... The welcome
>>> template is provision at first web2py run once install and derived from the
>>> welcome app...
>>>
>>> I guess it wouldn't be a good solution to track this NEWINSTALL file in
>>> the repo, as it could trigger some other issue... But at the same time, if
>>> you manage your web2py install with git, it might just make sens that
>>> whenever you update your local repo, that this file get recreated and the
>>> template being updated??
>>>
>>> Richard
>>>
>>> On Mon, Apr 23, 2018 at 1:28 PM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
>>>> I guess we could had a simple "try" there...
>>>>
>>>> Richard
>>>>
>>>> On Mon, Apr 23, 2018 at 1:26 PM, Richard Vézina <
>>>> ml.richard.vez...@gmail.com> wrote:
>>>>
>>>>> Yeah this file is not there when we clone web2py... But I just check
>>>>> and it's there when you download web2py build from web2py.com...
>>>>>
>>>>> What's weird is that I didn't have the issue...
>>>>>
>>>>> Richard
>>>>>
>>>>> On Mon, Apr 23, 2018 at 12:39 PM, Carlos Cesar Caballero Díaz <
>>>>> carlos.caball...@cfg.jovenclub.cu> wrote:
>>>>>
>>>>>> Ok, I have found the issue:
>>>>>>
>>>>>> 
>>>>>> Traceback (most recent call last):
>>>>>>   File "/home/carlos.caballero/test/w2ptest/gluon/fileutils.py",
>>>>>> line 270, in create_welcome_w2p
>>>>>> os.unlink('NEWINSTALL')
>>>>>> FileNotFoundError: [Errno 2] No such file or directory: 'NEWINSTALL'
>>>>>> --------
>>>>>>
>>>>>> El 23/04/18 a las 11:48, Richard Vézina escribió:
>>>>>>
>>>>>> In gluon/fileutil.py
>>>>>>
>>>>>> Richard
>>>>>>
>>>>>> On Mon, Apr 23, 2018 at 11:47 AM, Richard Vézina <
>>>>>> ml.richard.vez...@gmail.com> wrote:
>>>>>>
>>>>>>> The python3 welcome.w2p creation issue??
>>>>>>>
>>>>>>> I think it a dependency issue that might be obufuscated by _compat.py
>>>>>>&

Re: [web2py] Re: web2py 2.16.1 is OUT

2018-04-24 Thread Richard Vézina
Also, to my understanding it only log an error, it no big deal, as long as
the welcome app package is there... What we could do it to log an error
when there is actually no welcome app pacakge as it break web2py
functionality other then that as long as the welcome package is there the
only issue is that it will be out dated which is not ideal, but might be
better then having a broken app creation utility...

I open an issue..

Richard

On Tue, Apr 24, 2018 at 11:09 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> Yes but even then, in the end you don't want to create a new welcome
> package if it not a new install as it gonna slow things down... So it will
> end slow down thing and always create an new welcome package, no??
>
> I would leave it like that and add a NEWINSTALL empty file in the
> repository...
>
> We definetly open an issue...
>
> Richard
>
> On Tue, Apr 24, 2018 at 8:51 AM, Carlos Cesar Caballero Díaz <
> carlos.caball...@cfg.jovenclub.cu> wrote:
>
>> I think we should check if the file exists before try to delete it.
>>
>> or move the unlik() function to a new "try-except" block, something like:
>>
>> if welcome.w2p is correctly created:
>>
>> try:
>>
>> os.unlink('NEWINSTALL')
>>
>> except FileNotFoundError:
>>
>> nothing to do
>>
>> except:
>>
>> error removing 'NEWINSTALL' file
>>
>>
>> Greetings.
>>
>> El 23/04/18 a las 13:33, Richard Vézina escribió:
>>
>> Actually it already inside a try... And it only logging an error...
>> Should this be an error or a warning?? I guess this is done for the
>> appadmin to allow it to create new app as it base on welcome... The welcome
>> template is provision at first web2py run once install and derived from the
>> welcome app...
>>
>> I guess it wouldn't be a good solution to track this NEWINSTALL file in
>> the repo, as it could trigger some other issue... But at the same time, if
>> you manage your web2py install with git, it might just make sens that
>> whenever you update your local repo, that this file get recreated and the
>> template being updated??
>>
>> Richard
>>
>> On Mon, Apr 23, 2018 at 1:28 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> I guess we could had a simple "try" there...
>>>
>>> Richard
>>>
>>> On Mon, Apr 23, 2018 at 1:26 PM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
>>>> Yeah this file is not there when we clone web2py... But I just check
>>>> and it's there when you download web2py build from web2py.com...
>>>>
>>>> What's weird is that I didn't have the issue...
>>>>
>>>> Richard
>>>>
>>>> On Mon, Apr 23, 2018 at 12:39 PM, Carlos Cesar Caballero Díaz <
>>>> carlos.caball...@cfg.jovenclub.cu> wrote:
>>>>
>>>>> Ok, I have found the issue:
>>>>>
>>>>> ----
>>>>> Traceback (most recent call last):
>>>>>   File "/home/carlos.caballero/test/w2ptest/gluon/fileutils.py", line
>>>>> 270, in create_welcome_w2p
>>>>> os.unlink('NEWINSTALL')
>>>>> FileNotFoundError: [Errno 2] No such file or directory: 'NEWINSTALL'
>>>>> 
>>>>>
>>>>> El 23/04/18 a las 11:48, Richard Vézina escribió:
>>>>>
>>>>> In gluon/fileutil.py
>>>>>
>>>>> Richard
>>>>>
>>>>> On Mon, Apr 23, 2018 at 11:47 AM, Richard Vézina <
>>>>> ml.richard.vez...@gmail.com> wrote:
>>>>>
>>>>>> The python3 welcome.w2p creation issue??
>>>>>>
>>>>>> I think it a dependency issue that might be obufuscated by _compat.py
>>>>>>
>>>>>> You can try to replace this line :
>>>>>>
>>>>>> w2p_pack('welcome.w2p', 'applications/welcome')
>>>>>>
>>>>>> By
>>>>>>
>>>>>> w2p_pack('welcome.w2p', 'applications', 'welcome')
>>>>>>
>>>>>> And report here if it help...
>>>>>>
>>>>>> Richard
>>>>>>
>>>>>> On Mon, Apr 23, 2018 at 11:42 AM, Carlos Cesar Caballero Díaz <
>>>>>>

Re: [web2py] Re: web2py 2.16.1 is OUT

2018-04-24 Thread Richard Vézina
Yes but even then, in the end you don't want to create a new welcome
package if it not a new install as it gonna slow things down... So it will
end slow down thing and always create an new welcome package, no??

I would leave it like that and add a NEWINSTALL empty file in the
repository...

We definetly open an issue...

Richard

On Tue, Apr 24, 2018 at 8:51 AM, Carlos Cesar Caballero Díaz <
carlos.caball...@cfg.jovenclub.cu> wrote:

> I think we should check if the file exists before try to delete it.
>
> or move the unlik() function to a new "try-except" block, something like:
>
> if welcome.w2p is correctly created:
>
> try:
>
> os.unlink('NEWINSTALL')
>
> except FileNotFoundError:
>
> nothing to do
>
> except:
>
> error removing 'NEWINSTALL' file
>
>
> Greetings.
>
> El 23/04/18 a las 13:33, Richard Vézina escribió:
>
> Actually it already inside a try... And it only logging an error... Should
> this be an error or a warning?? I guess this is done for the appadmin to
> allow it to create new app as it base on welcome... The welcome template is
> provision at first web2py run once install and derived from the welcome
> app...
>
> I guess it wouldn't be a good solution to track this NEWINSTALL file in
> the repo, as it could trigger some other issue... But at the same time, if
> you manage your web2py install with git, it might just make sens that
> whenever you update your local repo, that this file get recreated and the
> template being updated??
>
> Richard
>
> On Mon, Apr 23, 2018 at 1:28 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> I guess we could had a simple "try" there...
>>
>> Richard
>>
>> On Mon, Apr 23, 2018 at 1:26 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Yeah this file is not there when we clone web2py... But I just check and
>>> it's there when you download web2py build from web2py.com...
>>>
>>> What's weird is that I didn't have the issue...
>>>
>>> Richard
>>>
>>> On Mon, Apr 23, 2018 at 12:39 PM, Carlos Cesar Caballero Díaz <
>>> carlos.caball...@cfg.jovenclub.cu> wrote:
>>>
>>>> Ok, I have found the issue:
>>>>
>>>> 
>>>> Traceback (most recent call last):
>>>>   File "/home/carlos.caballero/test/w2ptest/gluon/fileutils.py", line
>>>> 270, in create_welcome_w2p
>>>> os.unlink('NEWINSTALL')
>>>> FileNotFoundError: [Errno 2] No such file or directory: 'NEWINSTALL'
>>>> 
>>>>
>>>> El 23/04/18 a las 11:48, Richard Vézina escribió:
>>>>
>>>> In gluon/fileutil.py
>>>>
>>>> Richard
>>>>
>>>> On Mon, Apr 23, 2018 at 11:47 AM, Richard Vézina <
>>>> ml.richard.vez...@gmail.com> wrote:
>>>>
>>>>> The python3 welcome.w2p creation issue??
>>>>>
>>>>> I think it a dependency issue that might be obufuscated by _compat.py
>>>>>
>>>>> You can try to replace this line :
>>>>>
>>>>> w2p_pack('welcome.w2p', 'applications/welcome')
>>>>>
>>>>> By
>>>>>
>>>>> w2p_pack('welcome.w2p', 'applications', 'welcome')
>>>>>
>>>>> And report here if it help...
>>>>>
>>>>> Richard
>>>>>
>>>>> On Mon, Apr 23, 2018 at 11:42 AM, Carlos Cesar Caballero Díaz <
>>>>> carlos.caball...@cfg.jovenclub.cu> wrote:
>>>>>
>>>>>> I have the same issue, using the current master branch in Ubuntu.
>>>>>>
>>>>>> Greetings.
>>>>>>
>>>>>> El 21/04/18 a las 08:21, Richard Vézina escribió:
>>>>>>
>>>>>> Actually I can't reproduced... It could it be a permission error??
>>>>>>
>>>>>> Try to clone it fresh some where you have full access with this
>>>>>> command :
>>>>>>
>>>>>> git clone --recursive https://github.com/web2py/web2py.git
>>>>>>
>>>>>> Then
>>>>>>
>>>>>> cd web2py
>>>>>> python3 web2py.py
>>>>>>
>>>>>> Enter password
>>>>>>
>>>>>

Re: [web2py] Multiple domains nginx/uwsgi?

2018-04-23 Thread Richard Vézina
The most complicated part is to properly craft the OpenSSL command to
properly get you SSL certificate to be signed, but if you use Lets Encrypt,
I guess it easier then... I answer an other thread recently with the
command that I had use for multiple subdomain certificate, that I had work
an lot of time to work around the issue existing at the time with OpenSSL
as there were some kind of bug that wasn't fix for a long time...

In uwsgi, you mostly go there only to tweak the config for performance...

If you use only one certificate for multiple subdomain and you are not the
only one using the sites, I guess you better read about how manage security
related to such kind of deployment.

Richard



On Mon, Apr 23, 2018 at 7:20 PM, pbreit  wrote:

> I was thinking something like that. I occasionally run across the uwsgi
> "vassals" thing and was wondering if I should be doing that.
>
> Just started using Lets Encrypt (with Digital Ocean HowTo) which seems to
> be working OK. Will see upon renewal. Thx.
>
> --
> 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] Multiple domains nginx/uwsgi?

2018-04-23 Thread Richard Vézina
It depends, are you going to have SSL certificates??, 1 or multiples?? If
you reuse the same I suggest  you configure your different site with
individual subdomain name and create a single certificate for all the
subdomain. If you have single certificate, so multiple certificate for same
IP, you will need to look on the side of SNI SSL cerficiates and how to
create those... Once the SSL part is done it pretty straigh foward to
configure nginx, you almost basically just copy/paste your server block and
adapt it with particular certificates locations and url parsing...

Richard

On Mon, Apr 23, 2018 at 3:36 PM, pbreit  wrote:

> What's the current advice on running multiple domains on one server having
> setup with this script:
> https://github.com/web2py/web2py/blob/master/scripts/
> setup-web2py-nginx-uwsgi-ubuntu.sh
>
> --
> 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] bulk update...

2018-04-23 Thread Richard Vézina
Note to my self : Yes it possible...

db(db.table.id > 0).update(field_to_be_updated=db.table.
some_other_table_field*db.table. 
another_table_field)

Doh!

Richard


On Mon, Apr 23, 2018 at 2:58 PM, Richard 
wrote:

> Hello,
>
> Do we (if not : could we) support this use case :
>
> db(db.table.id > 0).update(field_to_be_updated=some_other_table_field*
> another_table_field)
> db.commit()
>
> So we don't have to :
>
> rows = db(db.table.id > 0).select(db.table.ALL)
>
> for row in rows:
> db(db.table.id = row.id).update(...)
>
> ???
>
> Thanks
>
> Richard
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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: web2py 2.16.1 is OUT

2018-04-23 Thread Richard Vézina
Actually it already inside a try... And it only logging an error... Should
this be an error or a warning?? I guess this is done for the appadmin to
allow it to create new app as it base on welcome... The welcome template is
provision at first web2py run once install and derived from the welcome
app...

I guess it wouldn't be a good solution to track this NEWINSTALL file in the
repo, as it could trigger some other issue... But at the same time, if you
manage your web2py install with git, it might just make sens that whenever
you update your local repo, that this file get recreated and the template
being updated??

Richard

On Mon, Apr 23, 2018 at 1:28 PM, Richard Vézina <ml.richard.vez...@gmail.com
> wrote:

> I guess we could had a simple "try" there...
>
> Richard
>
> On Mon, Apr 23, 2018 at 1:26 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Yeah this file is not there when we clone web2py... But I just check and
>> it's there when you download web2py build from web2py.com...
>>
>> What's weird is that I didn't have the issue...
>>
>> Richard
>>
>> On Mon, Apr 23, 2018 at 12:39 PM, Carlos Cesar Caballero Díaz <
>> carlos.caball...@cfg.jovenclub.cu> wrote:
>>
>>> Ok, I have found the issue:
>>>
>>> 
>>> Traceback (most recent call last):
>>>   File "/home/carlos.caballero/test/w2ptest/gluon/fileutils.py", line
>>> 270, in create_welcome_w2p
>>> os.unlink('NEWINSTALL')
>>> FileNotFoundError: [Errno 2] No such file or directory: 'NEWINSTALL'
>>> --------
>>>
>>> El 23/04/18 a las 11:48, Richard Vézina escribió:
>>>
>>> In gluon/fileutil.py
>>>
>>> Richard
>>>
>>> On Mon, Apr 23, 2018 at 11:47 AM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
>>>> The python3 welcome.w2p creation issue??
>>>>
>>>> I think it a dependency issue that might be obufuscated by _compat.py
>>>>
>>>> You can try to replace this line :
>>>>
>>>> w2p_pack('welcome.w2p', 'applications/welcome')
>>>>
>>>> By
>>>>
>>>> w2p_pack('welcome.w2p', 'applications', 'welcome')
>>>>
>>>> And report here if it help...
>>>>
>>>> Richard
>>>>
>>>> On Mon, Apr 23, 2018 at 11:42 AM, Carlos Cesar Caballero Díaz <
>>>> carlos.caball...@cfg.jovenclub.cu> wrote:
>>>>
>>>>> I have the same issue, using the current master branch in Ubuntu.
>>>>>
>>>>> Greetings.
>>>>>
>>>>> El 21/04/18 a las 08:21, Richard Vézina escribió:
>>>>>
>>>>> Actually I can't reproduced... It could it be a permission error??
>>>>>
>>>>> Try to clone it fresh some where you have full access with this
>>>>> command :
>>>>>
>>>>> git clone --recursive https://github.com/web2py/web2py.git
>>>>>
>>>>> Then
>>>>>
>>>>> cd web2py
>>>>> python3 web2py.py
>>>>>
>>>>> Enter password
>>>>>
>>>>>
>>>>> Richard
>>>>>
>>>>> On Sat, Apr 21, 2018 at 8:01 AM, Richard Vézina <
>>>>> ml.richard.vez...@gmail.com> wrote:
>>>>>
>>>>>> Can you open an issue?
>>>>>>
>>>>>> I think it related to this : https://github.com/web2py/we
>>>>>> b2py/blob/fb4c114d85494ad6d79d69539adaae103d76e5ce/gluon/fil
>>>>>> eutils.py#L269
>>>>>>
>>>>>> Path string that has to be manipulated differently in python 3
>>>>>>
>>>>>> Explanation
>>>>>>
>>>>>> https://www.scivision.co/python-idiomatic-pathlib-use/
>>>>>>
>>>>>> On Fri, Apr 20, 2018 at 9:15 PM, lyn2py <lyn...@gmail.com> wrote:
>>>>>>
>>>>>>> I just git cloned the latest web2py and started it up with *python3*
>>>>>>> Version 2.16.1-stable+timestamp.2018.03.08.10.23.01
>>>>>>> Database drivers available: sqlite3, imaplib, pymysql, pyodbc
>>>>>>>
>>>>>>> I got this error in console
>>>>>>> ERROR:root:New in

Re: [web2py] Re: web2py 2.16.1 is OUT

2018-04-23 Thread Richard Vézina
I guess we could had a simple "try" there...

Richard

On Mon, Apr 23, 2018 at 1:26 PM, Richard Vézina <ml.richard.vez...@gmail.com
> wrote:

> Yeah this file is not there when we clone web2py... But I just check and
> it's there when you download web2py build from web2py.com...
>
> What's weird is that I didn't have the issue...
>
> Richard
>
> On Mon, Apr 23, 2018 at 12:39 PM, Carlos Cesar Caballero Díaz <
> carlos.caball...@cfg.jovenclub.cu> wrote:
>
>> Ok, I have found the issue:
>>
>> 
>> Traceback (most recent call last):
>>   File "/home/carlos.caballero/test/w2ptest/gluon/fileutils.py", line
>> 270, in create_welcome_w2p
>> os.unlink('NEWINSTALL')
>> FileNotFoundError: [Errno 2] No such file or directory: 'NEWINSTALL'
>> 
>>
>> El 23/04/18 a las 11:48, Richard Vézina escribió:
>>
>> In gluon/fileutil.py
>>
>> Richard
>>
>> On Mon, Apr 23, 2018 at 11:47 AM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> The python3 welcome.w2p creation issue??
>>>
>>> I think it a dependency issue that might be obufuscated by _compat.py
>>>
>>> You can try to replace this line :
>>>
>>> w2p_pack('welcome.w2p', 'applications/welcome')
>>>
>>> By
>>>
>>> w2p_pack('welcome.w2p', 'applications', 'welcome')
>>>
>>> And report here if it help...
>>>
>>> Richard
>>>
>>> On Mon, Apr 23, 2018 at 11:42 AM, Carlos Cesar Caballero Díaz <
>>> carlos.caball...@cfg.jovenclub.cu> wrote:
>>>
>>>> I have the same issue, using the current master branch in Ubuntu.
>>>>
>>>> Greetings.
>>>>
>>>> El 21/04/18 a las 08:21, Richard Vézina escribió:
>>>>
>>>> Actually I can't reproduced... It could it be a permission error??
>>>>
>>>> Try to clone it fresh some where you have full access with this command
>>>> :
>>>>
>>>> git clone --recursive https://github.com/web2py/web2py.git
>>>>
>>>> Then
>>>>
>>>> cd web2py
>>>> python3 web2py.py
>>>>
>>>> Enter password
>>>>
>>>>
>>>> Richard
>>>>
>>>> On Sat, Apr 21, 2018 at 8:01 AM, Richard Vézina <
>>>> ml.richard.vez...@gmail.com> wrote:
>>>>
>>>>> Can you open an issue?
>>>>>
>>>>> I think it related to this : https://github.com/web2py/we
>>>>> b2py/blob/fb4c114d85494ad6d79d69539adaae103d76e5ce/gluon/fil
>>>>> eutils.py#L269
>>>>>
>>>>> Path string that has to be manipulated differently in python 3
>>>>>
>>>>> Explanation
>>>>>
>>>>> https://www.scivision.co/python-idiomatic-pathlib-use/
>>>>>
>>>>> On Fri, Apr 20, 2018 at 9:15 PM, lyn2py <lyn...@gmail.com> wrote:
>>>>>
>>>>>> I just git cloned the latest web2py and started it up with *python3*
>>>>>> Version 2.16.1-stable+timestamp.2018.03.08.10.23.01
>>>>>> Database drivers available: sqlite3, imaplib, pymysql, pyodbc
>>>>>>
>>>>>> I got this error in console
>>>>>> ERROR:root:New installation error: unable to create welcome.w2p file
>>>>>>
>>>>>> When I quit the python server and restart with python2 or python3,
>>>>>> the error does not come up anymore.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Tuesday, November 14, 2017 at 1:59:52 PM UTC+8, Massimo Di Pierro
>>>>>> wrote:
>>>>>>>
>>>>>>> web2py 2.16.1 is OUT
>>>>>>>
>>>>>>> Lots of bugs fixes contributed by the community. Thanks Leonel,
>>>>>>> Paolo, Giovanni, and all those who contributed.
>>>>>>>
>>>>>>> the most visible changes are:
>>>>>>>
>>>>>>> - welcome now defaults to bootstrap 4
>>>>>>> - lots of cleanup in the welcome app and new examples in default.py
>>>>>>> - simplified layout.html
>>>>>>>
>>>>>>> Massimo
>>>>>>

Re: [web2py] Re: web2py 2.16.1 is OUT

2018-04-23 Thread Richard Vézina
Yeah this file is not there when we clone web2py... But I just check and
it's there when you download web2py build from web2py.com...

What's weird is that I didn't have the issue...

Richard

On Mon, Apr 23, 2018 at 12:39 PM, Carlos Cesar Caballero Díaz <
carlos.caball...@cfg.jovenclub.cu> wrote:

> Ok, I have found the issue:
>
> 
> Traceback (most recent call last):
>   File "/home/carlos.caballero/test/w2ptest/gluon/fileutils.py", line
> 270, in create_welcome_w2p
> os.unlink('NEWINSTALL')
> FileNotFoundError: [Errno 2] No such file or directory: 'NEWINSTALL'
> --------
>
> El 23/04/18 a las 11:48, Richard Vézina escribió:
>
> In gluon/fileutil.py
>
> Richard
>
> On Mon, Apr 23, 2018 at 11:47 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> The python3 welcome.w2p creation issue??
>>
>> I think it a dependency issue that might be obufuscated by _compat.py
>>
>> You can try to replace this line :
>>
>> w2p_pack('welcome.w2p', 'applications/welcome')
>>
>> By
>>
>> w2p_pack('welcome.w2p', 'applications', 'welcome')
>>
>> And report here if it help...
>>
>> Richard
>>
>> On Mon, Apr 23, 2018 at 11:42 AM, Carlos Cesar Caballero Díaz <
>> carlos.caball...@cfg.jovenclub.cu> wrote:
>>
>>> I have the same issue, using the current master branch in Ubuntu.
>>>
>>> Greetings.
>>>
>>> El 21/04/18 a las 08:21, Richard Vézina escribió:
>>>
>>> Actually I can't reproduced... It could it be a permission error??
>>>
>>> Try to clone it fresh some where you have full access with this command
>>> :
>>>
>>> git clone --recursive https://github.com/web2py/web2py.git
>>>
>>> Then
>>>
>>> cd web2py
>>> python3 web2py.py
>>>
>>> Enter password
>>>
>>>
>>> Richard
>>>
>>> On Sat, Apr 21, 2018 at 8:01 AM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
>>>> Can you open an issue?
>>>>
>>>> I think it related to this : https://github.com/web2py/we
>>>> b2py/blob/fb4c114d85494ad6d79d69539adaae103d76e5ce/gluon/fil
>>>> eutils.py#L269
>>>>
>>>> Path string that has to be manipulated differently in python 3
>>>>
>>>> Explanation
>>>>
>>>> https://www.scivision.co/python-idiomatic-pathlib-use/
>>>>
>>>> On Fri, Apr 20, 2018 at 9:15 PM, lyn2py <lyn...@gmail.com> wrote:
>>>>
>>>>> I just git cloned the latest web2py and started it up with *python3*
>>>>> Version 2.16.1-stable+timestamp.2018.03.08.10.23.01
>>>>> Database drivers available: sqlite3, imaplib, pymysql, pyodbc
>>>>>
>>>>> I got this error in console
>>>>> ERROR:root:New installation error: unable to create welcome.w2p file
>>>>>
>>>>> When I quit the python server and restart with python2 or python3, the
>>>>> error does not come up anymore.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Tuesday, November 14, 2017 at 1:59:52 PM UTC+8, Massimo Di Pierro
>>>>> wrote:
>>>>>>
>>>>>> web2py 2.16.1 is OUT
>>>>>>
>>>>>> Lots of bugs fixes contributed by the community. Thanks Leonel,
>>>>>> Paolo, Giovanni, and all those who contributed.
>>>>>>
>>>>>> the most visible changes are:
>>>>>>
>>>>>> - welcome now defaults to bootstrap 4
>>>>>> - lots of cleanup in the welcome app and new examples in default.py
>>>>>> - simplified layout.html
>>>>>>
>>>>>> Massimo
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>> 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, sen

Re: [web2py] Re: web2py 2.16.1 is OUT

2018-04-23 Thread Richard Vézina
In gluon/fileutil.py

Richard

On Mon, Apr 23, 2018 at 11:47 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> The python3 welcome.w2p creation issue??
>
> I think it a dependency issue that might be obufuscated by _compat.py
>
> You can try to replace this line :
>
> w2p_pack('welcome.w2p', 'applications/welcome')
>
> By
>
> w2p_pack('welcome.w2p', 'applications', 'welcome')
>
> And report here if it help...
>
> Richard
>
> On Mon, Apr 23, 2018 at 11:42 AM, Carlos Cesar Caballero Díaz <
> carlos.caball...@cfg.jovenclub.cu> wrote:
>
>> I have the same issue, using the current master branch in Ubuntu.
>>
>> Greetings.
>>
>> El 21/04/18 a las 08:21, Richard Vézina escribió:
>>
>> Actually I can't reproduced... It could it be a permission error??
>>
>> Try to clone it fresh some where you have full access with this command :
>>
>> git clone --recursive https://github.com/web2py/web2py.git
>>
>> Then
>>
>> cd web2py
>> python3 web2py.py
>>
>> Enter password
>>
>>
>> Richard
>>
>> On Sat, Apr 21, 2018 at 8:01 AM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Can you open an issue?
>>>
>>> I think it related to this : https://github.com/web2py/we
>>> b2py/blob/fb4c114d85494ad6d79d69539adaae103d76e5ce/gluon/fil
>>> eutils.py#L269
>>>
>>> Path string that has to be manipulated differently in python 3
>>>
>>> Explanation
>>>
>>> https://www.scivision.co/python-idiomatic-pathlib-use/
>>>
>>> On Fri, Apr 20, 2018 at 9:15 PM, lyn2py <lyn...@gmail.com> wrote:
>>>
>>>> I just git cloned the latest web2py and started it up with *python3*
>>>> Version 2.16.1-stable+timestamp.2018.03.08.10.23.01
>>>> Database drivers available: sqlite3, imaplib, pymysql, pyodbc
>>>>
>>>> I got this error in console
>>>> ERROR:root:New installation error: unable to create welcome.w2p file
>>>>
>>>> When I quit the python server and restart with python2 or python3, the
>>>> error does not come up anymore.
>>>>
>>>>
>>>>
>>>>
>>>> On Tuesday, November 14, 2017 at 1:59:52 PM UTC+8, Massimo Di Pierro
>>>> wrote:
>>>>>
>>>>> web2py 2.16.1 is OUT
>>>>>
>>>>> Lots of bugs fixes contributed by the community. Thanks Leonel, Paolo,
>>>>> Giovanni, and all those who contributed.
>>>>>
>>>>> the most visible changes are:
>>>>>
>>>>> - welcome now defaults to bootstrap 4
>>>>> - lots of cleanup in the welcome app and new examples in default.py
>>>>> - simplified layout.html
>>>>>
>>>>> Massimo
>>>>>
>>>>>
>>>>>
>>>>> --
>>>> Resources:
>>>> - http://web2py.com
>>>> - http://web2py.com/book (Documentation)
>>>> - http://github.com/web2py/web2py (Source code)
>>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "web2py-users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to web2py+unsubscr...@googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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: web2py 2.16.1 is OUT

2018-04-23 Thread Richard Vézina
The python3 welcome.w2p creation issue??

I think it a dependency issue that might be obufuscated by _compat.py

You can try to replace this line :

w2p_pack('welcome.w2p', 'applications/welcome')

By

w2p_pack('welcome.w2p', 'applications', 'welcome')

And report here if it help...

Richard

On Mon, Apr 23, 2018 at 11:42 AM, Carlos Cesar Caballero Díaz <
carlos.caball...@cfg.jovenclub.cu> wrote:

> I have the same issue, using the current master branch in Ubuntu.
>
> Greetings.
>
> El 21/04/18 a las 08:21, Richard Vézina escribió:
>
> Actually I can't reproduced... It could it be a permission error??
>
> Try to clone it fresh some where you have full access with this command :
>
> git clone --recursive https://github.com/web2py/web2py.git
>
> Then
>
> cd web2py
> python3 web2py.py
>
> Enter password
>
>
> Richard
>
> On Sat, Apr 21, 2018 at 8:01 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Can you open an issue?
>>
>> I think it related to this : https://github.com/web2py/we
>> b2py/blob/fb4c114d85494ad6d79d69539adaae103d76e5ce/gluon/
>> fileutils.py#L269
>>
>> Path string that has to be manipulated differently in python 3
>>
>> Explanation
>>
>> https://www.scivision.co/python-idiomatic-pathlib-use/
>>
>> On Fri, Apr 20, 2018 at 9:15 PM, lyn2py <lyn...@gmail.com> wrote:
>>
>>> I just git cloned the latest web2py and started it up with *python3*
>>> Version 2.16.1-stable+timestamp.2018.03.08.10.23.01
>>> Database drivers available: sqlite3, imaplib, pymysql, pyodbc
>>>
>>> I got this error in console
>>> ERROR:root:New installation error: unable to create welcome.w2p file
>>>
>>> When I quit the python server and restart with python2 or python3, the
>>> error does not come up anymore.
>>>
>>>
>>>
>>>
>>> On Tuesday, November 14, 2017 at 1:59:52 PM UTC+8, Massimo Di Pierro
>>> wrote:
>>>>
>>>> web2py 2.16.1 is OUT
>>>>
>>>> Lots of bugs fixes contributed by the community. Thanks Leonel, Paolo,
>>>> Giovanni, and all those who contributed.
>>>>
>>>> the most visible changes are:
>>>>
>>>> - welcome now defaults to bootstrap 4
>>>> - lots of cleanup in the welcome app and new examples in default.py
>>>> - simplified layout.html
>>>>
>>>> Massimo
>>>>
>>>>
>>>>
>>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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: web2py 2.16.1 is OUT

2018-04-21 Thread Richard Vézina
Actually I can't reproduced... It could it be a permission error??

Try to clone it fresh some where you have full access with this command :

git clone --recursive https://github.com/web2py/web2py.git

Then

cd web2py
python3 web2py.py

Enter password


Richard

On Sat, Apr 21, 2018 at 8:01 AM, Richard Vézina <ml.richard.vez...@gmail.com
> wrote:

> Can you open an issue?
>
> I think it related to this : https://github.com/web2py/web2py/blob/
> fb4c114d85494ad6d79d69539adaae103d76e5ce/gluon/fileutils.py#L269
>
> Path string that has to be manipulated differently in python 3
>
> Explanation
>
> https://www.scivision.co/python-idiomatic-pathlib-use/
>
> On Fri, Apr 20, 2018 at 9:15 PM, lyn2py <lyn...@gmail.com> wrote:
>
>> I just git cloned the latest web2py and started it up with *python3*
>> Version 2.16.1-stable+timestamp.2018.03.08.10.23.01
>> Database drivers available: sqlite3, imaplib, pymysql, pyodbc
>>
>> I got this error in console
>> ERROR:root:New installation error: unable to create welcome.w2p file
>>
>> When I quit the python server and restart with python2 or python3, the
>> error does not come up anymore.
>>
>>
>>
>>
>> On Tuesday, November 14, 2017 at 1:59:52 PM UTC+8, Massimo Di Pierro
>> wrote:
>>>
>>> web2py 2.16.1 is OUT
>>>
>>> Lots of bugs fixes contributed by the community. Thanks Leonel, Paolo,
>>> Giovanni, and all those who contributed.
>>>
>>> the most visible changes are:
>>>
>>> - welcome now defaults to bootstrap 4
>>> - lots of cleanup in the welcome app and new examples in default.py
>>> - simplified layout.html
>>>
>>> Massimo
>>>
>>>
>>>
>>> --
>> 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: web2py 2.16.1 is OUT

2018-04-21 Thread Richard Vézina
Can you open an issue?

I think it related to this :
https://github.com/web2py/web2py/blob/fb4c114d85494ad6d79d69539adaae103d76e5ce/gluon/fileutils.py#L269

Path string that has to be manipulated differently in python 3

Explanation

https://www.scivision.co/python-idiomatic-pathlib-use/

On Fri, Apr 20, 2018 at 9:15 PM, lyn2py  wrote:

> I just git cloned the latest web2py and started it up with *python3*
> Version 2.16.1-stable+timestamp.2018.03.08.10.23.01
> Database drivers available: sqlite3, imaplib, pymysql, pyodbc
>
> I got this error in console
> ERROR:root:New installation error: unable to create welcome.w2p file
>
> When I quit the python server and restart with python2 or python3, the
> error does not come up anymore.
>
>
>
>
> On Tuesday, November 14, 2017 at 1:59:52 PM UTC+8, Massimo Di Pierro wrote:
>>
>> web2py 2.16.1 is OUT
>>
>> Lots of bugs fixes contributed by the community. Thanks Leonel, Paolo,
>> Giovanni, and all those who contributed.
>>
>> the most visible changes are:
>>
>> - welcome now defaults to bootstrap 4
>> - lots of cleanup in the welcome app and new examples in default.py
>> - simplified layout.html
>>
>> Massimo
>>
>>
>>
>> --
> 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] IS_DECIMAL_IN_RANGE

2018-04-21 Thread Richard Vézina
I hear you and I agree about that... I am just supprise that we have no
control over rouding of what goes in the database as it is very critical in
some use case with weird rounding spec that you could have in academic
sometime for instance.

At some point I had extend field "length" to 10 places that way I was not
having to refactor fields parameters as client change of idea and just
round the data at retrieving so it might be the way to go about that.

This is as easy as :

represent=lambda value, row: '{0:.2f}'.format(value) if value else T('N/A')

It could might be more efficient if we configure it at Decimal quantize
level, but I think you have to maniuplate it for each field so it might
come to the same computing resource required.

Richard

On Fri, Apr 20, 2018 at 3:29 PM, Anthony  wrote:

> On Friday, April 20, 2018 at 3:06:59 PM UTC-4, Richard wrote:
>>
>> It maybe just me, but I kind of think that if my models says decimal(10,
>> 2) it means that I don't want to store more than 2 places... Since my
>> models should behave like the database table and column as they are just an
>> abstraction of the later...
>>
>
> Well, if you let the DAL create the table in the database, then you do get
> values with the specified number of places. If not, there is nothing web2py
> can do to affect what is stored in the database. I suppose web2py could
> round the data once selected from the database. Maybe submit a Github issue.
>
> 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.
>

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

2018-04-20 Thread Richard Vézina
It maybe just me, but I kind of think that if my models says decimal(10, 2)
it means that I don't want to store more than 2 places... Since my models
should behave like the database table and column as they are just an
abstraction of the later...

I know web2py offer alot of granularity control and flexibility over all
this aspect, but I feel that there is a missing component to handle this
particular aspect (rounding and enforcing "length" of numeric fields).

Richard

On Fri, Apr 20, 2018 at 2:59 PM, Anthony  wrote:

> On Friday, April 20, 2018 at 2:36:58 PM UTC-4, Richard wrote:
>>
>> It appears that it get silently "cropped/rounded" by the backend field
>> type configuration... If I have field with 2 places in the backend and 3
>> places defined in the models and input 0.647, it will be stored as 0.65.
>>
>> Do we have control over the rounding in web2py or it configure in the
>> database engine??
>>
>
> web2py has no control over what the database does (other than its ability
> to initially define the precision of the database column if web2py is used
> for a migration to create the database table). So, first make sure your
> database column is defined with the decimal precision you want.
>
> On the web2py side, you can control the precision of the inputs however
> you want -- web2py will simply pass those inputs to the database.
>
> 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.
>

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

2018-04-20 Thread Richard Vézina
There seems to have some thing related to gae :
https://github.com/web2py/pydal/blob/a7b7e4c11604d0b8b2de46e832469b78bfd7a1cf/pydal/helpers/gae.py#L16

I guess custom validator with quantize decimal parameters would do it.

I recall having use that for report porpuses, but was on the impression
that web2py was validating places... But it clearly not doing it anymore

Richard

On Fri, Apr 20, 2018 at 2:55 PM, Anthony  wrote:

> On Friday, April 20, 2018 at 2:30:22 PM UTC-4, Richard wrote:
>>
>> Realize that, though I am sure it use to managed it...
>>
>
> Not going back to at least web2py 2.02, as far as I can tell.
>
>
>> Anyway, I find it curious that even if I have field of type decimal(10,
>> 2) for instance, if I insert 1.304, and submit the form it ends up with
>> 1.304 in the read form (backend has 3 places).
>>
>
> As far as I can tell, the decimal specification in the "type" argument to
> Field() is used only for migrations -- that is, when the DAL is creating
> the column in the database. If the backend is pre-existing with 3 decimal
> places and the DAL does not run any migrations, then the decimal
> specification will have no effect. It is not used for transforming input or
> output.
>
>
>> How do we validated the number of places??
>>
>
> You could create a custom validator. If the inputs are strings, you'll
> have to count the number of digits after the decimal point. If the inputs
> are Decimal objects, value.as_tuple().exponent will give you the
> significant digits (as a negative number).
>
> 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.
>

-- 
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] web2py, nginx and big files

2018-04-20 Thread Richard Vézina
You seems to have found good information...

I don't have much time to investigate that subject and realize it could be
quite complexe...

And involve security issue :
https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/


Although, I thought that you might have a read that code base of apps like
these listing :

https://opensource.com/life/15/12/5-open-source-web-apps-self-hosted

This kind of apps surely had to workaround large file issue that you have...

Richard

On Fri, Apr 20, 2018 at 10:39 AM, Carlos Cesar Caballero Díaz <
carlos.caball...@cfg.jovenclub.cu> wrote:

>
> El 19/04/18 a las 16:21, Richard Vézina escribió:
>
> Ah ok, make sens then. Are you storing the file in database or on file
> system at web2py level??
>
>
>
> In the file system, I think that storing big (or so many) files in the
> database can overload it.
>
>
> There is surely a way to make the copy only once at the right place, but I
> am pretty sure it mean writting some customization at uwsgi level and most
> probably some conf in nginx to bypass it usual mechanism.
>
>
> I have being reading and found this https://stackoverflow.com/a/
> 44751210/1818267 its interesting, besides it carries some new issues to
> solve.
>
>
> I try to make some research and get back to you if I can fin anything that
> could help.
>
> Good luck
>
>
> Thanks, I'll be very grateful (more grateful :D).
>
> Greetings
>
>
> Richard
>
> On Wed, Apr 18, 2018 at 10:37 PM, Carlos Cesar Caballero Díaz <
> carlos.caball...@cfg.jovenclub.cu> wrote:
>
>>
>> El 18/04/18 a las 13:54, Richard Vézina escribió:
>>
>> That big... Hope it could work for you...
>>
>>
>> Well, right now is working with your suggestion, but not perfect, is
>> really slow because nginx uploads the file to a tmp file, next seems to
>> copy the file to another place (I assume to uwsgi) and next is copied to
>> web2py uploads, really annoying. I think that there should be a better way
>> to do that.
>>
>>
>> Are you trying to make El packet transiting the island faster or what...
>>
>> :D
>>
>>
>> Not exactly, but I like how you think :D
>>
>> I am working with Joven Club, a "company" that provides technical and
>> learning services throughout the country, and I am building a tool for
>> helping with the software installation service, it's really simple,
>> basically a software installers repository where people can search and
>> download (and certain people upload the files, of course).
>>
>>
>>
>> Richard
>>
>> On Wed, Apr 18, 2018 at 1:45 PM, Carlos Cesar Caballero Díaz <
>> carlos.caball...@cfg.jovenclub.cu> wrote:
>>
>>> Thanks Richard, It seems to be working now. The files can be several
>>> Gigabytes.
>>>
>>>
>>> Greetings.
>>>
>>> El 17/04/18 a las 13:10, Richard Vézina escribió:
>>>
>>> How big?
>>>
>>> https://www.bookstackapp.com/docs/admin/upload-limits/
>>>
>>> https://www.nginx.com/resources/wiki/modules/upload/#upload-
>>> max-file-size
>>>
>>> Quote from the above link:
>>> For “hard” limit client_max_body_size directive must be used. The value
>>> of zero for this directive specifies that no restrictions on file size
>>> should be applied.
>>>
>>>
>>> Have a look at your nginx config upload_max_file_size and
>>> client_max_body_size
>>>
>>> I can't find the default nginx limit, but I think upload are around 5
>>> mg, I recall having issue long time ago about upload limit and the
>>> attachement was a little over 5 meg, so...
>>>
>>> In the link you provide there not seems to have limit overriding
>>> default, so my guess is that your file is bigger than the
>>> client_max_body_size
>>>
>>> Good luck
>>>
>>> Richard
>>>
>>> On Tue, Apr 17, 2018 at 12:10 PM, Carlos Cesar Caballero Díaz <
>>> carlos.caball...@cfg.jovenclub.cu> wrote:
>>>
>>>> Hi, I have a web2py + nginx setup (https://github.com/arisobel/w
>>>> eb2py_scripts/blob/master/setup-web2py-nginx-p3-uwsgi-ubuntu.sh) and I
>>>> need to upload big files to my application, the app is working ok with the
>>>> built in server, but with nginx the form submission fails with no response
>>>> when there are big files.
>>>>
>>>> Any tip for solving this?
>>>>
>>>>
>>>> Greetings.
>>>>

Re: [web2py] IS_DECIMAL_IN_RANGE

2018-04-20 Thread Richard Vézina
It appears that it get silently "cropped/rounded" by the backend field type
configuration... If I have field with 2 places in the backend and 3 places
defined in the models and input 0.647, it will be stored as 0.65.

Do we have control over the rounding in web2py or it configure in the
database engine??

Richard

On Fri, Apr 20, 2018 at 2:30 PM, Richard Vézina <ml.richard.vez...@gmail.com
> wrote:

> Realize that, though I am sure it use to managed it...
>
> Anyway, I find it curious that even if I have field of type decimal(10, 2)
> for instance, if I insert 1.304, and submit the form it ends up with 1.304
> in the read form (backend has 3 places).
>
> How do we validated the number of places??
>
> Richard
>
> On Fri, Apr 20, 2018 at 11:32 AM, Anthony <abasta...@gmail.com> wrote:
>
>> On Friday, April 20, 2018 at 9:38:47 AM UTC-4, Richard wrote:
>>>
>>> Hello,
>>>
>>> I was under the impression that IS_DECIMAL_IN_RANGE(2.25, 5.25) would
>>> validate and prevent input having more places the number of places of min
>>> and max...
>>>
>>
>> No, it just ensures that the value is greater than or equal to the min
>> and less than or equal to the max. This validator has nothing to do with
>> the number of decimal places.
>>
>> 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.
>>
>
>

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

2018-04-20 Thread Richard Vézina
Realize that, though I am sure it use to managed it...

Anyway, I find it curious that even if I have field of type decimal(10, 2)
for instance, if I insert 1.304, and submit the form it ends up with 1.304
in the read form (backend has 3 places).

How do we validated the number of places??

Richard

On Fri, Apr 20, 2018 at 11:32 AM, Anthony  wrote:

> On Friday, April 20, 2018 at 9:38:47 AM UTC-4, Richard wrote:
>>
>> Hello,
>>
>> I was under the impression that IS_DECIMAL_IN_RANGE(2.25, 5.25) would
>> validate and prevent input having more places the number of places of min
>> and max...
>>
>
> No, it just ensures that the value is greater than or equal to the min and
> less than or equal to the max. This validator has nothing to do with the
> number of decimal places.
>
> 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.
>

-- 
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: SSL database connections

2018-04-19 Thread Richard Vézina
It much easier to make ssh port fowarding remote 5432 to local 5433 for
instance and then configure pgadmin to use the local port, everything goes
to ssh tunnel between you and the server...

ssh -L 5433:127.0.0.1:5432 your_user@remote_ip_or_dns

Richard

On Thu, Apr 19, 2018 at 1:47 PM,  wrote:

>
> How can someone get the .crt and .key files from the .pem files? Will this
> work for connecting to a remote DB stored on google cloud?
>
> On Monday, June 27, 2016 at 7:02:31 AM UTC-4, Dragan Matic wrote:
>>
>> Thanks Massimo, just in case anybody has the same problem, this is the
>> full syntax for connecting in ssl mode:
>>
>> DAL('postgres://postgres:password@server_addr/db_name
>> ',
>> driver_args={"sslmode":"require", "sslrootcert":"root.crt", "sslcert":
>> "postgresql.crt", "sslkey":"postgresql.key"})
>>
>> where sslrootcert, sslcert and sslkey must contain the full paths to the
>> files.
>>
>> On Sunday, June 26, 2016 at 7:21:43 AM UTC+2, Massimo Di Pierro wrote:
>>>
>>> you use postgres you can do:
>>>
>>> db = DAL(., driver_args=dict(sslmode="require"))
>>>
>>> should work fine. I do not know of other engines that support it but
>>> there is always a way to tell the driver.
>>>
>>> On Friday, 24 June 2016 05:53:37 UTC-5, Dragan Matic wrote:

 Has there been any progress in connecting through SSL with DAL?
 Searching chapter 6 (DAL) of the web2py book for "ssl" or "secure" does not
 find anything.


 On Sunday, August 23, 2009 at 6:01:11 PM UTC+2, mdipierro wrote:
>
> We do not support that but now that I know it should be easy to add.
> We will add it in the next version.
>
> Please help us test it. Edit gluon.sql.py and change
>
> msg = \
> "dbname='%s' user='%s' host='%s' port=%s
> password='%s'"\
>  % (db, user, host, port, passwd)
> self._pool_connection(lambda : psycopg2.connect(msg))
>
>
> with
>
> msg = \
> "dbname='%s' user='%s' host='%s' port=%s password='%s'
> sslmode='require'"\
>  % (db, user, host, port, passwd)
> self._pool_connection(lambda : psycopg2.connect(msg))
>
> does it work?
>
> Massimo
>
> On Aug 23, 10:57 am, Don Lee  wrote:
> > Yes.  PostgreSQL allows for an SSL connection between the client and
> the
> > server.  This can be done with psycopg2, for example:
> >
> > import psycopg2 as database
> > db = database.connect (host="db.host.com",
> >  sslmode="require",
> >  database="dbname",
> >  user="dbuser",
> >  password="dbpass")
> >
> > On Sun, Aug 23, 2009 at 10:04 AM, mdipierro 
> wrote:
> >
> > > Then I do not understand what you mean by "secure connection". Is
> > > there a secure connection function provided by postgresql and
> psycopg2
> > > that web2py is not using and should be using?
> >
> > > Massimo
> >
> > > On Aug 23, 8:14 am, Don  wrote:
> > > > I do not have SSH access to the DB server.  Can I use psycopg2
> > > > directly to create the connection?
> >
> > > > On Aug 23, 8:59 am, mdipierro  wrote:
> >
> > > > > Yes but not this way.
> > > > > You have to open an ssh tunner outside web2py and then
> instruct web2py
> > > > > to connect to the database using the port used by the tunnel.
> >
> > > > > Massimo
> >
> > > > > On Aug 23, 7:47 am, Don  wrote:
> >
> > > > > > Is it possible to define a secure database connection?
> >
> > > > > > Ex: db = DAL(‘postgres://user:password@hostname/db’,
> pools=10,
> > > > > > secure=True)
> >
> > > > > > My production DB and web servers are running on a different
> machines.

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

Re: [web2py] web2py, nginx and big files

2018-04-19 Thread Richard Vézina
Ah ok, make sens then. Are you storing the file in database or on file
system at web2py level??

There is surely a way to make the copy only once at the right place, but I
am pretty sure it mean writting some customization at uwsgi level and most
probably some conf in nginx to bypass it usual mechanism.

I try to make some research and get back to you if I can fin anything that
could help.

Good luck

Richard

On Wed, Apr 18, 2018 at 10:37 PM, Carlos Cesar Caballero Díaz <
carlos.caball...@cfg.jovenclub.cu> wrote:

>
> El 18/04/18 a las 13:54, Richard Vézina escribió:
>
> That big... Hope it could work for you...
>
>
> Well, right now is working with your suggestion, but not perfect, is
> really slow because nginx uploads the file to a tmp file, next seems to
> copy the file to another place (I assume to uwsgi) and next is copied to
> web2py uploads, really annoying. I think that there should be a better way
> to do that.
>
>
> Are you trying to make El packet transiting the island faster or what...
>
> :D
>
>
> Not exactly, but I like how you think :D
>
> I am working with Joven Club, a "company" that provides technical and
> learning services throughout the country, and I am building a tool for
> helping with the software installation service, it's really simple,
> basically a software installers repository where people can search and
> download (and certain people upload the files, of course).
>
>
>
> Richard
>
> On Wed, Apr 18, 2018 at 1:45 PM, Carlos Cesar Caballero Díaz <
> carlos.caball...@cfg.jovenclub.cu> wrote:
>
>> Thanks Richard, It seems to be working now. The files can be several
>> Gigabytes.
>>
>>
>> Greetings.
>>
>> El 17/04/18 a las 13:10, Richard Vézina escribió:
>>
>> How big?
>>
>> https://www.bookstackapp.com/docs/admin/upload-limits/
>>
>> https://www.nginx.com/resources/wiki/modules/upload/#upload-max-file-size
>>
>> Quote from the above link:
>> For “hard” limit client_max_body_size directive must be used. The value
>> of zero for this directive specifies that no restrictions on file size
>> should be applied.
>>
>>
>> Have a look at your nginx config upload_max_file_size and
>> client_max_body_size
>>
>> I can't find the default nginx limit, but I think upload are around 5 mg,
>> I recall having issue long time ago about upload limit and the attachement
>> was a little over 5 meg, so...
>>
>> In the link you provide there not seems to have limit overriding default,
>> so my guess is that your file is bigger than the client_max_body_size
>>
>> Good luck
>>
>> Richard
>>
>> On Tue, Apr 17, 2018 at 12:10 PM, Carlos Cesar Caballero Díaz <
>> carlos.caball...@cfg.jovenclub.cu> wrote:
>>
>>> Hi, I have a web2py + nginx setup (https://github.com/arisobel/w
>>> eb2py_scripts/blob/master/setup-web2py-nginx-p3-uwsgi-ubuntu.sh) and I
>>> need to upload big files to my application, the app is working ok with the
>>> built in server, but with nginx the form submission fails with no response
>>> when there are big files.
>>>
>>> Any tip for solving this?
>>>
>>>
>>> Greetings.
>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> --- You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>

Re: [web2py] Nginx + SSL certificates for two different apps

2018-04-18 Thread Richard Vézina
Here  how I achieved it with openssl :

openssl req -new -days 730 -sha256 -key NAME.key -subj "/.../CN=*.
DOMAIN.COM/emailAddress=yourem...@domain.com" -reqexts SAN -config <(cat
/etc/ssl/openssl.cnf <(printf "[SAN]\nsubjectAltName=DNS:sub1.DOMAIN.COM
,DNS:sub2.DOMAIN.COM,DNS:sub3.DOMAIN.COM,DNS:sub4.DOMAIN.COM,DNS:
sub5.DOMAIN.COM")) -out NAME.csr

It SAN :

https://www.digicert.com/subject-alternative-name.htm

I recall that other command were not working for some reasons that I forgot
about. The usual command wasn't working and it finally work with the
above...

Good luck

On Wed, Apr 18, 2018 at 2:00 PM, Richard Vézina <ml.richard.vez...@gmail.com
> wrote:

> You have to use multiple subdomain certificate...
>
> Look at SNI certificate configuration...
>
> I will have a look at how I achieve that.
>
> On Wed, Apr 18, 2018 at 6:16 AM, dirman <anc...@gmail.com> wrote:
>
>> I need help setting two SSL certificates for two different apps on one
>> instance of web2py.
>> kindly include the config file if you can help me.
>>
>> --
>> 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] Nginx + SSL certificates for two different apps

2018-04-18 Thread Richard Vézina
You have to use multiple subdomain certificate...

Look at SNI certificate configuration...

I will have a look at how I achieve that.

On Wed, Apr 18, 2018 at 6:16 AM, dirman  wrote:

> I need help setting two SSL certificates for two different apps on one
> instance of web2py.
> kindly include the config file if you can help me.
>
> --
> 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] web2py, nginx and big files

2018-04-18 Thread Richard Vézina
That big... Hope it could work for you...

Are you trying to make El packet transiting the island faster or what...

:D

Richard

On Wed, Apr 18, 2018 at 1:45 PM, Carlos Cesar Caballero Díaz <
carlos.caball...@cfg.jovenclub.cu> wrote:

> Thanks Richard, It seems to be working now. The files can be several
> Gigabytes.
>
>
> Greetings.
>
> El 17/04/18 a las 13:10, Richard Vézina escribió:
>
> How big?
>
> https://www.bookstackapp.com/docs/admin/upload-limits/
>
> https://www.nginx.com/resources/wiki/modules/upload/#upload-max-file-size
>
> Quote from the above link:
> For “hard” limit client_max_body_size directive must be used. The value of
> zero for this directive specifies that no restrictions on file size should
> be applied.
>
>
> Have a look at your nginx config upload_max_file_size and
> client_max_body_size
>
> I can't find the default nginx limit, but I think upload are around 5 mg,
> I recall having issue long time ago about upload limit and the attachement
> was a little over 5 meg, so...
>
> In the link you provide there not seems to have limit overriding default,
> so my guess is that your file is bigger than the client_max_body_size
>
> Good luck
>
> Richard
>
> On Tue, Apr 17, 2018 at 12:10 PM, Carlos Cesar Caballero Díaz <
> carlos.caball...@cfg.jovenclub.cu> wrote:
>
>> Hi, I have a web2py + nginx setup (https://github.com/arisobel/w
>> eb2py_scripts/blob/master/setup-web2py-nginx-p3-uwsgi-ubuntu.sh) and I
>> need to upload big files to my application, the app is working ok with the
>> built in server, but with nginx the form submission fails with no response
>> when there are big files.
>>
>> Any tip for solving this?
>>
>>
>> Greetings.
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- You received this message because you are subscribed to the Google
>> Groups "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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] web2py, nginx and big files

2018-04-17 Thread Richard Vézina
How big?

https://www.bookstackapp.com/docs/admin/upload-limits/

https://www.nginx.com/resources/wiki/modules/upload/#upload-max-file-size

Quote from the above link:
For “hard” limit client_max_body_size directive must be used. The value of
zero for this directive specifies that no restrictions on file size should
be applied.


Have a look at your nginx config upload_max_file_size and
client_max_body_size

I can't find the default nginx limit, but I think upload are around 5 mg, I
recall having issue long time ago about upload limit and the attachement
was a little over 5 meg, so...

In the link you provide there not seems to have limit overriding default,
so my guess is that your file is bigger than the client_max_body_size

Good luck

Richard

On Tue, Apr 17, 2018 at 12:10 PM, Carlos Cesar Caballero Díaz <
carlos.caball...@cfg.jovenclub.cu> wrote:

> Hi, I have a web2py + nginx setup (https://github.com/arisobel/w
> eb2py_scripts/blob/master/setup-web2py-nginx-p3-uwsgi-ubuntu.sh) and I
> need to upload big files to my application, the app is working ok with the
> built in server, but with nginx the form submission fails with no response
> when there are big files.
>
> Any tip for solving this?
>
>
> Greetings.
>
> --
> 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: Web2py locks row at auth_user and web2py_session_* tables and doesn't unlock them

2018-04-16 Thread Richard Vézina
Hello LIsandro,

I recall you have ask question about session in redis... Could there are
remaining stuff of experiment with redis that haven't been commented out
completly??

Richard

On Mon, Apr 16, 2018 at 3:15 PM, Lisandro 
wrote:

> Hi there, sorry to bother again, I have some additional info that could
> help.
>
> The problem happened again, exactly the same as the other times.
> But this time an error ticket was created with this traceback:
>
>-
>
>Traceback (most recent call last):
>  File "/var/www/medios/gluon/main.py", line 463, in wsgibase
>session._try_store_in_db(request, response)
>  File "/var/www/medios/gluon/globals.py", line 1152, in _try_store_in_db
>if not table._db(table.id == record_id).update(**dd):
>  File "/var/www/medios/gluon/packages/dal/pydal/objects.py", line 2117, 
> in update
>ret = db._adapter.update("%s" % table._tablename,self.query,fields)
>  File "/var/www/medios/gluon/packages/dal/pydal/adapters/base.py", line 
> 988, in update
>raise e
>DatabaseError: query_wait_timeout
>server closed the connection unexpectedly
>This probably means the server terminated abnormally
>before or while processing the request.
>
>
>
> Could this indicate that for some reason web2py is failing to store the
> session?
> Or could it still be that a deadlock in my app code is producing this
> error?
>
>
> El viernes, 6 de abril de 2018, 18:59:28 (UTC-3), Lisandro escribió:
>>
>> Oh, I see, you made a good point there, I hadn't realised.
>>
>> I guess I will have to take a closer look to my app code. Considering
>> that the problem exists in specific accounts while others work ok, and
>> considering also that the problem happens with any request that that
>> specific user makes to any controller/function, I'm thinking: what does my
>> app do different for a user compared to another one at request level? For
>> "request level" I mean all the code the app runs in every request, to
>> start, the models/db.py
>>
>> I'll take a closer look to that and will post another message here if I
>> find something that could signal the root cause of the issue.
>>
>> Thank you very much for your help!
>>
>>
>>
>> El viernes, 6 de abril de 2018, 16:05:13 (UTC-3), Anthony escribió:
>>>
>>> On Friday, April 6, 2018 at 10:58:56 AM UTC-4, Lisandro wrote:

 Yes, in fact, I've been running that SQL command to check for locks,
 and sometimes I see that lock on other tables, but that other locks live
 for less than a second. However, when the problem happens, the lock on the
 auth_user and web2py_session tables remains there for the whole 60 seconds.

>>>
>>> Yes, but that doesn't mean the lock or the database has anything to do
>>> with the app hanging. The locks will be held for the duration of the
>>> database transaction, and web2py wraps HTTP requests in a transaction, so
>>> the transaction doesn't end until the request ends (unless you explicitly
>>> call db.commit()). In other words, the app is not hanging because the locks
>>> are being held, but rather the locks are being held because the app is
>>> hanging. First you have to figure out why the app is hanging (it could be
>>> the database, but could be something else).
>>>
>>> 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.
>

-- 
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: Customizing Fields the lazy way

2018-04-16 Thread Richard Vézina
Thanks Joe,

I will have a better read... I had fix my issue, my customization of the
plugin introduce a couple of problem... I ends up refactoring the and only
load data when all the controlled field has to be updated "once". It fix
80% of the loading time issue the rest of the issue is user related because
they don't actualize record status.

The workaround above wasn't really necessary.

Richard

On Mon, Apr 16, 2018 at 12:37 AM, Joe Barnhart 
wrote:

> Actually, I borrowed Anthony's excellent idea and made a "factory" class
> for my field definitions.
>
> First I defined a factory class:
>
> class Field_Factory(object):
> from gluon import Field
> @staticmethod
> def new(**kwargs):
> default = dict(**kwargs)
> def inner(name, **kwargs):
> args = dict(default)
> args.update(**kwargs)
> if args.pop('hidden',False):
> args.update(dict(readable=False,writable=False))
> req = args.get('requires', None)
> if req and (args.get('represent',None)=='formatter'):
> args['represent'] = req.formatter
> if args.pop('optional',False) and req:
> args['requires'] = IS_EMPTY_OR(req)
> rend = args.pop('render',None)
> rtn = Field(name, **args)
> if rend:
> rtn.render = rend
> return rtn
> return inner
>
> factory = Field_Factory()
>
> Then I used it to create a bunch of field generators:
>
> phone_field = factory.new(
> type='string', length=20,
> requires=IS_PHONE(), optional=True,
> widget=lambda fld,val: SQLFORM.widgets.string.widget(
> fld, val, _type='tel', _class='form-control')
> )
>
> email_field = factory.new(
> type='string', length=50,
> requires=IS_EMAIL(), optional=True,
> widget=lambda fld,val: SQLFORM.widgets.string.widget(
> fld, val, _type='email', _class='form-control')
> )
>
> date_field = factory.new(
> type='date',
> requires=IS_DATE(format='%m-%d-%Y'), optional=True,
> represent=lambda v,r: v.strftime('%m-%d-%Y'),
> widget=lambda fld,val:SQLFORM.widgets.date.widget(
> fld, val, _class="date form-control")
> )
>
> datetime_field = factory.new(
> type='datetime',
> requires=IS_DATETIME(format='%m-%d-%Y %I:%M:%S %p'), optional=True,
> represent=lambda v,r: v.strftime('%m-%d-%Y %I:%M:%S %p'),
> widget=lambda fld,val: SQLFORM.widgets.datetime.widget(
> fld, val, _class="datetime form-control")
> )
>
> zipcode_field = factory.new(
> type='string', length=10,
> requires=IS_ZIPCODE(),
> widget=lambda fld,val: SQLFORM.widgets.string.widget(
> fld, val, _type="zip", _class='zipcode form-control')
> )
>
> Finally, when I use the field generators in any table definitions, I can
> further customize them and the changes are passed through.
>
> define_table('joes_table',
> . . .
> date_field("birth", label=T("Birth date")),
> . . .
>
>
> It all works really well and gives me the single point of control I want.
> It requires no changes in web2py and works with current, past, and future
> versions.  And the lazy programmer in me marvels at all the code I don't
> have to type.
>
> -- Joe
>
> On Thursday, March 23, 2017 at 12:54:58 PM UTC-7, Joe Barnhart wrote:
>>
>> Here is a bit of syntactic sugar I use for creating fields with less
>> typing.  And better consistency, of course -- there always has to be a good
>> reason for my lazy keyboard-saving shortcuts!
>>
>> I have a number of fields which are for specific data types, such as
>> phone numbers.  I gather the "common" parts of the Field definition into a
>> dictionary:
>>
>> phone_fld = {'requires':IS_EMPTY_OR(IS_PHONE()),
>>  'widget':lambda fld,val: SQLFORM.widgets.string.widget(fld,
>> val,_type='tel',_class='form-control')}
>>
>> When defining the field in a table, I invoke the dictionary at the end of
>> the Field definition:
>>
>> Field("homephone","string",length=20,label=T("Home phone"),**phone_fld),
>> Field("workphone","string",length=20,label=T("Work phone"),**phone_fld),
>> Field("cellphone","string",length=20,label=T("Cell phone"),**phone_fld),
>>
>> Now the field is created exactly as I want.  I keep a list of these
>> "helpers" in a module which I can call out when creating tables.  It really
>> saves the typing and allow me to control how my fields are rendered on one
>> place instead of scattered among all the tables.
>>
>> -- Joe
>>
>> --
> 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, 

Re: [web2py] Reverse relationships

2018-04-11 Thread Richard Vézina
I think it coming from DAL vs ORM.

:)

Richard

On Wed, Apr 11, 2018 at 2:13 PM, pbreit  wrote:

> It's interesting that Rails & Django have a reverse relationship concept
> but Web2py apparently does not. Whenever I run into this in the various
> Rails/Django tutorials I don't understand it and find it confusing. Is that
> another instance where Massimo spared us from unnecessary complexity?
>
> --
> 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] How to retrieve info about sessions when they are stored in Redis?

2018-04-11 Thread Richard Vézina
I gave a look directly in the redis shell

redis-cli -h localhost -p 6379 -a PASSWORD_IF_YOU_SET_ONE

It appears that each session store will have a different key which goes
like that : w2p:sess:APP_NAME:SOME_ID

And w2p:sess:APP_NAME:id_idx will contains a set of each unique session
existings, so you would have to access this list of session id then access
the actual session.

You can list keys in redis with :

SCAN 0

Better then KEYS that could cause lock and lot of memory usage

To list the set of existing sessions in ...:id_idx you need to use

smembers w2p:sess:APP_NAME:id_idx

It migth help you figure out how to manage you redis sessions form python
and better understand session contrib :
https://github.com/web2py/web2py/blob/0d646fa5e7c731cb5c392adf6a885351e77e4903/gluon/contrib/redis_session.py

Good luck

Richard



On Mon, Apr 9, 2018 at 12:11 AM, Lisandro 
wrote:

> Recently I moved the sessions from the database to Redis, and I'm
> wondering: is there a way to retrieve info about sessions when they are
> stored in Redis?
> For example, when sessions are stored in the database, you have the option
> to use SQL to do some stuff like counting or deleting sessions. How to do
> it when sessions are stored in Redis?
>
> I also use Redis to cache HTML responses from web2py and any other stuff
> that can be cached (lists, dictionaries, etc). In order to be able to list
> the keys cached by one specific web2py application, I have written this
> custom function to retrieve those keys.
> I've read that it's not a good idea to use cache.redis.r_server.keys()
> method on production
> ,
> so I written this code based on what I saw in the clear() method at
> gluon.contrib.redis_cache
> 
> :
>
> def get_cache_keys(application, prefix=''):
> import re
> result = []
> regex = ':%s*' % prefix
> prefix = 'w2p:%s' % application
> cache_set = 'w2p:%s:___cache_set' % application
> r = re.compile(regex)
> buckets = current.cache.redis.r_server.smembers(cache_set)  # get all
> buckets
> if buckets:  # get all keys in buckets
> keys = current.cache.redis.r_server.sunion(buckets)
> else:
> return result
> for a in keys:
> if r.match(str(a).replace(prefix, '', 1)):
> result.append(a)
> return result
>
>
> With that code, I'm able to list all the keys cached by a web2py
> application.
> As I'm also using Redis to store sessions, I want to be able to list all
> the session keys.
> I've tried a similar code to the one showed above, replacing this:
>
> prefix = 'w2p:sess:%s' % application
> cache_set = 'w2p:sess:%s:id_idx' % application
>
> But that doesn't work. Is it possible to achieve what I want? Any
> suggestion will be much appreciated.
>
> Regards,
> Lisandro.
>
> --
> 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] License expiry date management

2018-04-11 Thread Richard Vézina
Something like that :

next_week_sunday_date = \
(request.now.date() + datetime.timedelta(days=7)) +
datetime.timedelta(days=6 - request.now.weekday())

rows_with_records_of_software_license_that_will_end_the_next_sunday =
db(db.table_name.field_date_name == next_week_sunday_date
).select(db.table_name.ALL)

Then :

for r in
rows_with_records_of_software_license_that_will_end_the_next_sunday:
# get data you require from you table row and send you email

Richard

On Wed, Apr 11, 2018 at 4:01 AM, Prabhakar Shanmugam 
wrote:

> Dear All,
>
> I have just started learning web2py and I have hands on in python.
>
> Please just give some pointers. Iam sure this might be a trivial question,
> but I thought during the learning process I will ask this trivial question.
>
> I was seeing if i can write a license expiry daet management app, so that,
> we get a notification well before the license expires.
>
> I was going through the documentation, and I got some examples for sending
> emails, however, am not finding a way to identify a field value say a
> expiry date field and then calculating it and seeing if it is 40 or less
> days from today and notify.
>
> What are the options available to me to achieve this.
>
> Regards,
> Prabhakar
>
>
> --
> 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: Decrypt password from auth_user

2018-04-06 Thread Richard Vézina
So you might consider explaining what you try to achieve so we surely can
propose you some other, maybe better, way.


Richard

On Fri, Apr 6, 2018 at 3:06 PM, Luis Sucuc  wrote:

> Mi propósito es editar los datos de usuario desde un formulario diferente
> a SQLFORM. Ya lo hago, pero necesito mostrar el número correcto de ''
> en el input de contraseña, pero entiendo que no lo puedo hacer. ¡Gracias!
>
>
> El viernes, 6 de abril de 2018, 12:21:05 (UTC-6), pbreit escribió:
>>
>> You cannot. Passwords are actually one-way hashed, not encrypted. This is
>> by design so that the password can never be figure out even if your
>> database and code are compromised. What happens is that the password the
>> user enters is hashed in the same way and the result is compared to what is
>> in the DB.
>>
>>
>> On Friday, April 6, 2018 at 9:33:37 AM UTC-7, Luis Sucuc wrote:
>>>
>>>
>>> How can I decrypt a password from the auth_user table?
>>>
>>>
>>> user = db(db.auth_user.id == user_id).select().first()
>>> print user.password
>>>
>>> # --output--
>>> # pbkdf2(1000,20,sha512)$8d7c80fb77386465$532cd8dd495f703337cf
>>> 3c261a01801b3155f36c
>>>
>>>
>>>
>>> --
> 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: Decrypt password from auth_user

2018-04-06 Thread Richard Vézina
If the purpose is to impersonate support a user, web2py provide tool to do
it

http://web2py.com/books/default/chapter/29/09/access-control#Authentication

It explained at the end the Authentication seciton from the link above.

Richard

On Fri, Apr 6, 2018 at 2:29 PM, Leonel Câmara 
wrote:

> Also, please don't start saving passwords in clear text to go around this.
>
> --
> 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: Confused about web2py sessions handling in the filesystem, versus the db handling.

2018-04-05 Thread Richard Vézina
Thank you Anthony as always very clear explanations.

:)

Richard

On Wed, Apr 4, 2018 at 5:19 PM, Anthony  wrote:

> This behavior is controlled by the following auth.settings:
>
> renew_session_onlogin (default=True)
> keep_session_onlogin (default=True)
> renew_session_onlogout (default=True)
> keep_session_onlogout (default=False)
>
> Renewing the session causes a new session ID and therefore file to be
> created -- that explains why the new files are created on both login and
> logout.
>
> Keeping the session means that the content of the session is retained when
> the session is renewed. If keep is set to False, then the old file is
> deleted when the session is renewed (but the old file is not deleted when
> the keep is set to True). That explains why the old file is deleted on
> logout but not on login (given the above noted defaults). I believe this
> should probably be considered a bug -- the old file should be deleted in
> either case (the problem is that in the code, the file deletion happens in
> the same method that clears the session data, and of course that method is
> not called when the session is kept). Feel free to file a Github issue
> about this and refer back to this thread.
>
> For now, if you don't need to retain any session data upon login (i.e.,
> session data stored before login does not need to remain available once
> logged in), then you can set auth.settings.keep_session_onlogin=False,
> and the old session file will be deleted upon login (so, at any given time,
> there will be only one session file for a given user session).
>
> Alternatively, of course you can set either or both of the renew_session_*
> settings to False, and no additional session files will be created on login
> or logout.
>
> Anthony
>
> On Tuesday, April 3, 2018 at 1:01:21 PM UTC-4, AlighaThor wrote:
>>
>> Hi. I'm experimenting for the first time (but I'm quite a bit old using
>> this amazing framework :)) storing sessions in the DB instead the
>> filesystem, as I always did. I'm monitoring those two behaviours and
>> somehow it feels (at least for me) that the DB session handling is far away
>> more efficient/manteinable than the filesystem session handling.
>>
>> Look at this:
>>
>> *When using the filesystem handling:*
>>
>> 1 - I go to my login form. A session file is created (for the form key I
>> suposse.).
>>
>>
>>
>> 
>>
>>
>> 2 - Then I finally log in. Another session file is created.
>>
>>
>> 
>>
>>
>> 3 - Next I log out. A new file is created or somehow "moved" or "deleted"
>> from the directory "165".
>>
>>
>> 
>>
>> 4 - Next I log in again. This time my form action did not create any new
>> file, but a new one after the log in.
>>
>>
>> 
>>
>>
>> 5 - Everything is repeated again. I log out, then a new file is created.
>>
>>
>> *Now let's see the DB behaviour:*
>>
>>
>> 1 - Login form. A session record is created.
>>
>>
>>
>> 
>>
>>
>> 2 - I log in. The same record remains, but instead, as we expect, the
>> unique_key is updated.
>>
>>
>> 
>>
>> 3 - I log out. Again, the record remains and the unique_key field is
>> updated.
>>
>>
>>
>> 
>>
>>
>> (Updated: My bad, after the log out, the record is deleted and a new one
>> is created. I did'nt notice the new ID "17".)
>>
>>
>> Whatever I do, only one record is stored according my session origin (IP,
>> Browser, etc) and this remains true until my session expires or is deleted.
>>
>> Maybe I'm talking nonesenses, but it is feel "better" to me, having a
>> "true one instance per session", using the DB, that many files/folders
>> created over and over again related to the same origin using the filesystem.
>>
>> What I am missing here?
>> Is this the normal/expected behaviour when the default FS session
>> handling is used?
>> Can we consider that is more performant using the DB alternative that the
>> FS one?
>>
>> BTW: It seems that the admin option to "cleanup" only clear the sessions
>> store in the filesystem, not the 

Re: [web2py] Confused about web2py sessions handling in the filesystem, versus the db handling.

2018-04-04 Thread Richard Vézina
Hello Anthony,

Is that normal that multiples sessions files get created in case of FS
sessions??

Regards

Richard

On Wed, Apr 4, 2018 at 3:09 PM, Anthony  wrote:

> One potential downside of db sessions is that you can have race
> conditions, as the session record does not get locked (unless something has
> changed). On the plus side, if you have multiple Ajax requests that all
> just need to read (but not write to) the session, they can be handled
> simultaneously (with file based sessions, because the session file is
> locked by each request, multiple Ajax requests must be handled one at a
> time, which is safer, but also slower).
>
> Anthony
>
>
> On Wednesday, April 4, 2018 at 1:28:18 PM UTC-4, Richard wrote:
>>
>> DB sessions are so much more convenient... you only need one connection,
>> not need to access remote server or sudo password etc...
>>
>> Walk the extra mile and set a cron job for session2trash clean up and you
>> now have one less thing to check for...
>>
>> Depending on your workload, you don't have to do clean up as often than 5
>> min interval.
>>
>> Here my conf :
>>
>> # CRON /etc/crond.d/
>> # m  h  dom mon dow user command
>>   0  8-17/1 * * 1-5 root /opt/scripts/sessions2trash.sh
>>
>> # Bach script
>>
>> python /home/www-data/web2py/web2py.py -S APPNAME -M -R
>> scripts/sessions2trash.py -C -A -o
>> # -A : should be followed by a list of arguments to be passed to script,
>> to be used with -S, -A must be the last option
>> # -o : args passed to sessions2trash.py which "Delete sessions, then
>> exit."
>> #  NOTE  if it's omitted, processes get spawned but not killed
>>
>>
>> Good luck
>>
>> Richard
>>
>> On Wed, Apr 4, 2018 at 11:06 AM, AlighaThor <
>> alighathor88caribb...@gmail.com> wrote:
>>
>>> Well, I will stick with DB sessions from now.
>>>
>>> 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.
>>>
>>
>> --
> 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] Confused about web2py sessions handling in the filesystem, versus the db handling.

2018-04-04 Thread Richard Vézina
DB sessions are so much more convenient... you only need one connection,
not need to access remote server or sudo password etc...

Walk the extra mile and set a cron job for session2trash clean up and you
now have one less thing to check for...

Depending on your workload, you don't have to do clean up as often than 5
min interval.

Here my conf :

# CRON /etc/crond.d/
# m  h  dom mon dow user command
  0  8-17/1 * * 1-5 root /opt/scripts/sessions2trash.sh

# Bach script

python /home/www-data/web2py/web2py.py -S APPNAME -M -R
scripts/sessions2trash.py -C -A -o
# -A : should be followed by a list of arguments to be passed to script, to
be used with -S, -A must be the last option
# -o : args passed to sessions2trash.py which "Delete sessions, then exit."
#  NOTE  if it's omitted, processes get spawned but not killed


Good luck

Richard

On Wed, Apr 4, 2018 at 11:06 AM, AlighaThor  wrote:

> Well, I will stick with DB sessions from now.
>
> 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.
>

-- 
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] Confused about web2py sessions handling in the filesystem, versus the db handling.

2018-04-04 Thread Richard Vézina
About session clean up, I recently set it in place (finally) and I can
assure you that db sessions get cleared as expected.

About the FS sessions, I can say for sure but maybe it faster to just
create another file than search the exsting file, then append or rewrite
part of it...

Finally it surely more performant to use db sessions as it is propose in
the book as a way to help improve performance and scaling the work load
your app can support.

Set a cron job with sessions clean up is also important as it make just
sens that filtering over 10 db records vs thousand of them doesn't take the
same amount of time and processing.

Richard

On Tue, Apr 3, 2018 at 1:01 PM, AlighaThor 
wrote:

> Hi. I'm experimenting for the first time (but I'm quite a bit old using
> this amazing framework :)) storing sessions in the DB instead the
> filesystem, as I always did. I'm monitoring those two behaviours and
> somehow it feels (at least for me) that the DB session handling is far away
> more efficient/manteinable than the filesystem session handling.
>
> Look at this:
>
> *When using the filesystem handling:*
>
> 1 - I go to my login form. A session file is created (for the form key I
> suposse.).
>
>
>
> 
>
>
> 2 - Then I finally log in. Another session file is created.
>
>
> 
>
>
> 3 - Next I log out. A new file is created or somehow "moved" or "deleted"
> from the directory "165".
>
>
> 
>
> 4 - Next I log in again. This time my form action did not create any new
> file, but a new one after the log in.
>
>
> 
>
>
> 5 - Everything is repeated again. I log out, then a new file is created.
>
>
> *Now let's see the DB behaviour:*
>
>
> 1 - Login form. A session record is created.
>
>
>
> 
>
>
> 2 - I log in. The same record remains, but instead, as we expect, the
> unique_key is updated.
>
>
> 
>
> 3 - I log out. Again, the record remains and the unique_key field is
> updated.
>
>
>
> 
>
>
>
> Whatever I do, only one record is stored according my session origin (IP,
> Browser, etc) and this remains true until my session expires or is deleted.
>
> Maybe I'm talking nonesenses, but it is feel "better" to me, having a
> "true one instance per session", using the DB, that many files/folders
> created over and over again related to the same origin using the filesystem.
>
> What I am missing here?
> Is this the normal/expected behaviour when the default FS session handling
> is used?
> Can we consider that is more performant using the DB alternative that the
> FS one?
>
> BTW: It seems that the admin option to "cleanup" only clear the sessions
> store in the filesystem, not the DB alternative.
>
> Thanks for reading!
>
> --
> 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] on delete event callbacks and versioned tables

2018-03-29 Thread Richard Vézina
They are intent to be used to specify something before or after the
delete... I mean even if there is no "pure" deletion occuring your record
doesn't exist anymore for the end user once you "deleted" it even if
versioning mechanism keep trace of it for the purpose of the audit trail
integrity...

Do you have any issue related to how those callbacks operate in context of
the version table web2py functionality?

Richard

On Thu, Mar 29, 2018 at 10:55 AM, Manuele Pesenti  wrote:

>
> Are actually _before_delete and _after_delete callbacks called on record
> delete event even if on versioned tables?
>
> I mean on versioned tables records are just updated from is_active True to
> False and not really deleted... right? So what is in thees cases the called
> list of callback function?
>
> Thak you very mutch
>
> Cheers
>
> Manuele
>
> --
> 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] btn-default

2018-03-28 Thread Richard Vézina
Or :

touch /static/css/myapp.css
Then add :

.btn-default {YOUR WANTED STYLE}

Then modify the /views/layout.html and add a new :


response.files.append(URL('static', 'css/myapp.css'))

You don't really want to customize the bootstrap css class or you should
learn "sass" and add another level of abstraction as you have to convert
the sass file into css ...

If you want to go down that road here a starter :
https://www.sitepoint.com/bootstrap-sass-installation-and-customisation/

Richard

On Wed, Mar 28, 2018 at 3:01 PM, Dave S  wrote:

>
>
> On Wednesday, March 28, 2018 at 11:43:00 AM UTC-7, Andrea Fae' wrote:
>>
>> Yes...I know this, but in web2py application I need to change the style.
>> Where is the definition of this class in the files css? Inside the web
>> application I mean...
>>
>>
> grep btn-default */static/js/*.js tells me it is the app's static
> folder.  For instance:
>
> welcome/static/js/web2py-bootstrap3.js:$('form
> input[type="submit"]:not([class^="btn"]), form 
> input[type="button"]:not([class^="btn"])',
> target).addClass('btn btn-default');
>
>  /dps
>
>
>> Il giorno mercoledì 28 marzo 2018 16:50:15 UTC+2, Richard ha scritto:
>>>
>>> Bootstrap : https://getbootstrap.com/
>>>
>>> On Tue, Mar 27, 2018 at 4:02 PM, Andrea Fae'  wrote:
>>>
 Where is the definition btn-default in any welcome clone application? I
 need to change the style...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+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] btn-default

2018-03-28 Thread Richard Vézina
Bootstrap : https://getbootstrap.com/

On Tue, Mar 27, 2018 at 4:02 PM, Andrea Fae'  wrote:

> Where is the definition btn-default in any welcome clone application? I
> need to change the style...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.
>

-- 
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] execute python script

2018-03-28 Thread Richard Vézina
It depends...

This is a start if you want to create CSV type of file :

```python
# The code below is greatly inspired by gluon/sqlhtml.py class ExporterTSV
and ExporterCSV
import cStringIO
out = cStringIO.StringIO()
final = cStringIO.StringIO()
import csv
if csv_or_xls == 'csv':
label = 'CSV'
file_ext = 'csv'
content_type = "text/csv"
writer = csv.writer(out, delimiter=',')
elif csv_or_xls == 'tsv':
label = 'TSV'
file_ext = 'csv'
content_type = "text/tab-separated-values"
writer = csv.writer(out, delimiter='\t')
import codecs
final.write(codecs.BOM_UTF16)
for row in transposed_rows:
writer.writerow([unicode(str(cell).decode('utf8')).encode("utf8")
for cell in row])
data = out.getvalue().decode("utf8")
data = data.encode("utf-16")
data = data[2:]
final.write(data)
out.truncate(0)
response.headers['Content-Type'] = content_type
response.headers['Content-Disposition'] = \
'attachment;filename=report_%s.%s;' %
(request.now.strftime('%Y-%m-%d_%H-%M-%S-%f'), file_ext)
response.write(final.getvalue(), escape=False)
raise HTTP(200, str(final.getvalue()), **response.headers)
```

It will differ for PDF, you can have a look in gluon/sqlhtml.py

This is mostly the part to you need to stream your file once it ready, you
have some other things to do before you get there as to determine what you
pdf report should contains (dinamically??).

For the button part it should be as simple as adapt this snippet in a
controller :

export_button_csv = A(I('', _class='icon-download'), CAT('  '), T('Export
CSV'),
  _href=URL(f='export_report', args=request.args(0),
vars=dict(VARS YOU WANT TO PASS TO YOUR
EXPORT FUNCTION TO MAKE IT BEHAVE IN SOME WAY YOU EXPECT...),
),
  _class='btn btn-small')

You then use export_button_csv in your view to display the button...

You have to encapsulate the previsous streaming code in a controller
function that you are going to call export_report (you can change the name
obviously)

Good luck

Richard

On Wed, Mar 28, 2018 at 8:27 AM, ArtDijk  wrote:

> LS,
> I've written a print to pdf python script. How can I execute this script
> via a button on a web2py screen?
>
> --
> 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: I was thinking about python2 clock

2018-03-22 Thread Richard Vézina
Take care if you run your app under python 3... It a no way back because
pickled object format change and you can't cleanly revert this change
back... Try it with a copy of your app.

Richard

On Thu, Mar 22, 2018 at 3:13 PM, Ty oc  wrote:

> I think we2py should join the party!! and be on the list! :P
>
> http://python3statement.org/
>
>
> El martes, 20 de marzo de 2018, 16:14:58 (UTC-6), Leonel Câmara escribió:
>
>> I'm guessing the rewrite will take some time. One thing you can do is to
>> report any python3 problems you find with web2py while you do it. We'll fix
>> them.
>>
>> We've fixed many many python 3 compatibility problems on the last months,
>> you should be fine.
>>
> --
> 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: Customizing Fields the lazy way

2018-03-15 Thread Richard Vézina
I found a pretty unclean workaround...

You have to set the widget like this :

db.tablename.REFERENCEDTABLEOFCHILDFIELD.widget = \
lazy_options_widget(on_key='no_table_PARENTFIELDNAME__selected',
off_key='PARENTFIELDNAME__unselected',
where=lambda PARENTFIELDNAME:
(some where clause),
trigger=record_row.get('PARENTFIELDNAME', None),
orderby=db.REFERENCEDTABLEOFCHILDFIELD.id,
suggest_widget=False,
widget_chained=True,
row=record_row,

field_requires=db.tablename.REFERENCEDTABLEOFCHILDFIELD.requires
# We pass the original field requires that we want to be execute in context
to limit as much as possible the number of records that will be pulled out
the database and only when the parent field will be updated...
#user_signature=True,
# If you want to process ajax requests at the
time of the object construction
# (not at the form rendered), specify your
target field in the following:
)
db.tablename.REFERENCEDTABLEOFCHILDFIELD.requires = IS_IN_SET([1, 2,
3])  # Here redefine the child field or lazy option controlled field with
dummy not computer intensive requires that will be never displayed


NOTE: I have a customized version of lazy_option_widget (NOT THIS ONE :
https://github.com/scubism/sqlabs/blob/master/modules/plugin_lazy_options_widget.py)
that support reference field... So it might not make more sens without the
code so here it is...

# -*- coding: utf-8 -*-
# This plugins is licensed under the MIT license:
http://www.opensource.org/licenses/mit-license.php
# Authors: Kenji Hosoda <hos...@s-cubism.jp>
# Support for reference field : Richard Vézina

from gluon import *


class lazy_options_widget(SQLFORM.widgets.options):

def __init__(self,
 on_key,
 off_key,
 where,
 trigger=None,  # Rename this attribute
 suggest_widget=True,  # In case you don't want to use
plugin_suggest_widget, set suggest_widget to
   # False. In this case, this piece of
js with be including :
   #
$("select[name=]").change(function() {
   # var val =
$(this).children(":selected").attr("value");
   #
 $(this).trigger($(this).attr("id") + "__selected", [val]);
   # });
   # Where 
will be replaced with the field name of the
   # conditional field name.
 widget_chained=False,  # In case the widget field is also
a conditional field for another widget field
# you need to trigger event like
"WIDGET_FIELD_NAME__selected" when the widget
# field option is finally selected
 widget_trigger_event_js=None,  # If you need to trigger
something when the widget field option is
# finally selected you can
pass a piece of js here that will be injected
# into the form when the
conditional field trigger event "__selected"
 default='---',
 keyword='_lazy_options_%(fieldname)s',
 orderby=None,
 user_signature=False,
 hmac_key=None,
 row=None,  # In order to set values and filtered drop down
appropriately based on values of
# conditional and widget field when the form is
populated. Since you can't get row like this
# Field(..., widget=lambda field, value, row:
...
# When form is populated (update form) you need
to define a row object base on the id of
# the record like this :
# row = db(db.table.id = request.vars.id
).select(db.table.ALL).first()
# and pass it to lazy_option_widget...
 field_requires=None,  # Better to set the field requires
here to get it evaluated in a lazy manner
 ):
self.on_key, self.off_key, self.where = (
on_key, off_key, where
)
self.field_requires = field_requires
self.trigger, self.default, self.keyword, self.orderby = (
trigger, default, keyword, orderby,
)
self.user_signature, self.hmac_key = user_signature, hmac_key

self.row = row

self.suggest_widget, self.widget_trigger_eve

Re: [web2py] Re: Customizing Fields the lazy way

2018-03-15 Thread Richard Vézina
I wonder if we could we also make field lazy that way in context of custom
form...

I find some issue with some of my custom form where I use Field() to define
my field that will be use... This form is also dynamic, I manipulate field
visibility and lazy_option_widget() to make some field depend of other
field... The things is with data build up...
requires=IS_EMPTY_OR(IS_IN_DB(_set_, 'table.id', ...)), is loading at first
(on form load) all the records almost everything as I can't specify the id
which will be selected in the parent field the one controlling the
lazy_option controlled field (hope I am understandable)... Multiply this by
3-4 time for each lazy_option controlled field and you ends up pulling
multiple time the same records...

I would be interred in making the IS_IN_DB() triggered select occuring only
when options needed to be displayed... I guess this is a flaw in the way
lazy_option_widget() is implemented in the first place though...

Richard

On Sun, Mar 26, 2017 at 6:34 AM, Joe Barnhart 
wrote:

> That's kinda clever.  I may think of that!
>
> -- Joe
>
>
> On Thursday, March 23, 2017 at 4:19:05 PM UTC-7, Anthony wrote:
>>
>> Note, you might as well also add 'type': 'string' to your dictionary, and
>> maybe 'length': 20. You can also give yourself some flexibility by creating
>> a function:
>>
>> def phone_field(name, **kwargs):
>> defaults = {'type': 'string',
>> 'length': 20,
>> 'requires': IS_EMPTY_OR(IS_PHONE()),
>> 'widget': lambda fld,val: SQLFORM.widgets.string.widget(
>> fld, val, _type='tel', _class='form-control')}
>> defaults.update(**kwargs)
>> return Field(name, **defaults)
>>
>> 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.
>

-- 
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] LDAP authentication questions

2018-03-15 Thread Richard Vézina
For 1 you already have this opportunity as you example is mostly the same
as :

auth.settings.login_methods = \
[auth,
 ldap_auth(...)]

So web2py will try authenticate user against web2py data, if it fails it
will try the AD.

2) There's the tricky part... The simplest would be to inform your user on
the registration page to contact you if they are member of the staff, so
you create their account for them, so no web2py password would be
requires... If this is not acceptable you customize the registration form some
how and avoid asking for creating a password for the user member of the
staff. The simplest way would be to create a first form asking if the
person is member of the staff and depending of the answer directing on the
right form. Finally you could create a synching AD/web2py users module, so
all the possible staff member get their account create into web2py and you
can even manage the access to your app from the AD like that by creating a
AD group for which you grant access to your app. I did just that
recently... It a lot of work :)

3) To avoid that situation, you have to leave the password field of
auth_user table empty for the user that need to be granted access against
AD.

NOTE: If you use AD think to use ldapS connection over port 636 (LDAP +
SSL) to avoid clear text authenication credentials flowing over your LAN.

This could be achieve like this depending if the SSL certificate is self
sign or not your config migth tweaks a bit, read the ldap_auth.py module
for guidance on the available switches...

auth.settings.login_methods = \
[auth,
 ldap_auth(mode='ad',
   #
---
   # To unlock LDAPS with self-signed certificate this line
should be
   # present in ldap_auth.py :
   # ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT,
ldap.OPT_X_TLS_NEVER)
   # This line should be inside : ldap_auth()
   # Ref:
https://onemoretech.wordpress.com/2015/06/25/connecting-to-ldap-over-self-signed-tls-with-python/
   # Ref:
http://bneijt.nl/blog/post/connecting-to-ldaps-with-self-signed-cert-using-python/
   # Ref:
https://mail.python.org/pipermail/python-ldap/2015q4/003631.html
   port=636,
   secure=True,
   self_signed_certificate=True,
   )]

Good luck

Richard



On Thu, Mar 15, 2018 at 6:10 AM, Johann Spies 
wrote:

> I am trying out ldap authentication after I have last used it in 2006.
>
> My ldap knowledge is minimal.
>
> After reading the documentation in the book and in ldap_auth.py I
> have a few questions about authentication and ldap.
>
> Background: Only a few users (probably not more than 5 or 6) will use
> this app as logged in users.
>
> All of them (or maybe except one or two) will not be staff members of
> our university.  Staff members and students can be authenticated
> against the Active Directory (AD) of the university.  The others not.
>
> We will only allow specific people to authenticate.  Registration of
> users will not be available through the user webinterface.
>
> As I understand the documentation web2py will work through the list
> (auth.settings.login_methods) trying the next method if the previous
> authentication method fails.
>
> I do not have any admin-function as far as the AD is concerned.  So
> I can do nothing there that have an effect on our authentication
> except query the AD through LDAP.
>
>
> In the model:
>
> from gluon.contrib.login_methods.ldap_auth import ldap_auth
> auth.settings.login_methods.append(ldap_auth(
> mode='ad', server='ouradserver',
> base_dn='ou=Users,dc=stb,dc=sun,dc=ac,dc=za,O=SU',
> manage_user=True,
> user_firstname_attrib='cn:1',
> user_lastname_attrib='cn:2',
> user_mail_attrib='mail'))
>
> My auth.settings.login_methods:
> [,
>  .
> ldap_auth_aux>]
>
>
>
> Now my questions:
>
>
>
> 1. Is it possible to combine the normal auth and ldap methods in such
> a way that staff members authenticate against AD and the others
> against the local auth-table?
>
> 2. How do I manage the user registration if the answer on 1 is "Yes".
>
> 3. I have tested the system with myself as user on both the local and
> the AD.  If my local password is different from that on the AD, I can
> login with the local password.  That should not be.  How do I get it
> that if the username is local and on the AD the last will override the
> first?
>
> Regards
> Johann
>
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>
> --
> 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 

Re: [web2py] Bug in ldap library for python3?

2018-03-15 Thread Richard Vézina
Migth be interesting in this patch :
https://github.com/web2py/web2py/issues/1880

On Wed, Mar 14, 2018 at 12:43 PM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> It debian package... If you goes with pip it should be python-ldap...
>
> Good luck
>
> Richard
>
> On Wed, Mar 14, 2018 at 3:57 AM, Johann Spies <johann.sp...@gmail.com>
> wrote:
>
>> Thanks Richard for your attention.
>>
>> I have checked my setup again and saw that I had the debian-package
>> python3-ldap3 and not python3-ldap.
>>
>> I have installed  python3-ldap and now it works - at least so far for
>> importing:
>>
>> from gluon.contrib.login_methods.ldap_auth import ldap_auth
>>
>> Regards
>> Johann
>>
>> On 13 March 2018 at 19:05, Richard Vézina <ml.richard.vez...@gmail.com>
>> wrote:
>> > It might not be an issue with auth_ldap.py
>> >
>> > On Tue, Mar 13, 2018 at 12:29 PM, Richard Vézina
>> > <ml.richard.vez...@gmail.com> wrote:
>> >>
>> >> It works fine...
>> >>
>> >> On Tue, Mar 13, 2018 at 12:28 PM, Richard Vézina
>> >> <ml.richard.vez...@gmail.com> wrote:
>> >>>
>> >>> I try with a module of mine using ldap and had issues with ldapS
>> >>> connection...
>> >>>
>> >>> I had to follow this :
>> >>>
>> >>> https://github.com/python-ldap/python-ldap/issues/55
>> >>>
>> >>> l = ldap.initialize("ldaps://{s}:{p}".format(s=server, p=636))
>> >>> l.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3)
>> >>> # l.set_option(ldap.OPT_X_TLS_CACERTFILE, 'path/to/ca.pem')  # Wasn't
>> >>> required...
>> >>> l.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap. OPT_X_TLS_NEVER)
>> >>> l.set_option(ldap.OPT_X_TLS_NEWCTX, 0)
>> >>>
>> >>> Then it connected properly under python3 only...
>> >>>
>> >>> Will make some test in python2 if the back port of the above cause any
>> >>> issue...
>> >>>
>> >>> Richard
>> >>>
>> >>>
>> >>> On Tue, Mar 13, 2018 at 11:58 AM, Richard Vézina
>> >>> <ml.richard.vez...@gmail.com> wrote:
>> >>>>
>> >>>> Please try this :
>> >>>>
>> >>>> sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
>> >>>> # setuptools should be there... I was miss leading...
>> >>>> sudo pip3 install python-ldap
>> >>>>
>> >>>> Please provide progress as if auth_ldap.py works properly with
>> python3
>> >>>> once you install python-ldap properly under python3.
>> >>>>
>> >>>> Thanks
>> >>>>
>> >>>> Richard
>> >>>>
>> >>>>
>> >>>> On Tue, Mar 13, 2018 at 11:39 AM, Richard Vézina
>> >>>> <ml.richard.vez...@gmail.com> wrote:
>> >>>>>
>> >>>>> I open this issue :
>> >>>>>
>> >>>>> https://github.com/python-ldap/python-ldap/issues/181
>> >>>>>
>> >>>>> On Tue, Mar 13, 2018 at 11:03 AM, Richard Vézina
>> >>>>> <ml.richard.vez...@gmail.com> wrote:
>> >>>>>>
>> >>>>>> python3-ldap -> ldap3
>> >>>>>> (https://pypi.python.org/pypi/python3-ldap/0.9.8.4/) is not the
>> same thing
>> >>>>>> as python-ldap...
>> >>>>>>
>> >>>>>> It seems that python-ldap support python 3 :
>> >>>>>>
>> >>>>>> https://github.com/python-ldap/python-ldap
>> >>>>>>
>> >>>>>> Saddly enough, I hadn't successfully install python-ldap under
>> python3
>> >>>>>> with pip3... It fails over importing setuptools issue...
>> Setuptools is
>> >>>>>> installed, so I wonder what going on...
>> >>>>>>
>> >>>>>> It seems to be working with python 3.4+ :
>> >>>>>> https://www.python-ldap.org/en/latest/installing.html#build-
>> prerequisites
>> >>>>>>
>> >>>>>> If you have ubuntu you can try on your side :
>> >>>>>>
>> >>>&

Re: [web2py] Backwards compatibility

2018-03-14 Thread Richard Vézina
Which version of web2py are you using?

Are you talking of a new app you just created with web2py admin interface
(which is base on welcome app)??

If so, it mays exist some issue with the welcome app that need to be
resolved.

Please add details here, eventually it may lead to a issue to be created
over github web2py repository if we can reproduce the problem.

Thanks

Richard

On Wed, Mar 7, 2018 at 5:40 PM, Mark Erbaugh 
wrote:

> I appreciate Web2py's view towards backwards compatibility, but I think
> some of the included libraries do not share the same philosophy. I have had
> to make changes eliminate errors or have expected functionality. I would
> like to know if I'm doing this right and if I've missed something.
>
> If you view pages using developer tools, you see an error message that
> Bootstrap tooltips require Tether. I solved this by downloading tether.min
> ad additing it to layout.html.
>
> In the admin mode, if you try and edit a table with a list field, the +
> and - icons are missing. The buttons are there, just blank. I solved this
> by adding glyhpicons.css to layout.html which uses Glyphicons Halflings
> font. Interestingly, the glyicons-haflings files referenced were already in
> the statc\fonts directory.
>
> Thanks,
> Mark
>
>
>
>
>
>
> --
> 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] Bug in ldap library for python3?

2018-03-14 Thread Richard Vézina
It debian package... If you goes with pip it should be python-ldap...

Good luck

Richard

On Wed, Mar 14, 2018 at 3:57 AM, Johann Spies <johann.sp...@gmail.com>
wrote:

> Thanks Richard for your attention.
>
> I have checked my setup again and saw that I had the debian-package
> python3-ldap3 and not python3-ldap.
>
> I have installed  python3-ldap and now it works - at least so far for
> importing:
>
> from gluon.contrib.login_methods.ldap_auth import ldap_auth
>
> Regards
> Johann
>
> On 13 March 2018 at 19:05, Richard Vézina <ml.richard.vez...@gmail.com>
> wrote:
> > It might not be an issue with auth_ldap.py
> >
> > On Tue, Mar 13, 2018 at 12:29 PM, Richard Vézina
> > <ml.richard.vez...@gmail.com> wrote:
> >>
> >> It works fine...
> >>
> >> On Tue, Mar 13, 2018 at 12:28 PM, Richard Vézina
> >> <ml.richard.vez...@gmail.com> wrote:
> >>>
> >>> I try with a module of mine using ldap and had issues with ldapS
> >>> connection...
> >>>
> >>> I had to follow this :
> >>>
> >>> https://github.com/python-ldap/python-ldap/issues/55
> >>>
> >>> l = ldap.initialize("ldaps://{s}:{p}".format(s=server, p=636))
> >>> l.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3)
> >>> # l.set_option(ldap.OPT_X_TLS_CACERTFILE, 'path/to/ca.pem')  # Wasn't
> >>> required...
> >>> l.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap. OPT_X_TLS_NEVER)
> >>> l.set_option(ldap.OPT_X_TLS_NEWCTX, 0)
> >>>
> >>> Then it connected properly under python3 only...
> >>>
> >>> Will make some test in python2 if the back port of the above cause any
> >>> issue...
> >>>
> >>> Richard
> >>>
> >>>
> >>> On Tue, Mar 13, 2018 at 11:58 AM, Richard Vézina
> >>> <ml.richard.vez...@gmail.com> wrote:
> >>>>
> >>>> Please try this :
> >>>>
> >>>> sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
> >>>> # setuptools should be there... I was miss leading...
> >>>> sudo pip3 install python-ldap
> >>>>
> >>>> Please provide progress as if auth_ldap.py works properly with python3
> >>>> once you install python-ldap properly under python3.
> >>>>
> >>>> Thanks
> >>>>
> >>>> Richard
> >>>>
> >>>>
> >>>> On Tue, Mar 13, 2018 at 11:39 AM, Richard Vézina
> >>>> <ml.richard.vez...@gmail.com> wrote:
> >>>>>
> >>>>> I open this issue :
> >>>>>
> >>>>> https://github.com/python-ldap/python-ldap/issues/181
> >>>>>
> >>>>> On Tue, Mar 13, 2018 at 11:03 AM, Richard Vézina
> >>>>> <ml.richard.vez...@gmail.com> wrote:
> >>>>>>
> >>>>>> python3-ldap -> ldap3
> >>>>>> (https://pypi.python.org/pypi/python3-ldap/0.9.8.4/) is not the
> same thing
> >>>>>> as python-ldap...
> >>>>>>
> >>>>>> It seems that python-ldap support python 3 :
> >>>>>>
> >>>>>> https://github.com/python-ldap/python-ldap
> >>>>>>
> >>>>>> Saddly enough, I hadn't successfully install python-ldap under
> python3
> >>>>>> with pip3... It fails over importing setuptools issue... Setuptools
> is
> >>>>>> installed, so I wonder what going on...
> >>>>>>
> >>>>>> It seems to be working with python 3.4+ :
> >>>>>> https://www.python-ldap.org/en/latest/installing.html#
> build-prerequisites
> >>>>>>
> >>>>>> If you have ubuntu you can try on your side :
> >>>>>>
> >>>>>> sudo pip3 install -U setuptools
> >>>>>> sudo pip3 install python-ldap
> >>>>>>
> >>>>>>
> >>>>>> It would be nice if python-ldap just works under python3 as we
> >>>>>> wouldn't have to touch ldap_auth.py as python-ldap should have keep
> the same
> >>>>>> API under python3...
> >>>>>>
> >>>>>> Though ldap3 seems to offer interresting progres, but I didn't try
> it.
> >>>>>>
> >>>>

Re: [web2py] Re: Using vue.js as my front end

2018-03-13 Thread Richard Vézina
Maybe here : https://github.com/robertop23/web2py_vuejs_vuetify

There is a initiative to create a scafold web2py app base on vue.js...

Richard

On Tue, Mar 13, 2018 at 1:07 PM, Jim S  wrote:

> Thanks for that!
>
> Any example code anywhere on how to implement login and then subsequent
> page calls passing the logged in user or session information?
>
> -Jim
>
>
> On Tuesday, March 13, 2018 at 12:00:44 PM UTC-5, Leonel Câmara wrote:
>>
>> Look at AuthAPI which is Auth's base class
>>
>> https://github.com/web2py/web2py/blob/master/gluon/authapi.py
>>
>> It works pretty much like Auth except that it's based in dictionaries,
>> its functions get dictionaries as arguments and returns dictionaries, which
>> is pretty much what people usually want when interacting with JS frontend
>> frameworks.
>>
>> It will probably be easy to subclass it and make your AuthVue class.
>>
> --
> 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] Bug in ldap library for python3?

2018-03-13 Thread Richard Vézina
It might not be an issue with auth_ldap.py

On Tue, Mar 13, 2018 at 12:29 PM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> It works fine...
>
> On Tue, Mar 13, 2018 at 12:28 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> I try with a module of mine using ldap and had issues with ldapS
>> connection...
>>
>> I had to follow this :
>>
>> https://github.com/python-ldap/python-ldap/issues/55
>>
>> l = ldap.initialize("ldaps://{s}:{p}".format(s=server, p=636))
>> l.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3)
>> # l.set_option(ldap.OPT_X_TLS_CACERTFILE, 'path/to/ca.pem')  # Wasn't
>> required...
>> l.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap. OPT_X_TLS_NEVER)
>> l.set_option(ldap.OPT_X_TLS_NEWCTX, 0)
>>
>> Then it connected properly under python3 only...
>>
>> Will make some test in python2 if the back port of the above cause any
>> issue...
>>
>> Richard
>>
>>
>> On Tue, Mar 13, 2018 at 11:58 AM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Please try this :
>>>
>>> sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
>>> # setuptools should be there... I was miss leading...
>>> sudo pip3 install python-ldap
>>>
>>> Please provide progress as if auth_ldap.py works properly with python3
>>> once you install python-ldap properly under python3.
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>>
>>> On Tue, Mar 13, 2018 at 11:39 AM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
>>>> I open this issue :
>>>>
>>>> https://github.com/python-ldap/python-ldap/issues/181
>>>>
>>>> On Tue, Mar 13, 2018 at 11:03 AM, Richard Vézina <
>>>> ml.richard.vez...@gmail.com> wrote:
>>>>
>>>>> python3-ldap -> ldap3 (https://pypi.python.org/pypi/
>>>>> python3-ldap/0.9.8.4/) is not the same thing as python-ldap...
>>>>>
>>>>> It seems that python-ldap support python 3 :
>>>>>
>>>>> https://github.com/python-ldap/python-ldap
>>>>>
>>>>> Saddly enough, I hadn't successfully install python-ldap under python3
>>>>> with pip3... It fails over importing setuptools issue... Setuptools is
>>>>> installed, so I wonder what going on...
>>>>>
>>>>> It seems to be working with python 3.4+ : https://www.python-ldap.org/
>>>>> en/latest/installing.html#build-prerequisites
>>>>>
>>>>> If you have ubuntu you can try on your side :
>>>>>
>>>>> sudo pip3 install -U setuptools
>>>>> sudo pip3 install python-ldap
>>>>>
>>>>>
>>>>> It would be nice if python-ldap just works under python3 as we
>>>>> wouldn't have to touch ldap_auth.py as python-ldap should have keep the
>>>>> same API under python3...
>>>>>
>>>>> Though ldap3 seems to offer interresting progres, but I didn't try it.
>>>>>
>>>>> Please keep posting here your progress.
>>>>>
>>>>> Thanks
>>>>>
>>>>> Richard
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Mar 13, 2018 at 8:32 AM, Johann Spies <johann.sp...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Version 2.16.1
>>>>>>
>>>>>> In python (2.7) I can do:
>>>>>>
>>>>>> python web2py.py -S welcome
>>>>>> ..
>>>>>>
>>>>>> In [1]: from gluon.contrib.login_methods.ldap_auth import ldap_auth
>>>>>>
>>>>>> In [2]:
>>>>>>
>>>>>> But not when I use python3 (and I have python3-ldap installed).
>>>>>>
>>>>>>
>>>>>> ```
>>>>>> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
>>>>>> globals, locals, fromlist, level)
>>>>>> 109 import_tb = None
>>>>>> 110
>>>>>> --> 111 return NATIVE_IMPORTER(name, globals, locals, fromlist,
>>>>>> level)
>>>>>> 112
>>>>>> 113
>>>>>>
>>>>>> /home/js/web2py/gluon/contrib/login

Re: [web2py] Bug in ldap library for python3?

2018-03-13 Thread Richard Vézina
It works fine...

On Tue, Mar 13, 2018 at 12:28 PM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> I try with a module of mine using ldap and had issues with ldapS
> connection...
>
> I had to follow this :
>
> https://github.com/python-ldap/python-ldap/issues/55
>
> l = ldap.initialize("ldaps://{s}:{p}".format(s=server, p=636))
> l.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3)
> # l.set_option(ldap.OPT_X_TLS_CACERTFILE, 'path/to/ca.pem')  # Wasn't
> required...
> l.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap. OPT_X_TLS_NEVER)
> l.set_option(ldap.OPT_X_TLS_NEWCTX, 0)
>
> Then it connected properly under python3 only...
>
> Will make some test in python2 if the back port of the above cause any
> issue...
>
> Richard
>
>
> On Tue, Mar 13, 2018 at 11:58 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Please try this :
>>
>> sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
>> # setuptools should be there... I was miss leading...
>> sudo pip3 install python-ldap
>>
>> Please provide progress as if auth_ldap.py works properly with python3
>> once you install python-ldap properly under python3.
>>
>> Thanks
>>
>> Richard
>>
>>
>> On Tue, Mar 13, 2018 at 11:39 AM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> I open this issue :
>>>
>>> https://github.com/python-ldap/python-ldap/issues/181
>>>
>>> On Tue, Mar 13, 2018 at 11:03 AM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
>>>> python3-ldap -> ldap3 (https://pypi.python.org/pypi/
>>>> python3-ldap/0.9.8.4/) is not the same thing as python-ldap...
>>>>
>>>> It seems that python-ldap support python 3 :
>>>>
>>>> https://github.com/python-ldap/python-ldap
>>>>
>>>> Saddly enough, I hadn't successfully install python-ldap under python3
>>>> with pip3... It fails over importing setuptools issue... Setuptools is
>>>> installed, so I wonder what going on...
>>>>
>>>> It seems to be working with python 3.4+ : https://www.python-ldap.org/
>>>> en/latest/installing.html#build-prerequisites
>>>>
>>>> If you have ubuntu you can try on your side :
>>>>
>>>> sudo pip3 install -U setuptools
>>>> sudo pip3 install python-ldap
>>>>
>>>>
>>>> It would be nice if python-ldap just works under python3 as we wouldn't
>>>> have to touch ldap_auth.py as python-ldap should have keep the same API
>>>> under python3...
>>>>
>>>> Though ldap3 seems to offer interresting progres, but I didn't try it.
>>>>
>>>> Please keep posting here your progress.
>>>>
>>>> Thanks
>>>>
>>>> Richard
>>>>
>>>>
>>>>
>>>> On Tue, Mar 13, 2018 at 8:32 AM, Johann Spies <johann.sp...@gmail.com>
>>>> wrote:
>>>>
>>>>> Version 2.16.1
>>>>>
>>>>> In python (2.7) I can do:
>>>>>
>>>>> python web2py.py -S welcome
>>>>> ..
>>>>>
>>>>> In [1]: from gluon.contrib.login_methods.ldap_auth import ldap_auth
>>>>>
>>>>> In [2]:
>>>>>
>>>>> But not when I use python3 (and I have python3-ldap installed).
>>>>>
>>>>>
>>>>> ```
>>>>> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
>>>>> globals, locals, fromlist, level)
>>>>> 109 import_tb = None
>>>>> 110
>>>>> --> 111 return NATIVE_IMPORTER(name, globals, locals, fromlist,
>>>>> level)
>>>>> 112
>>>>> 113
>>>>>
>>>>> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
>>>>>  12 except Exception as e:
>>>>>  13 logging.error('missing ldap, try "easy_install
>>>>> python-ldap"')
>>>>> ---> 14 raise e
>>>>>  15
>>>>>  16
>>>>>
>>>>> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
>>>>>   7 import logging
>>>>>   8 try:
>>>>> > 9 import ldap
>>>>>  10 import ldap.filter
>>>>> 

Re: [web2py] Bug in ldap library for python3?

2018-03-13 Thread Richard Vézina
I try with a module of mine using ldap and had issues with ldapS
connection...

I had to follow this :

https://github.com/python-ldap/python-ldap/issues/55

l = ldap.initialize("ldaps://{s}:{p}".format(s=server, p=636))
l.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3)
# l.set_option(ldap.OPT_X_TLS_CACERTFILE, 'path/to/ca.pem')  # Wasn't
required...
l.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap. OPT_X_TLS_NEVER)
l.set_option(ldap.OPT_X_TLS_NEWCTX, 0)

Then it connected properly under python3 only...

Will make some test in python2 if the back port of the above cause any
issue...

Richard


On Tue, Mar 13, 2018 at 11:58 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> Please try this :
>
> sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
> # setuptools should be there... I was miss leading...
> sudo pip3 install python-ldap
>
> Please provide progress as if auth_ldap.py works properly with python3
> once you install python-ldap properly under python3.
>
> Thanks
>
> Richard
>
>
> On Tue, Mar 13, 2018 at 11:39 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> I open this issue :
>>
>> https://github.com/python-ldap/python-ldap/issues/181
>>
>> On Tue, Mar 13, 2018 at 11:03 AM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> python3-ldap -> ldap3 (https://pypi.python.org/pypi/
>>> python3-ldap/0.9.8.4/) is not the same thing as python-ldap...
>>>
>>> It seems that python-ldap support python 3 :
>>>
>>> https://github.com/python-ldap/python-ldap
>>>
>>> Saddly enough, I hadn't successfully install python-ldap under python3
>>> with pip3... It fails over importing setuptools issue... Setuptools is
>>> installed, so I wonder what going on...
>>>
>>> It seems to be working with python 3.4+ : https://www.python-ldap.org/
>>> en/latest/installing.html#build-prerequisites
>>>
>>> If you have ubuntu you can try on your side :
>>>
>>> sudo pip3 install -U setuptools
>>> sudo pip3 install python-ldap
>>>
>>>
>>> It would be nice if python-ldap just works under python3 as we wouldn't
>>> have to touch ldap_auth.py as python-ldap should have keep the same API
>>> under python3...
>>>
>>> Though ldap3 seems to offer interresting progres, but I didn't try it.
>>>
>>> Please keep posting here your progress.
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>>
>>>
>>> On Tue, Mar 13, 2018 at 8:32 AM, Johann Spies <johann.sp...@gmail.com>
>>> wrote:
>>>
>>>> Version 2.16.1
>>>>
>>>> In python (2.7) I can do:
>>>>
>>>> python web2py.py -S welcome
>>>> ..
>>>>
>>>> In [1]: from gluon.contrib.login_methods.ldap_auth import ldap_auth
>>>>
>>>> In [2]:
>>>>
>>>> But not when I use python3 (and I have python3-ldap installed).
>>>>
>>>>
>>>> ```
>>>> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
>>>> globals, locals, fromlist, level)
>>>> 109 import_tb = None
>>>> 110
>>>> --> 111 return NATIVE_IMPORTER(name, globals, locals, fromlist,
>>>> level)
>>>> 112
>>>> 113
>>>>
>>>> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
>>>>  12 except Exception as e:
>>>>  13 logging.error('missing ldap, try "easy_install
>>>> python-ldap"')
>>>> ---> 14 raise e
>>>>  15
>>>>  16
>>>>
>>>> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
>>>>   7 import logging
>>>>   8 try:
>>>> > 9 import ldap
>>>>  10 import ldap.filter
>>>>  11 ldap.set_option(ldap.OPT_REFERRALS, 0)
>>>>
>>>> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
>>>> globals, locals, fromlist, level)
>>>> 102 return NATIVE_IMPORTER(name, globals, locals,
>>>> fromlist, level)
>>>> 103 except (ImportError, KeyError) as e3:
>>>> --> 104 raise ImportError(e1, import_tb)  # there an
>>>> import error in the module
>>>> 105 except Exception as e2:
>>>> 106  

Re: [web2py] Bug in ldap library for python3?

2018-03-13 Thread Richard Vézina
Please try this :

sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
# setuptools should be there... I was miss leading...
sudo pip3 install python-ldap

Please provide progress as if auth_ldap.py works properly with python3 once
you install python-ldap properly under python3.

Thanks

Richard


On Tue, Mar 13, 2018 at 11:39 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> I open this issue :
>
> https://github.com/python-ldap/python-ldap/issues/181
>
> On Tue, Mar 13, 2018 at 11:03 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> python3-ldap -> ldap3 (https://pypi.python.org/pypi/python3-ldap/0.9.8.4/)
>> is not the same thing as python-ldap...
>>
>> It seems that python-ldap support python 3 :
>>
>> https://github.com/python-ldap/python-ldap
>>
>> Saddly enough, I hadn't successfully install python-ldap under python3
>> with pip3... It fails over importing setuptools issue... Setuptools is
>> installed, so I wonder what going on...
>>
>> It seems to be working with python 3.4+ : https://www.python-ldap.org/
>> en/latest/installing.html#build-prerequisites
>>
>> If you have ubuntu you can try on your side :
>>
>> sudo pip3 install -U setuptools
>> sudo pip3 install python-ldap
>>
>>
>> It would be nice if python-ldap just works under python3 as we wouldn't
>> have to touch ldap_auth.py as python-ldap should have keep the same API
>> under python3...
>>
>> Though ldap3 seems to offer interresting progres, but I didn't try it.
>>
>> Please keep posting here your progress.
>>
>> Thanks
>>
>> Richard
>>
>>
>>
>> On Tue, Mar 13, 2018 at 8:32 AM, Johann Spies <johann.sp...@gmail.com>
>> wrote:
>>
>>> Version 2.16.1
>>>
>>> In python (2.7) I can do:
>>>
>>> python web2py.py -S welcome
>>> ..
>>>
>>> In [1]: from gluon.contrib.login_methods.ldap_auth import ldap_auth
>>>
>>> In [2]:
>>>
>>> But not when I use python3 (and I have python3-ldap installed).
>>>
>>>
>>> ```
>>> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
>>> globals, locals, fromlist, level)
>>> 109 import_tb = None
>>> 110
>>> --> 111 return NATIVE_IMPORTER(name, globals, locals, fromlist,
>>> level)
>>> 112
>>> 113
>>>
>>> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
>>>  12 except Exception as e:
>>>  13 logging.error('missing ldap, try "easy_install python-ldap"')
>>> ---> 14 raise e
>>>  15
>>>  16
>>>
>>> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
>>>   7 import logging
>>>   8 try:
>>> > 9 import ldap
>>>  10 import ldap.filter
>>>  11 ldap.set_option(ldap.OPT_REFERRALS, 0)
>>>
>>> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
>>> globals, locals, fromlist, level)
>>> 102 return NATIVE_IMPORTER(name, globals, locals,
>>> fromlist, level)
>>> 103 except (ImportError, KeyError) as e3:
>>> --> 104 raise ImportError(e1, import_tb)  # there an
>>> import error in the module
>>> 105 except Exception as e2:
>>> 106 raise  # there is an error in the module
>>>
>>> ImportError: (ImportError("Cannot import module
>>> 'applications.welcome.modules.ldap'",), >> 0x7fe54161fd88>)
>>>
>>> ```
>>>
>>> It seems to me like a bug?
>>>
>>> Regards
>>> Johann
>>>
>>> --
>>> Because experiencing your loyal love is better than life itself,
>>> my lips will praise you.  (Psalm 63:3)
>>>
>>> --
>>> 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] Bug in ldap library for python3?

2018-03-13 Thread Richard Vézina
I open this issue :

https://github.com/python-ldap/python-ldap/issues/181

On Tue, Mar 13, 2018 at 11:03 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> python3-ldap -> ldap3 (https://pypi.python.org/pypi/python3-ldap/0.9.8.4/)
> is not the same thing as python-ldap...
>
> It seems that python-ldap support python 3 :
>
> https://github.com/python-ldap/python-ldap
>
> Saddly enough, I hadn't successfully install python-ldap under python3
> with pip3... It fails over importing setuptools issue... Setuptools is
> installed, so I wonder what going on...
>
> It seems to be working with python 3.4+ : https://www.python-ldap.org/
> en/latest/installing.html#build-prerequisites
>
> If you have ubuntu you can try on your side :
>
> sudo pip3 install -U setuptools
> sudo pip3 install python-ldap
>
>
> It would be nice if python-ldap just works under python3 as we wouldn't
> have to touch ldap_auth.py as python-ldap should have keep the same API
> under python3...
>
> Though ldap3 seems to offer interresting progres, but I didn't try it.
>
> Please keep posting here your progress.
>
> Thanks
>
> Richard
>
>
>
> On Tue, Mar 13, 2018 at 8:32 AM, Johann Spies <johann.sp...@gmail.com>
> wrote:
>
>> Version 2.16.1
>>
>> In python (2.7) I can do:
>>
>> python web2py.py -S welcome
>> ..
>>
>> In [1]: from gluon.contrib.login_methods.ldap_auth import ldap_auth
>>
>> In [2]:
>>
>> But not when I use python3 (and I have python3-ldap installed).
>>
>>
>> ```
>> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
>> globals, locals, fromlist, level)
>> 109 import_tb = None
>> 110
>> --> 111 return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
>> 112
>> 113
>>
>> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
>>  12 except Exception as e:
>>  13 logging.error('missing ldap, try "easy_install python-ldap"')
>> ---> 14 raise e
>>  15
>>  16
>>
>> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
>>   7 import logging
>>   8 try:
>> > 9 import ldap
>>  10 import ldap.filter
>>  11 ldap.set_option(ldap.OPT_REFERRALS, 0)
>>
>> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
>> globals, locals, fromlist, level)
>> 102 return NATIVE_IMPORTER(name, globals, locals,
>> fromlist, level)
>> 103 except (ImportError, KeyError) as e3:
>> --> 104 raise ImportError(e1, import_tb)  # there an
>> import error in the module
>> 105 except Exception as e2:
>> 106 raise  # there is an error in the module
>>
>> ImportError: (ImportError("Cannot import module
>> 'applications.welcome.modules.ldap'",), > 0x7fe54161fd88>)
>>
>> ```
>>
>> It seems to me like a bug?
>>
>> Regards
>> Johann
>>
>> --
>> Because experiencing your loyal love is better than life itself,
>> my lips will praise you.  (Psalm 63:3)
>>
>> --
>> 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] Bug in ldap library for python3?

2018-03-13 Thread Richard Vézina
python3-ldap -> ldap3 (https://pypi.python.org/pypi/python3-ldap/0.9.8.4/)
is not the same thing as python-ldap...

It seems that python-ldap support python 3 :

https://github.com/python-ldap/python-ldap

Saddly enough, I hadn't successfully install python-ldap under python3 with
pip3... It fails over importing setuptools issue... Setuptools is
installed, so I wonder what going on...

It seems to be working with python 3.4+ :
https://www.python-ldap.org/en/latest/installing.html#build-prerequisites

If you have ubuntu you can try on your side :

sudo pip3 install -U setuptools
sudo pip3 install python-ldap


It would be nice if python-ldap just works under python3 as we wouldn't
have to touch ldap_auth.py as python-ldap should have keep the same API
under python3...

Though ldap3 seems to offer interresting progres, but I didn't try it.

Please keep posting here your progress.

Thanks

Richard



On Tue, Mar 13, 2018 at 8:32 AM, Johann Spies 
wrote:

> Version 2.16.1
>
> In python (2.7) I can do:
>
> python web2py.py -S welcome
> ..
>
> In [1]: from gluon.contrib.login_methods.ldap_auth import ldap_auth
>
> In [2]:
>
> But not when I use python3 (and I have python3-ldap installed).
>
>
> ```
> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
> globals, locals, fromlist, level)
> 109 import_tb = None
> 110
> --> 111 return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
> 112
> 113
>
> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
>  12 except Exception as e:
>  13 logging.error('missing ldap, try "easy_install python-ldap"')
> ---> 14 raise e
>  15
>  16
>
> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
>   7 import logging
>   8 try:
> > 9 import ldap
>  10 import ldap.filter
>  11 ldap.set_option(ldap.OPT_REFERRALS, 0)
>
> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
> globals, locals, fromlist, level)
> 102 return NATIVE_IMPORTER(name, globals, locals,
> fromlist, level)
> 103 except (ImportError, KeyError) as e3:
> --> 104 raise ImportError(e1, import_tb)  # there an
> import error in the module
> 105 except Exception as e2:
> 106 raise  # there is an error in the module
>
> ImportError: (ImportError("Cannot import module
> 'applications.welcome.modules.ldap'",),  0x7fe54161fd88>)
>
> ```
>
> It seems to me like a bug?
>
> Regards
> Johann
>
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>
> --
> 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] Book need update on recaptcha v2

2018-03-13 Thread Richard Vézina
Can you update the book and send a Pull Request through github??

Thank you

Richard

On Thu, Mar 8, 2018 at 7:28 PM, Alexander Scarlat MD 
wrote:

>
> As of 2018 March 31 Google doesn't support reCaptcha V1 anymore.
> I thought the book should be updated with the following modification:
>
> instead of *Recaptcha* it should be *Recaptcha2*
>
> from gluon.tools import *Recaptcha2*
> auth.settings.captcha = *Recaptcha2*(request,'PUBLIC_KEY','SECRET_KEY')
>
> and no need for the ssl parameter as V2 is by default ssl=True...
>
> Thanks for a great framework and a greater community !
> 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.
>

-- 
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] CPU 210%

2018-03-08 Thread Richard Vézina
Couples of folks seem to work over performance tuning right now, so I
thought bring that thread UP would give some cues

On Tue, Feb 19, 2013 at 12:02 PM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> Ok, find thanks for clarification.
>
> Richard
>
>
> On Tue, Feb 19, 2013 at 11:30 AM, Niphlod <niph...@gmail.com> wrote:
>
>> No, it's not a parameter.
>> He was just explaining that pool_size = 1 may be "weird to look at", and
>> to think at it AS "recycle_connection=True".
>>
>> On Tuesday, February 19, 2013 5:16:29 PM UTC+1, Richard wrote:
>>
>>> Hello Michele,
>>>
>>> recycle_connection=True is a web2py connection string parameters? I
>>> didn't see entry in the book, maybe it is not documented yet?!
>>>
>>> Richard
>>>
>>>
>>> On Mon, Feb 18, 2013 at 5:50 PM, Michele Comitini <michele@gmail.com
>>> > wrote:
>>>
>>>> Niphold explanation is better than anything I could come out with.
>>>>
>>>> One could ask why pool_size=1 and not pool_size=0 then?
>>>> A pool of one seems logical nonsense, but it works.
>>>> 1 means that we keep recycling that same connection that is bound to
>>>> the non-threading process.
>>>> Think "recycle_connection=True" and write it as "pool_size=1"
>>>>
>>>> mic
>>>>
>>>>
>>>> 2013/2/18 Richard Vézina <ml.richa...@gmail.com>:
>>>> > Thanks Niphold for clarification, really appreciate.
>>>> >
>>>> > Richard
>>>> >
>>>> >
>>>> > On Mon, Feb 18, 2013 at 4:17 PM, Niphlod <nip...@gmail.com> wrote:
>>>> >>
>>>> >> it "easy". if you run web2py using threads, then pooling is ok,
>>>> since it's
>>>> >> managed in a single process, recycling connections in a pool for
>>>> each new
>>>> >> thread that processes a request, and speeds up things a lot.
>>>> >>
>>>> >> A lot of webserver though use a single process to handle every
>>>> request,
>>>> >> using fork() (gunicorn, uwsgi, and so on) to provide
>>>> concurrency. It
>>>> >> means that there are n processes able to serve up to n requests
>>>> >> concurrently.
>>>> >> In that case, there are no threads involved, so there's no need to
>>>> use a
>>>> >> pool, because every request is handled in a "freshly created" new
>>>> single
>>>> >> process.
>>>> >>
>>>> >> --
>>>> >>
>>>> >> ---
>>>> >> 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/groups/opt_out.
>>>> >>
>>>> >>
>>>> >
>>>> >
>>>> > --
>>>> >
>>>> > ---
>>>> > You received this message because you are subscribed to the Google
>>>> Groups
>>>> > "web2py-users" group.
>>>> > To unsubscribe from this group and stop receiving emails from it,
>>>> send an
>>>> > email to web2py+un...@googlegroups.com.
>>>>
>>>> > For more options, visit https://groups.google.com/groups/opt_out.
>>>> >
>>>> >
>>>>
>>>> --
>>>>
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "web2py-users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to web2py+un...@googlegroups.com.
>>>>
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>>
>>> --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>

-- 
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] Unit testing apis

2018-03-07 Thread Richard Vézina
I do have customized web2py.test while integrating some of welcome_enhanced
stuff like using splinter api for conducting testing + create a test
launcher to save some boiler plate initialization... I just don't have time
to exectract it form my own app and publish it... It rely on pytest... It
gear around system testing more than unit testing though...

On Wed, Mar 7, 2018 at 1:12 PM, Yoel Benítez Fonseca 
wrote:

> idk if that is the right way... i'm using this approach in on of my
> projects and at the moment the only problem i have is with the memory usage
> or the slow access with a file base sqlite database for the tests.
>
>
> On Wed, Mar 7, 2018 at 1:08 PM, António Ramos 
> wrote:
>
>> Next chapter in web2py book
>>
>> Pytest your app the right way
>>
>> 2018-03-07 18:02 GMT+00:00 Yoel Benítez Fonseca :
>>
>>> H!
>>>
>>> checkout: https://github.com/viniciusban/web2py.test
>>>
>>>
>>>
>>> On Wed, Mar 7, 2018 at 10:10 AM, Kevin Huang  wrote:
>>>

 Hi all,


 I'm relatively new to web2py, and still trying to find more resources,
 but i've hit a wall, and I'm not quite sure on this issue I'm working with:


 So working with the "guide" from http://web2py.com/AlterEgo/def
 ault/show/260, I'm trying to create a few unit tests to test some
 RESTFUL api functions. However, while testing multiple test suites, it
 seems that the request information is carrying over somehow despite my
 attempts to make sure that I start with a new request object via setUp each
 time.

 The tests will run just fine if they're alone in the suite, but running
 some of them after the other I was running into HTTP 400 errors and during
 debugging I found out that the request data carrying over.

 Some "sample" code to illustrate what I was trying to do...

 import unittest
 from gluon.globals import Request

 # import api code
 execfile("applications/appname/controllers/app_api.py", globals())class


 # Test Put api
 TestPutAPI(unittest.TestCase):

  def setUp(self):
request = Request(env=[])  # new request, env must be set.

  def test_some_function(self):
request.vars['var1'] = 1
request.vars['var2'] = 2
request.env.request_method = 'PUT'
response = api() # call api

self.assertEquals(response['result'], 'success')

   def tearDown(self):
db.table.truncate()  # clean up db (nothing request related here)


 # Test Post api
 TestPostAPI(unittest.TestCase):

  def setUp(self):
request = Request(env=[])  # new request

  def test_some_function(self):
request.vars['var5'] = "asdf"
request.vars['var6'] = 6
request.env.request_method = 'POST'
response = api() # call api

self.assertEquals(response['result'], 'success')

  def tearDown(self):
db.table.truncate()  # clean up db (nothing request related here)


 # Run tests
 suite = unittest.TestSuite()
 suite.addTest(unittest.makeSuite(TestPutAPI))
 suite.addTest(unittest.makeSuite(TestPostAPI))

 unittest.TextTestRunner(verbosity=2).run(suite)


 Is my entire approach to unit testing wrong? I know there's a lot a
 mention of doctests being recommended, also that the line request =
 Request() recommended by the original article also being wrong (or simply
 out of date), but I'm also unsure of how the request and api call is being
 processed in this scenario. Earlier I tried doing 2 calls to the same api
 in one test function and found that web2py (and this unittest) simply could
 not overwrite the request function - if that made any sense (it didn't, and
 didn't work).

 Anyone have any pointers?

 Thank you,
 KH


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

Re: [web2py] Re: new style of welcome app

2018-03-07 Thread Richard Vézina
Did you flush you browser cache??

On Wed, Mar 7, 2018 at 2:40 PM, Andrea Fae'  wrote:

> Thanks Anthony, but LOGIN is still in the left side...
>
>
> 
>
>
> Il giorno lunedì 5 marzo 2018 13:18:50 UTC+1, Anthony ha scritto:
>>
>> On Sunday, March 4, 2018 at 12:12:45 PM UTC-5, Andrea Fae' wrote:
>>>
>>> I have different apps in my web2py environments. Web2py apps built
>>> before a certain date have a stile with "login" link in the right upper
>>> side of the web page, while the new apps, for example welcome app are with
>>> another style with login link anchor in the left side, just after the
>>> menus, and after a "search" box. Why?
>>> How to delete the search box and have the login in the right part of the
>>> page?
>>>
>>
>> You can copy the layout from the old welcome app if you prefer it.
>> Otherwise, you'll have to customize the new layout to your liking. The
>> search box is just 3 lines that you can delete. Regarding the login, it is
>> already pushed to the right side of the screen.
>>
>> 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.
>

-- 
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: Unexpected behaviour executing a query with DAL and record versioning enabled

2018-03-07 Thread Richard Vézina
That why I think you wrongly initialize you db in the first place while
onboarding the record versioning feature...

Please try on your side to create new app drop the model and fixture I
include in one of my last email and start web2py shell and launch the
various commands of yours...

You should get the same output number of record...

If you don't it might happen that there was a bug in 2.15.4 web2py version
/ pyDAL...

Try new version...

On Wed, Mar 7, 2018 at 2:05 PM, Richard Vézina <ml.richard.vez...@gmail.com>
wrote:

> In [4]: query = (test2.type_marker=='object') | (test2.type_marker==None)
> & (test1.type_marker=='person')
>...:
>
> In [5]: db().select(db.test.ALL)
> Out[5]: 
>
> I did there...
>
> Same result...
>
> That my point...
>
> On Wed, Mar 7, 2018 at 1:47 PM, 'Awe' via web2py-users <
> web2py@googlegroups.com> wrote:
>
>> Hello Richard,
>> you are right, the use case is parent child relation.
>> All I want to point out is if you use this query:
>> "query = (test2.type_marker=='object') | (test2.type_marker==None) &
>> (test1.type_marker=='person')"
>> you do not get the same result with record versioning enabled or disabled.
>>
>> Why do I use this query definition because I want to retrieve exactly
>> this result:
>> test1.titletest2.title
>> PeterNone
>> PaulLaptop
>>
>> If you use this query instead:
>> (test2.type_marker=='object') & (test1.type_marker=='person')
>> you do not get the result I need.
>>
>> The " | (test2.type_marker==None) " is necessary, due to parent/child
>> relationship.
>>
>> Please try exactly the query mentioned using versioning enabled/disabled
>> and see what happens.
>>
>> Many thanks for your patience.
>>
>> Am Mittwoch, 7. März 2018 19:34:41 UTC+1 schrieb Richard:
>>>
>>> I don't get it, I don't understand what is the issue...
>>>
>>> I just demonstrate that with and without record versioning DAL returns
>>> the same set of result which what it should be doing no??
>>>
>>> So my understanding of the issue is that you don't get the same query
>>> output when record versioning is on and when it off which to me should is
>>> the issue you point us... I migth not understand the exact problem you have.
>>>
>>> But to me this "query = (test2.type_marker=='object') |
>>> (test2.type_marker==None) & (test1.type_marker=='person')"
>>>
>>> or this "query = (test2.type_marker=='object') &
>>> (test1.type_marker=='person')" with the set of inputs you have will lead to
>>> the same output as there is not type_marker NULL value...
>>>
>>> But I guess I miss something with related to what you try to achieve
>>> with this aliasing thing that you do...
>>>
>>> Also the use case is not obvious for me as why are you doing these
>>> aliases... I guess to retrieve some sort of genealogy/record parent-child
>>> relation...
>>>
>>> Richard
>>>
>>>
>>> On Wed, Mar 7, 2018 at 12:17 PM, 'Awe' via web2py-users <
>>> web...@googlegroups.com> wrote:
>>>
>>>> Hello Richard,
>>>> have read your post 3 times, but I can't find the right query result.
>>>> Could you tell me where to find in your test the query which leads to:
>>>> test1.titletest2.title
>>>> PeterNone
>>>> PaulLaptop
>>>>
>>>> Thank you.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Am Mittwoch, 7. März 2018 17:33:33 UTC+1 schrieb Richard:
>>>>
>>>>> Here some tests :
>>>>>
>>>>> *WITH record versioning*
>>>>>
>>>>> In [1]: db(db.test.id < 0).select()
>>>>> Out[1]: 
>>>>>
>>>>> In [2]: db(db.test.id > 0).select()
>>>>> Out[2]: 
>>>>>
>>>>> In [3]: test1 = db.test.with_alias('test1')
>>>>>
>>>>> In [4]: test2 = db.test.with_alias('test2')
>>>>>
>>>>> In [5]: query = (test2.type_marker=='object') |
>>>>> (test2.type_marker==None) & (test1.type_marker=='person')
>>>>>
>>>>> In [6]: db().select(current.db.test.ALL)
>>>>> 
>>>>> ---
>>>>> NameError 

Re: [web2py] Re: Unexpected behaviour executing a query with DAL and record versioning enabled

2018-03-07 Thread Richard Vézina
In [4]: query = (test2.type_marker=='object') | (test2.type_marker==None) &
(test1.type_marker=='person')
   ...:

In [5]: db().select(db.test.ALL)
Out[5]: 

I did there...

Same result...

That my point...

On Wed, Mar 7, 2018 at 1:47 PM, 'Awe' via web2py-users <
web2py@googlegroups.com> wrote:

> Hello Richard,
> you are right, the use case is parent child relation.
> All I want to point out is if you use this query:
> "query = (test2.type_marker=='object') | (test2.type_marker==None) &
> (test1.type_marker=='person')"
> you do not get the same result with record versioning enabled or disabled.
>
> Why do I use this query definition because I want to retrieve exactly this
> result:
> test1.titletest2.title
> PeterNone
> PaulLaptop
>
> If you use this query instead:
> (test2.type_marker=='object') & (test1.type_marker=='person')
> you do not get the result I need.
>
> The " | (test2.type_marker==None) " is necessary, due to parent/child
> relationship.
>
> Please try exactly the query mentioned using versioning enabled/disabled
> and see what happens.
>
> Many thanks for your patience.
>
> Am Mittwoch, 7. März 2018 19:34:41 UTC+1 schrieb Richard:
>>
>> I don't get it, I don't understand what is the issue...
>>
>> I just demonstrate that with and without record versioning DAL returns
>> the same set of result which what it should be doing no??
>>
>> So my understanding of the issue is that you don't get the same query
>> output when record versioning is on and when it off which to me should is
>> the issue you point us... I migth not understand the exact problem you have.
>>
>> But to me this "query = (test2.type_marker=='object') |
>> (test2.type_marker==None) & (test1.type_marker=='person')"
>>
>> or this "query = (test2.type_marker=='object') &
>> (test1.type_marker=='person')" with the set of inputs you have will lead to
>> the same output as there is not type_marker NULL value...
>>
>> But I guess I miss something with related to what you try to achieve with
>> this aliasing thing that you do...
>>
>> Also the use case is not obvious for me as why are you doing these
>> aliases... I guess to retrieve some sort of genealogy/record parent-child
>> relation...
>>
>> Richard
>>
>>
>> On Wed, Mar 7, 2018 at 12:17 PM, 'Awe' via web2py-users <
>> web...@googlegroups.com> wrote:
>>
>>> Hello Richard,
>>> have read your post 3 times, but I can't find the right query result.
>>> Could you tell me where to find in your test the query which leads to:
>>> test1.titletest2.title
>>> PeterNone
>>> PaulLaptop
>>>
>>> Thank you.
>>>
>>>
>>>
>>>
>>>
>>> Am Mittwoch, 7. März 2018 17:33:33 UTC+1 schrieb Richard:
>>>
 Here some tests :

 *WITH record versioning*

 In [1]: db(db.test.id < 0).select()
 Out[1]: 

 In [2]: db(db.test.id > 0).select()
 Out[2]: 

 In [3]: test1 = db.test.with_alias('test1')

 In [4]: test2 = db.test.with_alias('test2')

 In [5]: query = (test2.type_marker=='object') |
 (test2.type_marker==None) & (test1.type_marker=='person')

 In [6]: db().select(current.db.test.ALL)
 
 ---
 NameError Traceback (most recent call
 last)
 /web2py_master_trunk/web2py/applications/test_versioning_issue/models/menu.py
 in ()
 > 1 db().select(current.db.test.ALL)

 NameError: name 'current' is not defined

 In [7]: db().select(db.test.ALL)
 Out[7]: 

 In [8]: query = (test2.type_marker=='object') &
 (test1.type_marker=='person')

 In [9]: db().select(db.test.ALL)
 Out[9]: 

 In [10]: db(query).select(test1.title, test2.title, left=test2.on(
 test1.id==test2.granny))
 Out[10]: 

 In [11]: db(query)._select(test1.title, test2.title, left=test2.on(
 test1.id==test2.granny))
 Out[11]: 'SELECT "test1"."title", "test2"."title" FROM "test" AS
 "test1" LEFT JOIN "test" AS "test2" ON (("test1"."id" = "test2"."granny")
 AND (("test1"."is_active" = \'T\') AND ("test2"."is_active" = \'T\')))
 WHERE "test2"."type_marker" = \'object\') AND ("test1"."type_marker" =
 \'person\')) AND (("test1"."is_active" = \'T\') AND ("test2"."is_active" =
 \'T\'))) AND (("test1"."is_active" = \'T\') AND ("test2"."is_active" =
 \'T\')));'

 In [12]: print db().select(db.test.ALL)
 test.id,test.title,test.granny,test.type_marker,test.is_
 active,test.created_on,test.created_by,test.modified_on,
 test.modified_by
 1,Peter,,person,True,2018-03-07 11:10:08,,2018-03-07
 11:10:08,
 2,Paul,,person,True,2018-03-07 11:10:08,,2018-03-07
 11:10:08,
 3,Laptop,2,object,True,2018-03-07 11:10:08,,2018-03-07
 11:10:08,


 *WITHOUT record versioning*

 In [1]: db(db.test.id > 0).select()
 Out[1]: 

 In [2]:  test1 = 

Re: [web2py] Re: Unexpected behaviour executing a query with DAL and record versioning enabled

2018-03-07 Thread Richard Vézina
I don't get it, I don't understand what is the issue...

I just demonstrate that with and without record versioning DAL returns the
same set of result which what it should be doing no??

So my understanding of the issue is that you don't get the same query
output when record versioning is on and when it off which to me should is
the issue you point us... I migth not understand the exact problem you have.

But to me this "query = (test2.type_marker=='object') |
(test2.type_marker==None) & (test1.type_marker=='person')"

or this "query = (test2.type_marker=='object') &
(test1.type_marker=='person')" with the set of inputs you have will lead to
the same output as there is not type_marker NULL value...

But I guess I miss something with related to what you try to achieve with
this aliasing thing that you do...

Also the use case is not obvious for me as why are you doing these
aliases... I guess to retrieve some sort of genealogy/record parent-child
relation...

Richard


On Wed, Mar 7, 2018 at 12:17 PM, 'Awe' via web2py-users <
web2py@googlegroups.com> wrote:

> Hello Richard,
> have read your post 3 times, but I can't find the right query result.
> Could you tell me where to find in your test the query which leads to:
> test1.titletest2.title
> PeterNone
> PaulLaptop
>
> Thank you.
>
>
>
>
>
> Am Mittwoch, 7. März 2018 17:33:33 UTC+1 schrieb Richard:
>
>> Here some tests :
>>
>> *WITH record versioning*
>>
>> In [1]: db(db.test.id < 0).select()
>> Out[1]: 
>>
>> In [2]: db(db.test.id > 0).select()
>> Out[2]: 
>>
>> In [3]: test1 = db.test.with_alias('test1')
>>
>> In [4]: test2 = db.test.with_alias('test2')
>>
>> In [5]: query = (test2.type_marker=='object') | (test2.type_marker==None)
>> & (test1.type_marker=='person')
>>
>> In [6]: db().select(current.db.test.ALL)
>> 
>> ---
>> NameError Traceback (most recent call
>> last)
>> /web2py_master_trunk/web2py/applications/test_versioning_issue/models/menu.py
>> in ()
>> > 1 db().select(current.db.test.ALL)
>>
>> NameError: name 'current' is not defined
>>
>> In [7]: db().select(db.test.ALL)
>> Out[7]: 
>>
>> In [8]: query = (test2.type_marker=='object') &
>> (test1.type_marker=='person')
>>
>> In [9]: db().select(db.test.ALL)
>> Out[9]: 
>>
>> In [10]: db(query).select(test1.title, test2.title, left=test2.on(
>> test1.id==test2.granny))
>> Out[10]: 
>>
>> In [11]: db(query)._select(test1.title, test2.title, left=test2.on(
>> test1.id==test2.granny))
>> Out[11]: 'SELECT "test1"."title", "test2"."title" FROM "test" AS "test1"
>> LEFT JOIN "test" AS "test2" ON (("test1"."id" = "test2"."granny") AND
>> (("test1"."is_active" = \'T\') AND ("test2"."is_active" = \'T\'))) WHERE
>> "test2"."type_marker" = \'object\') AND ("test1"."type_marker" =
>> \'person\')) AND (("test1"."is_active" = \'T\') AND ("test2"."is_active" =
>> \'T\'))) AND (("test1"."is_active" = \'T\') AND ("test2"."is_active" =
>> \'T\')));'
>>
>> In [12]: print db().select(db.test.ALL)
>> test.id,test.title,test.granny,test.type_marker,test.is_
>> active,test.created_on,test.created_by,test.modified_on,test.modified_by
>> 1,Peter,,person,True,2018-03-07 11:10:08,,2018-03-07
>> 11:10:08,
>> 2,Paul,,person,True,2018-03-07 11:10:08,,2018-03-07
>> 11:10:08,
>> 3,Laptop,2,object,True,2018-03-07 11:10:08,,2018-03-07
>> 11:10:08,
>>
>>
>> *WITHOUT record versioning*
>>
>> In [1]: db(db.test.id > 0).select()
>> Out[1]: 
>>
>> In [2]:  test1 = db.test.with_alias('test1')
>>
>> In [3]: test2 = db.test.with_alias('test2')
>>
>> In [4]: query = (test2.type_marker=='object') | (test2.type_marker==None)
>> & (test1.type_marker=='person')
>>...:
>>
>> In [5]: db().select(db.test.ALL)
>> Out[5]: 
>>
>> In [6]: query = (test2.type_marker=='object') &
>> (test1.type_marker=='person')
>>
>> In [7]: db().select(db.test.ALL)
>> Out[7]: 
>>
>> In [8]: db(query).select(test1.title, test2.title, left=test2.on(test1.id
>> ==test2.granny))
>> Out[8]: 
>>
>> In [9]: db(query)._select(test1.title, test2.title, left=test2.on(
>> test1.id==test2.granny))
>> Out[9]: 'SELECT "test1"."title", "test2"."title" FROM "test" AS "test1"
>> LEFT JOIN "test" AS "test2" ON ("test1"."id" = "test2"."granny") WHERE
>> (("test2"."type_marker" = \'object\') AND ("test1"."type_marker" =
>> \'person\'));'
>>
>> In [10]: print db().select(db.test.ALL)
>> test.id,test.title,test.granny,test.type_marker,test.is_
>> active,test.created_on,test.created_by,test.modified_on,test.modified_by
>> 1,Peter,,person,True,2018-03-07 11:10:08,,2018-03-07
>> 11:10:08,
>> 2,Paul,,person,True,2018-03-07 11:10:08,,2018-03-07
>> 11:10:08,
>> 3,Laptop,2,object,True,2018-03-07 11:10:08,,2018-03-07
>> 11:10:08,
>>
>>
>>
>>
>> *I have this in db.py of a newly created app with web2py trunk/master :*
>>
>> ```python
>> db.define_table('test',
>>Field('title', 'string'),
>>Field('granny', 

Re: [web2py] Re: Unexpected behaviour executing a query with DAL and record versioning enabled

2018-03-07 Thread Richard Vézina
Here some tests :

*WITH record versioning*

In [1]: db(db.test.id < 0).select()
Out[1]: 

In [2]: db(db.test.id > 0).select()
Out[2]: 

In [3]: test1 = db.test.with_alias('test1')

In [4]: test2 = db.test.with_alias('test2')

In [5]: query = (test2.type_marker=='object') | (test2.type_marker==None) &
(test1.type_marker=='person')

In [6]: db().select(current.db.test.ALL)
---
NameError Traceback (most recent call last)
/web2py_master_trunk/web2py/applications/test_versioning_issue/models/menu.py
in ()
> 1 db().select(current.db.test.ALL)

NameError: name 'current' is not defined

In [7]: db().select(db.test.ALL)
Out[7]: 

In [8]: query = (test2.type_marker=='object') &
(test1.type_marker=='person')

In [9]: db().select(db.test.ALL)
Out[9]: 

In [10]: db(query).select(test1.title, test2.title, left=test2.on(test1.id
==test2.granny))
Out[10]: 

In [11]: db(query)._select(test1.title, test2.title, left=test2.on(test1.id
==test2.granny))
Out[11]: 'SELECT "test1"."title", "test2"."title" FROM "test" AS "test1"
LEFT JOIN "test" AS "test2" ON (("test1"."id" = "test2"."granny") AND
(("test1"."is_active" = \'T\') AND ("test2"."is_active" = \'T\'))) WHERE
"test2"."type_marker" = \'object\') AND ("test1"."type_marker" =
\'person\')) AND (("test1"."is_active" = \'T\') AND ("test2"."is_active" =
\'T\'))) AND (("test1"."is_active" = \'T\') AND ("test2"."is_active" =
\'T\')));'

In [12]: print db().select(db.test.ALL)
test.id
,test.title,test.granny,test.type_marker,test.is_active,test.created_on,test.created_by,test.modified_on,test.modified_by
1,Peter,,person,True,2018-03-07 11:10:08,,2018-03-07
11:10:08,
2,Paul,,person,True,2018-03-07 11:10:08,,2018-03-07
11:10:08,
3,Laptop,2,object,True,2018-03-07 11:10:08,,2018-03-07 11:10:08,


*WITHOUT record versioning*

In [1]: db(db.test.id > 0).select()
Out[1]: 

In [2]:  test1 = db.test.with_alias('test1')

In [3]: test2 = db.test.with_alias('test2')

In [4]: query = (test2.type_marker=='object') | (test2.type_marker==None) &
(test1.type_marker=='person')
   ...:

In [5]: db().select(db.test.ALL)
Out[5]: 

In [6]: query = (test2.type_marker=='object') &
(test1.type_marker=='person')

In [7]: db().select(db.test.ALL)
Out[7]: 

In [8]: db(query).select(test1.title, test2.title, left=test2.on(test1.id
==test2.granny))
Out[8]: 

In [9]: db(query)._select(test1.title, test2.title, left=test2.on(test1.id
==test2.granny))
Out[9]: 'SELECT "test1"."title", "test2"."title" FROM "test" AS "test1"
LEFT JOIN "test" AS "test2" ON ("test1"."id" = "test2"."granny") WHERE
(("test2"."type_marker" = \'object\') AND ("test1"."type_marker" =
\'person\'));'

In [10]: print db().select(db.test.ALL)
test.id
,test.title,test.granny,test.type_marker,test.is_active,test.created_on,test.created_by,test.modified_on,test.modified_by
1,Peter,,person,True,2018-03-07 11:10:08,,2018-03-07
11:10:08,
2,Paul,,person,True,2018-03-07 11:10:08,,2018-03-07
11:10:08,
3,Laptop,2,object,True,2018-03-07 11:10:08,,2018-03-07 11:10:08,




*I have this in db.py of a newly created app with web2py trunk/master :*

```python
db.define_table('test',
   Field('title', 'string'),
   Field('granny', 'reference test'),  # convenience -
topmost
   Field('type_marker', 'string'),
   auth.signature,
   )

db.test._enable_record_versioning(archive_db=db,
  archive_name='test_archive',
  current_record='current_record',
  is_active='is_active'
  )

if db(db.test.id > 0).count() == 0:
db.test.insert(title='Peter', granny=None, type_marker='person')
db.test.insert(title='Paul', granny=None, type_marker='person')
db.test.insert(title='Laptop', granny=2, type_marker='object')
```
You can start the web2py shell like this :

python web2py.py -a 'DUMMYPWD' -i 127.0.0.1 -p 8001 -S
test_versioning_issue -M



I don't notice any discrepency between both result, I mean I recover 3
records in both case... It makes sens that the raw query change to make
sure it select only active records...

It mays happen that you experiment an issue with the web2py version that
you use 2.15.4...

You may consider trying the above with a freshly create dummy app with the
db.py additions above and see by yourself... If you get the same results it
means that your own app may have been wrongly initialized in some way... If
yous till experiment the issue, try with the stable web2py version from the
web2py.com download page...

Please report here your progress...

If you determine that the issue is related to your old version of web2py,
please consider upgrade to the newer stable or wait for the next release
that Massimo's want to push soon.

Thanks

Richard

On Wed, Mar 7, 2018 at 5:35 AM, 'Awe' via web2py-users <

Re: [web2py] Re: Unexpected behaviour executing a query with DAL and record versioning enabled

2018-03-06 Thread Richard Vézina
Can you make a model definition with a fixture for loading the table, I
will make some test with trunk and various version to determine if it a
regression... Nevermind I just thought you provide that in the first
email... Let me have a look at that...

Richard



On Mon, Mar 5, 2018 at 2:02 PM, 'Awe' via web2py-users <
web2py@googlegroups.com> wrote:

> Hello Richard,
> it is not a problem of deleted or changed records. As shown in the
> example, there is the table and versioning defined. After that 3 records
> are inserted and then the query is executed.
> The defined query:
> query = (test2.type_marker=='object') | (test2.type_marker==None) &
> (test1.type_marker=='person')
> rows = current.db(query).select(test1.title, test2.title,
> left=test2.on(test1.id==test2.granny))
> does not give the right result.
> I appreciate your help, maybe the problem gets easier to understand if you
> try to test the given example.
> Many thanks,
> Andreas
>
>
> Am Montag, 5. März 2018 16:05:26 UTC+1 schrieb Richard:
>>
>> Did you set the actual record that have been deleted to is_active =
>> False?? Or all the records that haven't be deleted yet to TRUE?? You have
>> to go in your backend and do an update there
>>
>> UPDATE stored_item
>> SET is_active = TRUE
>>   WHERE is_active IS NULL
>>
>> If you didn't delete any record yet...
>>
>> You can also do it from web2py I guess with this command :
>>
>> db(db.stored_item.is_active == None).update(is_active=True)
>> db.commit()
>>
>> Then you both query should return the same thing... Or at least they
>> should...
>>
>> It important to initialize archive table and parent table properly when
>> you add audit trail table to an already existing table containing record.
>>
>> I encourage you to read the book about record versioning :
>> http://web2py.com/books/default/chapter/29/06/the-database
>> -abstraction-layer#Record-versioning
>>
>> Richard
>>
>> On Sun, Mar 4, 2018 at 12:53 PM, 'Awe' via web2py-users <
>> web...@googlegroups.com> wrote:
>>
>>> Hello Richard, many thanks for analyzing. Everything you wrote is
>>> completely right. But I still do not understand the behaviour explained
>>> before.
>>> If you look at the table posted before, all is_acitve Flags are TRUE.
>>> to get the result I need, I have defined:
>>> query = (test2.type_marker=='object') | (test2.type_marker==None) &
>>> (test1.type_marker=='person')
>>> rows = current.db(query).select(test1.title, test2.title,
>>> left=test2.on(test1.id==test2.granny))
>>>
>>> the raw sql of this query WITHOUT record versioning is fine.
>>> SELECT "test1"."title", "test2"."title" FROM "test" AS "test1" LEFT JOIN
>>> "test" AS "test2" ON ("test1"."id" = "test2"."granny") WHERE
>>> (("test2"."type_marker" = 'object') OR (("test2"."type_marker" IS NULL) AND
>>> ("test1"."type_marker" = 'person')));
>>> And the result is the way it suposed to be:
>>>
>>> test1.titletest2.title
>>> PeterNone
>>> PaulLaptop
>>>
>>> The result with record versioning enabled is different:
>>> test1.titletest2.title
>>> PaulLaptop
>>>
>>> Even when the is_acitve Field is defined like that:
>>>
>>> Field('is_active', 'boolean', writable=False, readable=False, 
>>> default=True,required=True, requires=IS_NOT_EMPTY()),
>>>
>>> So maybe I miss something? At the moment I still wonder why the identical 
>>> query comes to different results.
>>>
>>>
>>> Best regards, an many thanks for your help!
>>> Andreas
>>>
>>>
>>>
>>>
>>>
>>> Am Freitag, 2. März 2018 16:59:35 UTC+1 schrieb Richard:

 Hmmm... I think that if you have record versioning activated there
 shouldn't be any is_active row(s) with NULL value... I mean is_active flag
 is used to determine if the record in the "parent" table has been deleted
 or not, since you can truely deleted in case you use record versioning
 feature as all the previous record stated records contained in the
 versioning table reference the parent record in the parent table...

 And you see in the second example here :

 http://web2py.com/books/default/chapter/29/06/the-database-
 abstraction-layer?search=record+versioning#Record-versioning

 That is_active is set to default=True and there is this note :

 Notice the hidden boolean field called is_active and defaulting to
 True.

 So if you have activated record versioning feature over an already
 existing table you need to set is_active to TRUE for all the existing
 record once you start using the versioning feature and set the is_active to
 be mandatory...

 I guess it would make sens to change seconde book example in orther
 that is should be more obvious that is_active is mandatory like so :

 db.define_table('stored_item',
 Field('name'),
 Field('quantity', 'integer'),
 Field('is_active', 'boolean',
   

Re: [web2py] Re: please help us test trunk web2py

2018-03-05 Thread Richard Vézina
@pbreit, I think that if you clone recursive at start pull will be enough
to update you envrionement... You can assess which version of the pyDAL you
have once you pull, just go in gluon/packages/dal/CHANGES and check which
version is mention in the last change log there...

You can compare what is mention in web2py/CHANGELOG file... It appears to
be the only place where the link is establish about what is the given pyDAL
version that should be attached to a given version of web2py... I don't
find that very neat as if it got forgotten we don't have a proper way to
assess that we have the proper pyDAL version...

Richard

On Fri, Mar 2, 2018 at 1:56 PM, pbreit  wrote:

> Thanks. I've already cloned. But remained confused how to update
> correctly. Normally I would just "git pull" but am not sure if I need to do
> something else to make sure DAL updated, 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.
>

-- 
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: book help

2018-03-05 Thread Richard Vézina
Massimo has to push the merge stuff online once it get merge... If not
update is apply to the web site of the book even if change are merge they
still are not available...

Richard

On Sat, Mar 3, 2018 at 11:50 AM, villas  wrote:

> Where is the ASSIGNJS description in the book?
> In the Github repo for the book,  issue 369
>  was merged?
> Also, are we still waiting for ANY_OF too?
> Can someone who understands it,  please take a look.
> Many 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.
>

-- 
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: Unexpected behaviour executing a query with DAL and record versioning enabled

2018-03-05 Thread Richard Vézina
Did you set the actual record that have been deleted to is_active = False??
Or all the records that haven't be deleted yet to TRUE?? You have to go in
your backend and do an update there

UPDATE stored_item
SET is_active = TRUE
  WHERE is_active IS NULL

If you didn't delete any record yet...

You can also do it from web2py I guess with this command :

db(db.stored_item.is_active == None).update(is_active=True)
db.commit()

Then you both query should return the same thing... Or at least they
should...

It important to initialize archive table and parent table properly when you
add audit trail table to an already existing table containing record.

I encourage you to read the book about record versioning :
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Record-versioning

Richard

On Sun, Mar 4, 2018 at 12:53 PM, 'Awe' via web2py-users <
web2py@googlegroups.com> wrote:

> Hello Richard, many thanks for analyzing. Everything you wrote is
> completely right. But I still do not understand the behaviour explained
> before.
> If you look at the table posted before, all is_acitve Flags are TRUE.
> to get the result I need, I have defined:
> query = (test2.type_marker=='object') | (test2.type_marker==None) &
> (test1.type_marker=='person')
> rows = current.db(query).select(test1.title, test2.title,
> left=test2.on(test1.id==test2.granny))
>
> the raw sql of this query WITHOUT record versioning is fine.
> SELECT "test1"."title", "test2"."title" FROM "test" AS "test1" LEFT JOIN
> "test" AS "test2" ON ("test1"."id" = "test2"."granny") WHERE
> (("test2"."type_marker" = 'object') OR (("test2"."type_marker" IS NULL) AND
> ("test1"."type_marker" = 'person')));
> And the result is the way it suposed to be:
>
> test1.titletest2.title
> PeterNone
> PaulLaptop
>
> The result with record versioning enabled is different:
> test1.titletest2.title
> PaulLaptop
>
> Even when the is_acitve Field is defined like that:
>
> Field('is_active', 'boolean', writable=False, readable=False, 
> default=True,required=True, requires=IS_NOT_EMPTY()),
>
> So maybe I miss something? At the moment I still wonder why the identical 
> query comes to different results.
>
>
> Best regards, an many thanks for your help!
> Andreas
>
>
>
>
>
> Am Freitag, 2. März 2018 16:59:35 UTC+1 schrieb Richard:
>>
>> Hmmm... I think that if you have record versioning activated there
>> shouldn't be any is_active row(s) with NULL value... I mean is_active flag
>> is used to determine if the record in the "parent" table has been deleted
>> or not, since you can truely deleted in case you use record versioning
>> feature as all the previous record stated records contained in the
>> versioning table reference the parent record in the parent table...
>>
>> And you see in the second example here :
>>
>> http://web2py.com/books/default/chapter/29/06/the-database-
>> abstraction-layer?search=record+versioning#Record-versioning
>>
>> That is_active is set to default=True and there is this note :
>>
>> Notice the hidden boolean field called is_active and defaulting to True.
>>
>> So if you have activated record versioning feature over an already
>> existing table you need to set is_active to TRUE for all the existing
>> record once you start using the versioning feature and set the is_active to
>> be mandatory...
>>
>> I guess it would make sens to change seconde book example in orther that
>> is should be more obvious that is_active is mandatory like so :
>>
>> db.define_table('stored_item',
>> Field('name'),
>> Field('quantity', 'integer'),
>> Field('is_active', 'boolean',
>>   writable=False, readable=False, default=True, 
>> required=True, requires=IS_NOT_EMPTY()))
>>
>>
>>
>> That way you don't need to care about null value to get all the records
>> of the parent table and DAL is not bugged...
>>
>> Richard
>>
>> On Fri, Mar 2, 2018 at 9:22 AM, 'Awe' via web2py-users <
>> web...@googlegroups.com> wrote:
>>
>>> So, I did check it again:
>>>
>>> It seems that DAL is not able to handle a left join using ISNULL
>>> condition in combination with enabled record versioning.
>>> There are two "is active" checks within the left join: OK
>>> The next two upcoming ANDs to check "is_active" are not necessary and
>>> actually prohibit the query to work properly.
>>> To make this work it should be: AND (("test1"."is_active" = 'T') AND
>>> (("test2"."is_active" = 'T' OR ("test2"."is_active" ISNULL ))
>>> The two AND is active checks at the end of the query are not necessary
>>> at all (my opinion).
>>>
>>> Could somebody please verifiy this!
>>> Andreas
>>>
>>>
>>> Am Donnerstag, 1. März 2018 13:37:59 UTC+1 schrieb Awe:

 Hello,
 I post a simple step by step example, to explain.
 Doing a left join and using a where clause like: table.field==None
 Depending on _enable_record_versioning is enabled or not, 

Re: [web2py] Re: Unexpected behaviour executing a query with DAL and record versioning enabled

2018-03-02 Thread Richard Vézina
Hmmm... I think that if you have record versioning activated there
shouldn't be any is_active row(s) with NULL value... I mean is_active flag
is used to determine if the record in the "parent" table has been deleted
or not, since you can truely deleted in case you use record versioning
feature as all the previous record stated records contained in the
versioning table reference the parent record in the parent table...

And you see in the second example here :

http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=record+versioning#Record-versioning

That is_active is set to default=True and there is this note :

Notice the hidden boolean field called is_active and defaulting to True.

So if you have activated record versioning feature over an already existing
table you need to set is_active to TRUE for all the existing record once
you start using the versioning feature and set the is_active to be
mandatory...

I guess it would make sens to change seconde book example in orther that is
should be more obvious that is_active is mandatory like so :

db.define_table('stored_item',
Field('name'),
Field('quantity', 'integer'),
Field('is_active', 'boolean',
  writable=False, readable=False, default=True,
required=True, requires=IS_NOT_EMPTY()))



That way you don't need to care about null value to get all the records of
the parent table and DAL is not bugged...

Richard

On Fri, Mar 2, 2018 at 9:22 AM, 'Awe' via web2py-users <
web2py@googlegroups.com> wrote:

> So, I did check it again:
>
> It seems that DAL is not able to handle a left join using ISNULL condition
> in combination with enabled record versioning.
> There are two "is active" checks within the left join: OK
> The next two upcoming ANDs to check "is_active" are not necessary and
> actually prohibit the query to work properly.
> To make this work it should be: AND (("test1"."is_active" = 'T') AND
> (("test2"."is_active" = 'T' OR ("test2"."is_active" ISNULL ))
> The two AND is active checks at the end of the query are not necessary at
> all (my opinion).
>
> Could somebody please verifiy this!
> Andreas
>
>
> Am Donnerstag, 1. März 2018 13:37:59 UTC+1 schrieb Awe:
>>
>> Hello,
>> I post a simple step by step example, to explain.
>> Doing a left join and using a where clause like: table.field==None
>> Depending on _enable_record_versioning is enabled or not, I get different
>> results when executing the identical query.
>> The result when versioning is DISABLED is the correct one.
>>
>> 2.15.4-stable+timestamp.2017.09.02.04.02.22
>> (läuft auf Rocket 1.2.6, Python 2.7.12)
>> SQLite DB
>>
>> Example:
>>
>> #simple table:
>> current.db.define_table('test',
>>Field('title', 'string'),
>>Field('granny', 'reference test'),  # convenience -
>> topmost
>>Field('type_marker', 'string'),
>>auth.signature,
>>)
>> #versioning, enable/disable it
>> current.db.test._enable_record_versioning(archive_db=current.db,
>>   archive_name='test_archive',
>>   current_record='current_record',
>>   is_active='is_active'
>>   )
>>
>> #put some data in
>> #current.db.test.insert(**{'title': 'Peter', 'granny': None,
>> 'type_marker': 'person'})
>> #current.db.test.insert(**{'title': 'Paul', 'granny': None,
>> 'type_marker': 'person'})
>> #current.db.test.insert(**{'title': 'Laptop', 'granny': 2,
>> 'type_marker': 'object'})
>>
>> #so you get table content (enabled)t:
>> test.idtest.titletest.grannytest.type_marker
>> test.is_activetest.created_ontest.created_by
>> test.modified_ontest.modified_by
>> 1  Peter Noneperson
>> True2018-03-01 08:11:40Me2018-03-01
>> 08:11:40Me
>> 2  Paul  Noneperson
>> True2018-03-01 08:11:40Me2018-03-01
>> 08:11:40Me
>> 3  Laptop   2  object
>> True2018-03-01 08:11:40Me2018-03-01
>> 08:11:40Me
>>
>> #simple controller function
>> def demo():
>> test1=current.db.test.with_alias('test1')
>> test2=current.db.test.with_alias('test2')
>> query = (test2.type_marker=='object') | (test2.type_marker==None) &
>> (test1.type_marker=='person')
>> tbl = current.db().select(current.db.test.ALL)
>> rows = current.db(query).select(test1.title, test2.title,
>> left=test2.on(test1.id==test2.granny))
>> prn =  current.db(query)._select(test1.title, test2.title,
>> left=test2.on(test1.id==test2.granny))
>> return dict(tbl=tbl, rows=rows, prn=prn)
>>
>> Result/Output:
>> test1.titletest2.title
>> PaulLaptop
>>
>> Raw SQL:
>> SELECT "test1"."title", 

Re: [web2py] PostgreSQL 10.2

2018-03-01 Thread Richard Vézina
Base on this :
https://github.com/web2py/pydal/blob/466a39f13e443bbcc54db2d1ba6ed10196abf440/pydal/drivers.py#L45

web2py shouldn't enforce a specific version of psycopg2...

Are you using python 2 or python 3 and is your last psycopg2 version you
mention is install for the python version that you use web2py with??

Richard

On Thu, Mar 1, 2018 at 2:39 PM, Rob Paire  wrote:

> Hello web2py community!
>
> I am in the process of moving a 4 year old web2py application to a new
> server and I am having trouble getting the application to connect to
> PostgreSQL 10.2.  I am guessing because the version of psycopg2 driver in
> web2py is: 2.5.4 (dt dec pq3 ext)
>
> I installed the latest version of psycopg2 to my local Python installation
> and I can talk to the database, but how do I make web2py use the latest
> drivers? It is necessary to run from source to do this?
>
> Comments are appreciated.
>
> Thank you for your help!
> -Rob
>
> --
> 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: please help us test trunk web2py

2018-02-28 Thread Richard Vézina
Here the issue and a PR : https://github.com/web2py/pydal/pull/523

Please including it in the next release if it don't break anything... It
will help with backward (empty query) compatibility...

Thanks

Richard

On Tue, Feb 27, 2018 at 5:37 PM, Richard Vézina <ml.richard.vez...@gmail.com
> wrote:

> Out of _build_joins_for_select() itables_to_merge variable has only one
> table which is the one implicated in the join (in this case "auth_user")...
> But another merge_tablemaps() occurs in red below :
>
> if join:
> (
> # FIXME? ijoin_tables is never used
> ijoin_tables, ijoin_on, itables_to_merge, ijoin_on_tables,
> iimportant_tablenames, iexcluded, itablemap
> ) = self._build_joins_for_select(tablemap, join)
> tablemap = merge_tablemaps(tablemap, itables_to_merge)
> tablemap = merge_tablemaps(tablemap, itablemap)
> if left:
> (
> join_tables, join_on, tables_to_merge, join_on_tables,
> important_tablenames, excluded, jtablemap
> ) = self._build_joins_for_select(tablemap, left)
> tablemap = merge_tablemaps(tablemap, tables_to_merge)
> tablemap = merge_tablemaps(tablemap, jtablemap)
>
>
> So itables_to_merge get altered and get back to is previous state as it is
> at some point in _build_joins_for_select() (in red), but it was filtered
> in the stage in blue  :
>
> def _build_joins_for_select(self, tablenames, param):
> if not isinstance(param, (tuple, list)):
> param = [param]
> tablemap = {}
> for item in param:
> if isinstance(item, Expression):
> item = item.first
> key = item._tablename
> if tablemap.get(key, item) is not item:
> raise ValueError('Name conflict in table list: %s' % key)
> tablemap[key] = item
> join_tables = [
> t._tablename for t in param if not isinstance(t, Expression)
> ]
> join_on = [t for t in param if isinstance(t, Expression)]
> tables_to_merge = {}
> for t in join_on:
> tables_to_merge = merge_tablemaps(tables_to_merge,
> self.tables(t))
> join_on_tables = [t.first._tablename for t in join_on]
> for t in join_on_tables:
> print t
> if t in tables_to_merge:
> print t
> tables_to_merge.pop(t)
> important_tablenames = join_tables + join_on_tables + \
> list(tables_to_merge)
> excluded = [
> t for t in tablenames if t not in important_tablenames
> ]
> return (
> join_tables, join_on, tables_to_merge, join_on_tables,
> important_tablenames, excluded, tablemap
> )
>
>
> With the logic in merge_tablemaps() where things are reversed in big and
> small and big get update at the end it explains why itables_to_merge get
> modified by merge_tablemaps()
>
> def merge_tablemaps(*maplist):
> """Merge arguments into a single dict, check for name collisions.
> Arguments may be modified in the process."""
> ret = maplist[0]
> for item in maplist[1:]:
> if len(ret) > len(item):
> big, small = ret, item
> else:
> big, small = item, ret
> # Check for name collisions
> for key, val in small.items():
> if big.get(key, val) is not val:
> raise ValueError('Name conflict in table list: %s' % key)
> # Merge
> big.update(small)
> ret = big
> return ret
>
> I don't think itables_to_merge is updated intentionally because why
> filtering it in _build_joins_for_select()...
>
> My guess is the intention wasn't to get it updated and the only purpose of
> the  tablemap with all the tables names as itablemap use lack some(s) of
> them...
>
> So deepcopy would be need it or just dict(**itables_to_merge)) while
> passing itables_to_merge to merge_tablemaps()
>
> *Should we fix that??*
>
> if join:
> (
> # FIXME? ijoin_tables is never used
> ijoin_tables, ijoin_on, itables_to_merge, ijoin_on_tables,
> iimportant_tablenames, iexcluded, itablemap
> ) = self._build_joins_for_select(tablemap, join)
> tablemap = merge_tablemaps(tablemap, dict(**itables_to_merge))
> tablemap = merge_tablemaps(tablemap, itablemap)
> if left:
> (
>         join_tables, join_on, tables_to_merge, join

  1   2   3   4   5   6   7   8   9   10   >