Re: [web2py] Re: Form input not working.

2018-07-07 Thread Maurice Waka
I managed to go to the basics and got some progress:
def searches():
form = FORM(INPUT(_name='message'), INPUT(_type='submit'))
code = request.vars.message
return dict(code=code)

view:


Yes
Sure!






However, as a test, when retrieving data to controller, the request.vars
does not give me the immediate user posted data, instead the previous data
posted. For example, if the user posts 'abcd', with the previous post
having been '1234', I'll get '1234' returned and not 'abcd'.
Is there a way of cleaning up request.vars and getting the CURRENT posted
data?
Thanks for the help, God bless!

On Fri, Jul 6, 2018 at 8:56 PM Anthony  wrote:

> On Friday, July 6, 2018 at 12:49:23 PM UTC-4, Maurice Waka wrote:
>>
>> I've changed from method='GET' to method ='POST', name=message ' (the
>> table name) etc. But I seem to have an issue with the highlighted part.
>> It's still not posting. Could you please give an example of how this can
>> work?
>> > class="hidden">
>> 
>> Yes
>> > value="sure">Sure!
>> 
>> > data-conv-question="Alright! First, type one word e.g. 'exercise', or ask a
>> question.|Okay! you can type one word e.g. 'Soy', or ask a question.">
>>
>
> What exactly is the problem with that line? What are you expecting and
> what do you observe?
>
> Note, if you're using SQLFORM, you'll need to include {{=form.custom.end}}
> to make sure the hidden formname and formkey fields are included. Please
> read the documentation.
>
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/ohTduB-ui7U/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.


[web2py] web2py-ipython shell error: "list index out of range"

2018-07-07 Thread Jose C

Greetings,

In a new virtual environment using Python3's built-in venv functionality, 
with IPython installed and latest web2py source. When dropping into a 
web2py-ipython shell, starting ipython throws a "list index out of range" 
exception and the shell defaults to interactive. Steps to reproduce below.

jose@VM-ubu1804x64:~/python-environments$ python3 -m venv w2p_test

jose@VM-ubu1804x64:~/python-environments$ workon w2p_test
(w2p_test) jose@VM-ubu1804x64:~/python-environments$ pip3 install ipython
(w2p_test) jose@VM-ubu1804x64:~/python-environments$ ipython
Python 3.6.5 (default, Apr  1 2018, 05:46:30) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: 
Do you really want to exit ([y]/n)? y

(w2p_test) jose@VM-ubu1804x64:~/python-environments/w2p_test/lib/web2py$ 
python web2py.py -S welcome 
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2018
Version 2.16.1-stable+timestamp.2018.06.02.04.50.21
Database drivers available: sqlite3, imaplib, pymysql
WARNING:web2py:import IPython error; use default python shell.  Exception 
was: list index out of range   *<--* I edited line 329 of gluon/shell.py to 
display the Exception thrown here.
Python 3.6.5 (default, Apr  1 2018, 05:46:30) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> 


*** System specs...
System: Ubuntu Mate 18.04 (x64) running in Virtualbox VM
Python version:  3.6.5
web2py latest available download source (for testers):   Version 
2.16.1-stable+timestamp.2018.06.02.04.50.21
IPython version installed: 6.4.0


I am able to reproduce this consistently with steps above.  Can anyone else 
reproduce the error as well (so I can rule out an environment problem) in 
which case I can file an official bug report if necessary?

Many thanks,

Jose

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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: Form input not working.

2018-07-07 Thread Maurice Waka
Hi.
I'll need your help. Am still stuck at this. I note that only when I
refresh the page, will I get the latest 'request.vars.value' gets posted to
the controller.

   1. Is there a way of auto-refreshing the controller?
   2. Is there a better method that this..Following your suggested
   option of {{form.custom.end}} i ended up with a blank page instead, hence
   going to the basics.
   3. My aim is that when a user posts input, I retrieve it from what ever
   meansrequest.vars etc,  then send to the functions to process..

Kind regards

On Sat, Jul 7, 2018 at 1:33 PM Maurice Waka  wrote:

> I managed to go to the basics and got some progress:
> def searches():
> form = FORM(INPUT(_name='message'), INPUT(_type='submit'))
> code = request.vars.message
> return dict(code=code)
>
> view:
>  "post" class="hidden">
> 
> Yes
> Sure!
> 
>  data-conv-question="Alright! First, type one word e.g. 'exercise', or ask a
> question.|Okay! you can type one word e.g. 'Soy', or ask a question.">
>  data-conv-question="{{=code}}" data-no-answer="true">
>
> 
>
> However, as a test, when retrieving data to controller, the request.vars
> does not give me the immediate user posted data, instead the previous data
> posted. For example, if the user posts 'abcd', with the previous post
> having been '1234', I'll get '1234' returned and not 'abcd'.
> Is there a way of cleaning up request.vars and getting the CURRENT posted
> data?
> Thanks for the help, God bless!
>
> On Fri, Jul 6, 2018 at 8:56 PM Anthony  wrote:
>
>> On Friday, July 6, 2018 at 12:49:23 PM UTC-4, Maurice Waka wrote:
>>>
>>> I've changed from method='GET' to method ='POST', name=message ' (the
>>> table name) etc. But I seem to have an issue with the highlighted part.
>>> It's still not posting. Could you please give an example of how this can
>>> work?
>>> >> class="hidden">
>>> 
>>> Yes
>>> >> value="sure">Sure!
>>> 
>>> >> data-conv-question="Alright! First, type one word e.g. 'exercise', or ask a
>>> question.|Okay! you can type one word e.g. 'Soy', or ask a question.">
>>>
>>
>> What exactly is the problem with that line? What are you expecting and
>> what do you observe?
>>
>> Note, if you're using SQLFORM, you'll need to include
>> {{=form.custom.end}} to make sure the hidden formname and formkey fields
>> are included. Please read the documentation.
>>
>> 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 a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/web2py/ohTduB-ui7U/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.


