Re: [web2py] Re: Error in app: the variable was lost

2019-06-22 Thread Константин Комков
Yes, but only on monday(

сб, 22 июн. 2019 г., 16:41 Anthony :

> Can you show the full traceback?
>
> On Saturday, June 22, 2019 at 3:25:23 AM UTC-4, Константин Комков wrote:
>>
>> In my controller I have function:
>> def send_app():
>> if session.abit_email is None:redirect('
>> https://oas.timacad.ru/application', client_side=True)
>> const = {rec.NAME:rec.TEXT for rec in 
>> db((db.t_const.NAME=='RECTOR_RANKU')
>> | (db.t_const.NAME=='PREDSEDU') | (db.t_const.NAME=='VUZ')).select(
>> db.t_const.NAME,db.t_const.TEXT)}
>> rectorRank = const['RECTOR_RANKU']
>> rectorName = const['PREDSEDU']
>> *vuzName* = const['VUZ']
>> statement=create_application_for_edit(rectorRank,rectorName,vuzName)
>> ...
>> and it's code create_application_for_edit function:
>> def create_application_for_edit(rectorRank,rectorName,vuzName):
>> ...
>> if session.edu_course_name!='Без курсов':
>> edu = edu + 'Закончил(-а) подготовительные курсы {0}: {1}.
>> '.format(*vuzName*,session.edu_course_name)
>> ...
>> Today I see one user get error 10 times:
>> NameError(name 'vuzName' is not defined)
>> After that I see automatic letter from him on email. It means that error
>> was and something happened and error was gone and that user can send
>> automatic letter from my function. How it is possible?
>>
>> --
> 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/CtsITs1D4po/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/da61f285-7624-4783-900a-a25a03171570%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAM7z-Vmh9CbBgPWYFKp9txkd4O2Wo_hCmPdDeOyG8ehzpUXwzQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Error in app: the variable was lost

2019-06-22 Thread Anthony
Can you show the full traceback?

On Saturday, June 22, 2019 at 3:25:23 AM UTC-4, Константин Комков wrote:
>
> In my controller I have function:
> def send_app():
> if session.abit_email is None:redirect('
> https://oas.timacad.ru/application', client_side=True)
> const = {rec.NAME:rec.TEXT for rec in 
> db((db.t_const.NAME=='RECTOR_RANKU') 
> | (db.t_const.NAME=='PREDSEDU') | (db.t_const.NAME=='VUZ')).select(
> db.t_const.NAME,db.t_const.TEXT)}
> rectorRank = const['RECTOR_RANKU']
> rectorName = const['PREDSEDU']
> *vuzName* = const['VUZ']
> statement=create_application_for_edit(rectorRank,rectorName,vuzName)
> ...
> and it's code create_application_for_edit function:
> def create_application_for_edit(rectorRank,rectorName,vuzName):
> ...
> if session.edu_course_name!='Без курсов':
> edu = edu + 'Закончил(-а) подготовительные курсы {0}: {1}. 
> '.format(*vuzName*,session.edu_course_name)
> ...
> Today I see one user get error 10 times:
> NameError(name 'vuzName' is not defined) 
> After that I see automatic letter from him on email. It means that error 
> was and something happened and error was gone and that user can send 
> automatic letter from my function. How it is possible? 
>
>

-- 
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/da61f285-7624-4783-900a-a25a03171570%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Web3py

2019-06-22 Thread 黄祥
tested on ubuntu docker for pip3 install web3py with simple app (worked)
*steps*
apt install -y git python3-pip cython3 
cd
git clone https://github.com/web2py/web3py
cd web3py
python3 setup.py install
pip3 install web3py
cd 
mkdir -p ~/apps/test/databases
cat << EOF > ~/apps/test/__init__.py
import os
from web3py import *
db = DAL('sqlite://test', folder=os.path.join(os.path.dirname(__file__), 
'databases'))
db.define_table('table0', Field('field0') )
if db(db.table0).count() == 0:
db.table0.insert(field0 = 'field 0')
db.table0.insert(field0 = 'field 1')
db.commit()
@action('rows_as_json/', method = 'GET')
@action.uses(db)
def rows_as_json(table_name):
query = (db[table_name]['id'] > 0)
rows = db(query).select().as_json()
response.content_type = 'application/json; charset=utf-8'
return rows
#return dict(rows = rows)
EOF
touch ./apps/__init__.py
cd ~/apps
cd
python3 -c "from pydal.validators import CRYPT; 
open('password.txt','w').write(str(CRYPT()('a' )[0] ) )"
/usr/local/bin/web3py-start -p ./password.txt -a 0.0.0.0:8000 ./apps &

*test on terminal*
$ curl -X GET -i http://localhost:8000/test/rows_as_json/table0
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 64
Server: TornadoServer/6.0.2

[{"id": 1, "field0": "field 0"}, {"id": 2, "field0": "field 1"}]

*test on browser : http://localhost:8000/test/rows_as_json/table0*
[{"id": 1, "field0": "field 0"}, {"id": 2, "field0": "field 1"}]

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/c1cfab67-43c0-4a27-8973-503fd24a2c89%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Upload files

2019-06-22 Thread Alex Beskopilny
if any ( ['.jpg' in file_name, '.JPG' in file_name ,  ]  ):
?

суббота, 22 июня 2019 г., 11:18:42 UTC+3 пользователь Константин Комков 
написал:
>
> I made upload form for files that winter and today when project is working 
> 3 days user told me that he can't load file. When I saw that file it name 
> was "name.JPG"  but in my code befor i find only .jpg. Now all is ok.
> for i in img:
> s = i.file[len(i.file)-5:len(i.file)]
> if ((s.find('.jpg')>-1) | (s.find('.JPG')>-1) | 
> (s.find('.jpeg')>-1) | (s.find('.JPEG')>-1) | (s.find('.png')>-1) | 
> (s.find('.PNG')>-1) | (s.find('.bmp')>-1) | (s.find('.BMP')>-1)):
> studDocs = studDocs + """ class="col col-pd"> src='"""+URL('bak','download',args=i.file)+"""'/> class='del-img'>"""
> elif ((s.find('.pdf')>-1) | (s.find('.PDF')>-1)):
> studDocs = studDocs + """ class="col col-pd">.pdf"""
> elif ((s.find('.tif')>-1) | (s.find('.TIF')>-1)):
> studDocs = studDocs + """ class="col col-pd">.tiff"""
>
> [image: uploadForm.png]
>

-- 
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/bf36b82f-f998-4508-a20b-1b60bcdca909%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Web3py

2019-06-22 Thread 黄祥

>
> Ideas about how to ship apps when pip installing web3py?


pardon, for current stage, can not, because you must:
- clone web3py repo
- run python3 setup.py install
- then successfull install pip3 install web3py
which imo inefficient
detail tested on previous messages 
*ref (tests 5 works):*
https://groups.google.com/d/msg/web2py/saav4hQdbSU/7hCrxV_ZBAAJ

just an idea, perhaps if you've fixed pypi modules, think, user can either 
extract the webapps (zip or tar) or clone the opened repo url, then execute 
with 
*e.g. for extracted*
cd 
mkdir ~/apps
touch ./apps/__init__.py
cd ~/apps
unzip client_a.zip
cd
python3 -c "from pydal.validators import CRYPT; 
open('password.txt','w').write(str(CRYPT()('a' )[0] ) )"
/usr/local/bin/web3py-start -p ./password.txt -a 0.0.0.0:8000 ./apps

*e.g. for git*
cd 
mkdir ~/apps
touch ./apps/__init__.py
cd ~/apps
git clone http://github.com/user/client_b
cd
python3 -c "from pydal.validators import CRYPT; 
open('password.txt','w').write(str(CRYPT()('a' )[0] ) )"
/usr/local/bin/web3py-start -p ./password.txt -a 0.0.0.0:8000 ./apps

*note*
- after it's successufl installed pip3 install web3py, consider there is no 
_dashboard, so can't pack or unpack just like in web2py using appadmin
- not sure is it a bug or in dev progress, but for me, must initialy create 
__init__.py on apps folder is inefficient, the problem if just an error 
traceback we can ignore it, but the problem is the web server won't start, 
so not sure, as u can see, in latest docker step is also create that file 
to ensure that web server can run

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/1259add7-8c4d-4d85-a87c-08e0543e18fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Web3py

2019-06-22 Thread Massimo Di Pierro
Ideas about how to ship apps when pip installing web3py?

-- 
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/1102859b-0f8e-4203-950b-960533482fb8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Error in app: the variable was lost

2019-06-22 Thread Константин Комков
In my controller I have function:
def send_app():
if session.abit_email is 
None:redirect('https://oas.timacad.ru/application', client_side=True)
const = {rec.NAME:rec.TEXT for rec in 
db((db.t_const.NAME=='RECTOR_RANKU') | (db.t_const.NAME=='PREDSEDU') | 
(db.t_const.NAME=='VUZ')).select(db.t_const.NAME,db.t_const.TEXT)}
rectorRank = const['RECTOR_RANKU']
rectorName = const['PREDSEDU']
*vuzName* = const['VUZ']
statement=create_application_for_edit(rectorRank,rectorName,vuzName)
...
and it's code create_application_for_edit function:
def create_application_for_edit(rectorRank,rectorName,vuzName):
...
if session.edu_course_name!='Без курсов':
edu = edu + 'Закончил(-а) подготовительные курсы {0}: {1}. 
'.format(*vuzName*,session.edu_course_name)
...
Today I see one user get error 10 times:
NameError(name 'vuzName' is not defined) 
After that I see automatic letter from him on email. It means that error 
was and something happened and error was gone and that user can send 
automatic letter from my function. How it is possible? 

-- 
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/ee17ac90-9ba0-41c7-90a6-2883bfb499c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Error in app: cannot unpack non-iterable NoneType object

2019-06-22 Thread Константин Комков
*Val K*, I know that & is betwice operator) I can not return ('My message', 
oper and abit) becouse string 'My message' is different like:
if ((oper==True) & (abit==True)):
   return ('My message 1',True)
   elif ((oper==True) & (abit==False)):
   return ('My message 2',False)
   elif ((oper==False) & (abit==True)):
   return ('My message 3',False)
I want to know what I need to do for function mail return me true and if it 
return me false i repeat call that function (maybe 5 times like call to 
databese in web2py) for improve that:
Now I get return ('My message',True) in 25 percent of the time.


 

-- 
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/c0d274ad-be80-401b-b7e0-6e62e5c1d06d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.