Re: [web2py] Re: Form input not working.

2018-07-07 Thread Anthony
First, read the documentation 
at http://web2py.com/books/default/chapter/29/07/forms-and-validators, as 
you do not appear to be following it. If for some reason you do not want to 
use the built-in form functionality, just create an HTML form, and in the 
action that receives the submission, the submitted form values will be 
available in request.vars -- from there, you can do whatever you want with 
the data.

Anthony

On Saturday, July 7, 2018 at 6:02:55 PM UTC-4, Maurice Waka wrote:
>
> Hi.
> I'll need your help. Am still stuck at this. I note that only when I 
> refresh the page, will I get the latest 'request.vars.value' gets posted to 
> the controller.
>
>1. Is there a way of auto-refreshing the controller?
>2. Is there a better method that this..Following your suggested 
>option of {{form.custom.end}} i ended up with a blank page instead, hence 
>going to the basics.
>3. My aim is that when a user posts input, I retrieve it from what 
>ever meansrequest.vars etc,  then send to the functions to process..
>
> Kind regards
>
> On Sat, Jul 7, 2018 at 1:33 PM Maurice Waka  wrote:
>
>> I managed to go to the basics and got some progress:
>> def searches():
>> form = FORM(INPUT(_name='message'), INPUT(_type='submit'))
>> code = request.vars.message
>> return dict(code=code)
>>
>> view:
>> > "post" class="hidden">
>> 
>> Yes
>> > value="sure">Sure!
>> 
>> > data-conv-question="Alright! First, type one word e.g. 'exercise', or ask a 
>> question.|Okay! you can type one word e.g. 'Soy', or ask a question.">
>> > data-conv-question="{{=code}}" data-no-answer="true">  
>>   
>> 
>>
>> However, as a test, when retrieving data to controller, the request.vars 
>> does not give me the immediate user posted data, instead the previous data 
>> posted. For example, if the user posts 'abcd', with the previous post 
>> having been '1234', I'll get '1234' returned and not 'abcd'.
>> Is there a way of cleaning up request.vars and getting the CURRENT posted 
>> data?
>> Thanks for the help, God bless!
>>
>> On Friday, July 6, 2018 at 12:49:23 PM UTC-4, Maurice Waka wrote:

 I've changed from method='GET' to method ='POST', name=message ' (the 
 table name) etc. But I seem to have an issue with the highlighted part. 
 It's still not posting. Could you please give an example of how this can 
 work? 
 >>> class="hidden">
 
 Yes
 >>> value="sure">Sure!
 
 >>> data-conv-question="Alright! First, type one word e.g. 'exercise', or ask 
 a 
 question.|Okay! you can type one word e.g. 'Soy', or ask a question.">

>>>
>>> What exactly is the problem with that line? What are you expecting and 
>>> what do you observe?
>>>
>>> Note, if you're using SQLFORM, you'll need to include 
>>> {{=form.custom.end}} to make sure the hidden formname and formkey fields 
>>> are included. Please read the documentation.
>>>
>>> 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 a topic in the 
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/web2py/ohTduB-ui7U/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.


[web2py] Re: web2py-ipython shell error: "list index out of range"

2018-07-07 Thread 黄祥
tested on docker with ubuntu image no problem with python 2 and python 3
*e.g.*
*python 2 docker ubuntu image*
docker pull ubuntu
docker run -it ubuntu /bin/bash

apt update
apt install -y  python-pip unzip wget
pip install ipython
wget -c http://web2py.com/examples/static/web2py_src.zip 
unzip -o web2py_src.zip

root@44b18a5a6a7a:/# ipython
Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34)
Type "copyright", "credits" or "license" for more information.

IPython 5.7.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help  -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]:
Do you really want to exit ([y]/n)? 
root@44b18a5a6a7a:/# web2py/web2py.py -S welcome
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2018
Version 2.16.1-stable+timestamp.2017.11.14.05.54.25
Database drivers available: sqlite3, imaplib, pymysql, pg8000
Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34)
Type "copyright", "credits" or "license" for more information.

IPython 5.7.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help  -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.


*python 3 docker ubuntu image*
docker pull ubuntu
docker run -it ubuntu /bin/bash

apt update
apt install -y  python3-pip unzip wget
pip3 install ipython
wget -c http://web2py.com/examples/static/web2py_src.zip 
unzip -o web2py_src.zip

root@44b18a5a6a7b:/# ipython
Python 3.6.5 (default, Apr  1 2018, 05:46:30)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]:
Do you really want to exit ([y]/n)? 
root@44b18a5a6a7b:/# python3 web2py/web2py.py -S welcome
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2018
Version 2.16.1-stable+timestamp.2017.11.14.05.54.25
Database drivers available: sqlite3, imaplib, pymysql, pg8000
Python 3.6.5 (default, Apr  1 2018, 05:46:30)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.

best regards,
stifan


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


[web2py] Help a noob - I have run script setup-web2py-nginx-uwsgi-ubuntu.sh, now what?

2018-07-07 Thread William Chen
Hi web2py community, I am a complete noob, so bear with me.

I have set up my server on DigitalOcean, set up my SSH and user 
permissions, and run the following script successfully:

cd ~/
wget 
https://raw.githubusercontent.com/web2py/web2py/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh
chmod +x  setup-web2py-nginx-uwsgi-ubuntu.sh
sudo ./setup-web2py-nginx-uwsgi-ubuntu.sh



Now, how do I launch Web2py to be able to access the admin interface from 
the server IP address? 

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.