[web2py] Re: Html helper module?

2017-05-07 Thread Pierre
I just repeated what's written in the web2py book :


For example a model could do

auth = Auth(db)
from gluon import current
current.auth = auth
current.db = db #not needed in this case but useful

and now all modules imported can access current.auth.

current and import create a powerful mechanism to build extensible and 
reusable modules for your applications.


I'll check without the import..what about the datetime module how do i 
access it without re-importing  ?

-- 
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: convert virtual field in grid to another language

2017-05-07 Thread Andrea Fae'
Anthony, you are a guru of web2py!

Il giorno sabato 6 maggio 2017 15:50:52 UTC+2, Anthony ha scritto:
>
> On Saturday, May 6, 2017 at 4:50:47 AM UTC-4, Andrea Fae' wrote:
>>
>> Solution:
>> db.evento.giorno_inizio.represent = lambda giorno_inizio, row: 
>> T(giorno_inizio)
>>
>> But I don't know whhy I have to specify "row" in tha lambda function...
>>
>
> The "represent" function must have a particular form, as the framework 
> will call it by passing two arguments -- the first argument is the value of 
> the field itself, and the second argument is the entire row object. In any 
> given case, you may not need one or the other of those arguments, but they 
> are both provided for maximum flexibility regarding how you want to 
> represent the field (in many cases, you need values of other fields in the 
> same record).
>
> Anthony
>

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


[web2py] flash message gets lost

2017-05-07 Thread Yebach
Hello

After redirecting user after registriation the flash message is not shown. 
if I print session the message gets lost --> flash is none

I inserted print session in my user function in default.py controller and 
in index function

This is the print result



session index  

session index  


also when redirected to index.html the session is printed twice

Any suggestions why this kind of behaviour?

-- 
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] encoding form fields when registering user - bug or feature?

2017-05-07 Thread Yebach
Hello

I just discovered the following behavior when user fills the user 
registration form

in my form i have confirm password. and in storage the following values are 
stored 

, 'email': 
'test_m...@gmail.com'}>

as you can see the password_two is not encrypted.

In case i forgot to set the encryption I am just giving you a heads up 

Is this a bug or is it a feature? :)

best 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 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] Problem after git pull with sqlrow

2017-05-07 Thread brushek
Hello,

I have recently did git pull for some old web2py powered project, after 
that I get:

 'Rows' object has no attribute 'fields' 
Version 
web2py™ Version 2.14.6-stable+timestamp.2016.05.09.19.18.48 
Python Python 2.7.6: /usr/local/bin/uwsgi (prefix: /usr) Traceback 

1.
2.
3.
4.
5.
6.
7.
8.

Traceback (most recent call last):
  File "/home/brushek/web2py/gluon/restricted.py", line 216, in restricted
exec(ccode, environment)
  File "", line 102, in 
  File "/home/brushek/web2py/gluon/sqlhtml.py", line 3314, in __init__
fieldmap = dict(zip(sqlrows.colnames, sqlrows.fields))
AttributeError: 'Rows' object has no attribute 'fields'

Error snapshot [image: help] 

 

('Rows' object has no attribute 'fields')


This is all code for controller:


def listuj():
(dev,telnet) = gpon.connect_GPON()
onts_s = gpon.ont_state(telnet)
table = db(db.gpon_ont._id>0).select()
return dict(table=table,statusy=onts_s,message='Lista wszystkich ONT w 
bazie danych')


Can You advice what is wrong ?


Regards

brk

-- 
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: Problem after git pull with sqlrow

2017-05-07 Thread brushek
I found that it looks like for problem in SQLTABLE:
{{
=SQLTABLE(table,_id="gpon_lista",_style="width: 850px; text-align: center; 
align: center;") 
}}

after commenting this line out error didn't show, but of course this not 
proper solution for me...

Please advice, becouse I don't want to mess up in web2py code, and it seems 
to be some web2py issue...

Regards
brk

W dniu niedziela, 7 maja 2017 13:46:04 UTC+2 użytkownik brushek napisał:
>
> Hello,
>
> I have recently did git pull for some old web2py powered project, after 
> that I get:
>
>  'Rows' object has no attribute 'fields' 
> Version 
> web2py™ Version 2.14.6-stable+timestamp.2016.05.09.19.18.48 
> Python Python 2.7.6: /usr/local/bin/uwsgi (prefix: /usr) Traceback 
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
>
> Traceback (most recent call last):
>   File "/home/brushek/web2py/gluon/restricted.py", line 216, in restricted
> exec(ccode, environment)
>   File "", line 102, in 
>   File "/home/brushek/web2py/gluon/sqlhtml.py", line 3314, in __init__
> fieldmap = dict(zip(sqlrows.colnames, sqlrows.fields))
> AttributeError: 'Rows' object has no attribute 'fields'
>
> Error snapshot [image: help] 
> 
>  
>
> ('Rows' object has no attribute 'fields')
>
>
> This is all code for controller:
>
>
> def listuj():
> (dev,telnet) = gpon.connect_GPON()
> onts_s = gpon.ont_state(telnet)
> table = db(db.gpon_ont._id>0).select()
> return dict(table=table,statusy=onts_s,message='Lista wszystkich ONT w 
> bazie danych')
>
>
> Can You advice what is wrong ?
>
>
> Regards
>
> brk
>

-- 
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: Problem after git pull with sqlrow

2017-05-07 Thread Anthony
What did you git pull? The web2py repo? If so, note that you probably did 
not get the updated DAL, as that is now a git submodule.

Anthony

On Sunday, May 7, 2017 at 7:56:20 AM UTC-4, brushek wrote:
>
> I found that it looks like for problem in SQLTABLE:
> {{
> =SQLTABLE(table,_id="gpon_lista",_style="width: 850px; text-align: center; 
> align: center;") 
> }}
>
> after commenting this line out error didn't show, but of course this not 
> proper solution for me...
>
> Please advice, becouse I don't want to mess up in web2py code, and it 
> seems to be some web2py issue...
>
> Regards
> brk
>
> W dniu niedziela, 7 maja 2017 13:46:04 UTC+2 użytkownik brushek napisał:
>>
>> Hello,
>>
>> I have recently did git pull for some old web2py powered project, after 
>> that I get:
>>
>>  'Rows' object has no attribute 'fields' 
>> Version 
>> web2py™ Version 2.14.6-stable+timestamp.2016.05.09.19.18.48 
>> Python Python 2.7.6: /usr/local/bin/uwsgi (prefix: /usr) Traceback 
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>>
>> Traceback (most recent call last):
>>   File "/home/brushek/web2py/gluon/restricted.py", line 216, in restricted
>> exec(ccode, environment)
>>   File "", line 102, in 
>>   File "/home/brushek/web2py/gluon/sqlhtml.py", line 3314, in __init__
>> fieldmap = dict(zip(sqlrows.colnames, sqlrows.fields))
>> AttributeError: 'Rows' object has no attribute 'fields'
>>
>> Error snapshot [image: help] 
>> 
>>  
>>
>> ('Rows' object has no attribute 
>> 'fields')
>>
>>
>> This is all code for controller:
>>
>>
>> def listuj():
>> (dev,telnet) = gpon.connect_GPON()
>> onts_s = gpon.ont_state(telnet)
>> table = db(db.gpon_ont._id>0).select()
>> return dict(table=table,statusy=onts_s,message='Lista wszystkich ONT 
>> w bazie danych')
>>
>>
>> Can You advice what is wrong ?
>>
>>
>> Regards
>>
>> brk
>>
>

-- 
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: encoding form fields when registering user - bug or feature?

2017-05-07 Thread Anthony
What do you mean by "stored"? web2py does not store password_two -- it 
simply compares it to the first password entry to make sure they match. 
Only one copy of the password is stored in db.auth_user, and it is hashed.

Anthony

On Sunday, May 7, 2017 at 5:28:38 AM UTC-4, Yebach wrote:
>
> Hello
>
> I just discovered the following behavior when user fills the user 
> registration form
>
> in my form i have confirm password. and in storage the following values 
> are stored 
>
>  'id': 193L, 'organization': 'testorgalalal', 'password': 
> , 'email': '
> test_m...@gmail.com'}>
>
> as you can see the password_two is not encrypted.
>
> In case i forgot to set the encryption I am just giving you a heads up 
>
> Is this a bug or is it a feature? :)
>
> best 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 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: flash message gets lost

2017-05-07 Thread Anthony
Are you successfully able to show any flash messages (i.e., simply set 
response.flash within any action and see if it shows up on the page)? Is 
the appropriate DIV in the layout.html?

Note, by the time you are in the index function, session.flash is not 
expected to be there any longer, as the framework copies session.flash to 
response.flash after a redirect. Is there anything in response.flash at 
that point?

Anthony

On Sunday, May 7, 2017 at 5:25:17 AM UTC-4, Yebach wrote:
>
> Hello
>
> After redirecting user after registriation the flash message is not shown. 
> if I print session the message gets lost --> flash is none
>
> I inserted print session in my user function in default.py controller and 
> in index function
>
> This is the print result
>
>  account', '_formkey[register]': ['cd76b587-db09-46fa-a05e-b31c2f71d4c4', 
> 'ad7148b5-3306-455b-9c2d-65e6c91e9856', 
> '069640cf-0c68-416c-b091-8e8efa337e24', 
> 'd89158de-86a5-4e23-9a07-43ba042a09ac', 
> 'fa1a99ba-8d97-49c2-ad0d-ffe7ba66e412', 
> '5cfb4a89-8284-4879-9b1d-9bc923350771', 
> '6b55ba7d-fa6f-4709-a8ca-0ec30e4f4455', 
> 'c983f92b-10d6-47d7-b02f-a5bc7a4419b4', 
> '7ff1a289-f9b4-47b6-92a2-da93fcdeb8ca', 
> 'c298cda9-447b-47e4-b9b5-7b1a6f85645d'], '_formkey[login]': 
> ['dc014554-b3a9-4ab7-8a4e-21600922d485', 
> '4afe46f2-77a8-4e74-abc9-1d2d512a1d56', 
> '3fa4d78a-4113-419f-ae90-5a39d3bac9f9', 
> '171e7853-0f31-4e66-b8ef-1c8c665610b5', 
> '86b76af0-3f51-4f47-95e6-903a117db2cb', 
> 'f117d59d-7e38-4e90-a70c-fb9f507b3681', 
> '756458fd-1f13-4aab-9f71-fae5322199c5', 
> 'e5949f3d-3094-45f2-94ba-ff4c9ea27d08', 
> '8abea09c-9493-499b-bf50-5487262a9a03', 
> '467f8079-508a-4c83-bbf1-49ba86ade0f1'], '_formkey[auth_user/create]': 
> ['5cf42aee-c3b1-4f2b-a4b5-6027ec55c7c3', 
> '6a58a734-dc76-43b0-84df-fc35444a6364', 
> '0cc70146-e946-411c-9ced-4552098a07c8', 
> 'b189dc4c-d789-463b-a223-ce22bb880828', 
> '4ebe96ab-1b25-4bcf-98bd-285f51b28168', 
> 'd5f15dea-51c4-446e-a66e-f3aaccc3937b', 
> 'a13cf1fe-a994-44e0-b03c-c5769f0d0d92', 
> '7297c942-159e-491f-9a63-fc10420c1ebb', 
> 'dbe6e93c-28e0-4b54-b4d5-3a0f4083059d', 
> '199b91db-8921-42a2-a741-1dd323c09600']}>
>
> session index   ['cd76b587-db09-46fa-a05e-b31c2f71d4c4', 
> 'ad7148b5-3306-455b-9c2d-65e6c91e9856', 
> '069640cf-0c68-416c-b091-8e8efa337e24', 
> 'd89158de-86a5-4e23-9a07-43ba042a09ac', 
> 'fa1a99ba-8d97-49c2-ad0d-ffe7ba66e412', 
> '5cfb4a89-8284-4879-9b1d-9bc923350771', 
> '6b55ba7d-fa6f-4709-a8ca-0ec30e4f4455', 
> 'c983f92b-10d6-47d7-b02f-a5bc7a4419b4', 
> '7ff1a289-f9b4-47b6-92a2-da93fcdeb8ca', 
> 'c298cda9-447b-47e4-b9b5-7b1a6f85645d'], '_formkey[login]': 
> ['dc014554-b3a9-4ab7-8a4e-21600922d485', 
> '4afe46f2-77a8-4e74-abc9-1d2d512a1d56', 
> '3fa4d78a-4113-419f-ae90-5a39d3bac9f9', 
> '171e7853-0f31-4e66-b8ef-1c8c665610b5', 
> '86b76af0-3f51-4f47-95e6-903a117db2cb', 
> 'f117d59d-7e38-4e90-a70c-fb9f507b3681', 
> '756458fd-1f13-4aab-9f71-fae5322199c5', 
> 'e5949f3d-3094-45f2-94ba-ff4c9ea27d08', 
> '8abea09c-9493-499b-bf50-5487262a9a03', 
> '467f8079-508a-4c83-bbf1-49ba86ade0f1'], '_formkey[auth_user/create]': 
> ['5cf42aee-c3b1-4f2b-a4b5-6027ec55c7c3', 
> '6a58a734-dc76-43b0-84df-fc35444a6364', 
> '0cc70146-e946-411c-9ced-4552098a07c8', 
> 'b189dc4c-d789-463b-a223-ce22bb880828', 
> '4ebe96ab-1b25-4bcf-98bd-285f51b28168', 
> 'd5f15dea-51c4-446e-a66e-f3aaccc3937b', 
> 'a13cf1fe-a994-44e0-b03c-c5769f0d0d92', 
> '7297c942-159e-491f-9a63-fc10420c1ebb', 
> 'dbe6e93c-28e0-4b54-b4d5-3a0f4083059d', 
> '199b91db-8921-42a2-a741-1dd323c09600']}>
>
> session index   ['cd76b587-db09-46fa-a05e-b31c2f71d4c4', 
> 'ad7148b5-3306-455b-9c2d-65e6c91e9856', 
> '069640cf-0c68-416c-b091-8e8efa337e24', 
> 'd89158de-86a5-4e23-9a07-43ba042a09ac', 
> 'fa1a99ba-8d97-49c2-ad0d-ffe7ba66e412', 
> '5cfb4a89-8284-4879-9b1d-9bc923350771', 
> '6b55ba7d-fa6f-4709-a8ca-0ec30e4f4455', 
> 'c983f92b-10d6-47d7-b02f-a5bc7a4419b4', 
> '7ff1a289-f9b4-47b6-92a2-da93fcdeb8ca', 
> 'c298cda9-447b-47e4-b9b5-7b1a6f85645d'], '_formkey[login]': 
> ['dc014554-b3a9-4ab7-8a4e-21600922d485', 
> '4afe46f2-77a8-4e74-abc9-1d2d512a1d56', 
> '3fa4d78a-4113-419f-ae90-5a39d3bac9f9', 
> '171e7853-0f31-4e66-b8ef-1c8c665610b5', 
> '86b76af0-3f51-4f47-95e6-903a117db2cb', 
> 'f117d59d-7e38-4e90-a70c-fb9f507b3681', 
> '756458fd-1f13-4aab-9f71-fae5322199c5', 
> 'e5949f3d-3094-45f2-94ba-ff4c9ea27d08', 
> '8abea09c-9493-499b-bf50-5487262a9a03', 
> '467f8079-508a-4c83-bbf1-49ba86ade0f1'], '_formkey[auth_user/create]': 
> ['5cf42aee-c3b1-4f2b-a4b5-6027ec55c7c3', 
> '6a58a734-dc76-43b0-84df-fc35444a6364', 
> '0cc70146-e946-411c-9ced-4552098a07c8', 
> 'b189dc4c-d789-463b-a223-ce22bb880828', 
> '4ebe96ab-1b25-4bcf-98bd-285f51b28168', 
> 'd5f15dea-51c4-446e-a66e-f3aaccc3937b', 
> 'a13cf1fe-a994-44e0-b03c-c5769f0d0d92', 
> '7297c942-159e-491f-9a63-fc10420c1ebb', 
> 'dbe6e93c-28e0-4b54-b4d5-3a0f4083059d', 
> '199b91db-8921-42a2-a741-1dd323c09600']}>
>
>
> also when redirected to index.html the session is printed twice
>
> Any suggestions why this kind of behaviour?
>

-- 
Res

[web2py] Re: Html helper module?

2017-05-07 Thread Anthony
On Sunday, May 7, 2017 at 4:44:07 AM UTC-4, Pierre wrote:
>
> I just repeated what's written in the web2py book :
>
>
> For example a model could do
>
> auth = Auth(db)
> from gluon import current
> current.auth = auth
> current.db = db #not needed in this case but useful
>
> and now all modules imported can access current.auth.
>
> current and import create a powerful mechanism to build extensible and 
> reusable modules for your applications.
>

I wasn't saying you don't ever need to do anything like the above, just 
that you specifically do not need to do it in order to attach the T object 
to current, as the framework already does that for you. Note, the excerpt 
you cite above from the book is immediately preceded by the following:

Modules that import current can access:

   - current.request
   - current.response
   - current.session
   - current.cache
   - current.T

and any other variable your application chooses to store in current.
 

> I'll check without the import..what about the datetime module how do i 
> access it without re-importing  ?
>

Not sure what you mean -- you should import datetime wherever you need it.

Anthony 

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


Re: [web2py] Re: encoding form fields when registering user - bug or feature?

2017-05-07 Thread Vid Ogris
I ment send in storage for form variables. I know it is not stored but in
case of safety this could be an issue. Or not? I might be just overreacting
:)

On May 7, 2017 15:11, "Anthony"  wrote:

What do you mean by "stored"? web2py does not store password_two -- it
simply compares it to the first password entry to make sure they match.
Only one copy of the password is stored in db.auth_user, and it is hashed.

Anthony


On Sunday, May 7, 2017 at 5:28:38 AM UTC-4, Yebach wrote:
>
> Hello
>
> I just discovered the following behavior when user fills the user
> registration form
>
> in my form i have confirm password. and in storage the following values
> are stored
>
>  'id': 193L, 'organization': 'testorgalalal', 'password':
> , 'email': '
> test_m...@gmail.com'}>
>
> as you can see the password_two is not encrypted.
>
> In case i forgot to set the encryption I am just giving you a heads up
>
> Is this a bug or is it a feature? :)
>
> best 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/I4uH3NBvlc4/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: lack of documentation

2017-05-07 Thread Matt Bockman
I'm also new to web2py and I have trouble with the documentation. I'm 
fairly green with python itself so maybe there are better ways to use the 
documentation or look for things. Sometimes I don't know what things are 
called or how to search for them. One thing I liked about developing in C++ 
with Qt is that I could always find a reference page for whatever class I 
was using that would give very concrete information about it. Sometimes I'm 
confused about what type a variable is and I often don't know how to even 
find out what type it is, let alone look up that type in documentation. 
I've been at it now for about 20 hours so I don't have too much time under 
my belt. 

I'm still able to build my web application as fast or faster than using no 
framework with PHP. If I find an improvement to make the documentation I 
will try to contribute. 

Cheers,
Matt

On Wednesday, April 26, 2017 at 6:57:50 PM UTC-7, jean-mic...@meggitt.com 
wrote:
>
> Hi,
> I'm starting with web2py, it seems a very powerfull tool.
> But concerning the documentation, it's difficult to read : in this 
> document (see link above) it's OK from the beginning up to 75%. After the 
> 75% the explainations and the code (in 'code' box) are inverted.
> Who is in charge of this, in order to make it readable ?
> Thanks.
>
> http://www.web2py.com/books/default/chapter/38/06/la-couche-dabstraction-de-base-de-donnees
>  
>
>>
>>

-- 
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: Displaying images

2017-05-07 Thread Matt Bockman
How big is your application/user base? Is sqlite not sufficient? I 
unwittingly thought sqlite was kind of a toy until I did a little more 
research to find out that it is actually very capable and used in a lot of 
applications. Based on this:

https://www.sqlite.org/whentouse.html

Seems like pretty much any application I see myself writing will work well 
in sqlite. 

That being said, the web2py upload field type seems to be very useful, as 
it automagically renames the file and stores it into the upload folder, and 
stores the path to that file in the database. Also, by some more magic, 
when you download the file, it retains the original file name. Pretty neat. 
Read more here:

http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#More-on-uploads

Cheers,
Matt 

On Wednesday, April 5, 2017 at 12:44:47 AM UTC-7, Dave S wrote:
>
> I have a bunch of pix that I want to display, which are not in the uploads 
> directory of the application.  My options appear to be:
>
> - copy them to the static folder (or a subfolder) and have URL() work for 
> them
> - set up streamio on each so I can read them from an arbitrary filesystem 
> location
> - store them as a blob in the database
>
> Is there another option?
>
> If there was just a handful, relatively stable over time, the static 
> option would seem a good idea (because it would be simple to do).  But I 
> took more than 20 shots yesterday (starting with spring hillsides, and then 
> trying to capture birds in flight), and that was just one outing (limited 
> by the memory card). Taking down those pictures before putting up the next 
> set also seems "un-static".
>
> The blob option might be good, but not until I set up a real DB engine 
> (I'm not a DB admin) or use mlabs.  Meanwhile, I'm still on sqlite.
>
> Also, I might want to look into how to cache the images (not because there 
> will be heavy use, but because this might be a good application to use for 
> the learning experience).
>
> Suggestions?
>
> /dps
>
>

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


[web2py] Re: Saving to database random type data

2017-05-07 Thread Scorpa
Any suggestions, anyone ?


How to extract data from BLOB ?

среда, 3 мая 2017 г., 22:02:12 UTC+3 пользователь Scorpa написал:
>
> Hello folks ! 
>
> I have database that's have BLOB type to store any kind of data (it's 
> should be binary ?):
>
> Field('f_blob', type='blob',
>   label=T('blob object')),
>
>
> I'm inserting new records with:
>
> db.t_cache.insert(f_name='processed_' + request.vars.filename, f_blob= data)
>
>
> Where data is pandas object which is covnerted to CSV:
>
> data = StringIO.StringIO()
> source.to_csv(_tmp_data)
> data.seek(0)
>
>
> In database DATA record appears. but i can't fnd any information about 
> retrieving this object from db.
>
>
> I tried RETRIEVE method (where the hell documenation about this ? no comments 
> in source)
>
> Such as:
>
> db.t_cache.f_blob.retrieve(db.t_cache[ID].f_blob).f_blob  gives = 
> {TypeError}Can't retrieve  file 
> properties
>
>
> db.t_cache.f_blob.retrieve(db.t_cache[ID]) = {TypeError}expected string or 
> buffer
>
>
> So how to get back BLOB object from databse and use it later ? 
>
>

-- 
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: Private Controller Functions

2017-05-07 Thread Matt Bockman
When trying to figure out how to create a private function in a controller 
I first searched the web2py book and I spent a good amount of time looking 
for this. I eventually decided to search the Google group with success. 

My ability to search/browse the web2py book is getting better but I'm still 
very new at it. Is this convention documented in the web2py book? I was 
looking in "the core" but I didn't find what I needed there. How can this 
be added and where would it go? 

Thanks,
Matt

On Sunday, March 16, 2008 at 2:40:14 PM UTC-7, Massimo Di Pierro wrote:
>
> Done in trunk!
>
> Massimo
>
> On Mar 16, 2008, at 4:07 PM, voltron wrote:
>
> >
> > YESSS!  Cool! I am for that :-))
> >
> > On Mar 16, 9:55 pm, Massimo Di Pierro  wrote:
> >> double underscore I can do. ;-)
> >>
> >> Massimo
> >>
> >> On Mar 16, 2008, at 11:13 AM, voltron wrote:
> >>
> >>
> >>
> >>>  I just noted that I voted for the wrong convention:
> >>
> >>> yes for  double underscores "__" not for a single underscore "_"
> >>
> >>> :-)
> >>
> >>> On Mar 16, 5:04 pm, voltron  wrote:
>  Hmm, I'm not sure Massimo, Imho, I would always consider a well  
>  known
>  and defined Pythonic convention( everybody that uses Python  
>  knows the
>  double underscore convention), I am sure that all of the new web2py
>  users like myself made the same mistake when trying to create  
>  private
>  functions, this is a good thing:-) ! It would not even have to be
>  documented because its naturally pythonic, on the other hand we
>  have a
>  handful of users( judging from the number of registered users)  
>  and an
>  AJAX convention that is not universal and self descriptive, i.e,  
>  just
>  seeing a function called "_sendData" would not notify me  
>  immediately
>  that it is an AJAX function, I would have done this, "ajax_sendData
>  ()"
>  which is self descriptive.
> >>
>  I really respect the principle of not breaking Web2py, but is this
>  not
>  a bit too early for that? Web2py is very young and probably not so
>  widely deployed as the other frameworks, so this would be a  
>  chance to
>  quickly implement such changes. Even Python itself would implement
>  code-breaking changes soon, most frameworks undergo such changes  
>  too,
>  it is evolution. I seriously doubt that you would drive users away
>  when such changes are made, on the contrary. I think many would  
>  like
>  web2py even more, I would definitely.
> >>
>  I respect your opinion, but if you are uncertain, why not poll the
>  forum? You would know if people are against the changes then
> >>
>  On Mar 16, 4:23 pm, mdipierro  wrote:
> >>
> > correction use
> >>
> > if request.function[0]=='_' and not request.function=='_TEST':  
> > raise
> > HTTP(400,'some error')
> >>
> > since _TEST is the name of a "virtual" function called by admin  
> > when
> > you click on [test] It is automatically generated when testing.
> >>
> > Massimo
> >>
> > On Mar 16, 10:20 am, mdipierro  wrote:
> >>
> >> The more I think about this the more I see a problem. Some
> >> people for
> >> example are using the leading _ to indicate a controller
> >> function used
> >> for an ajax callback. In order to do what you asked I would break
> >> their code. Even without breaking code people would still need to
> >> upgrade the admin app to see the effects. This would break my
> >> promise
> >> of backward compatibility. Why don't you simply say, at the  
> >> top of
> >> your controller?
> >>
> >> if request.function[0]=='_': raise HTTP(400,'some error')
> >>
> >> and so you set your own convention.
> >>
> >> 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.


Re: [web2py] Web2py and WebRTC?

2017-05-07 Thread Ron Chatterjee
If someone has experience implementing webrtc there is a paid project would 
like to discuss with. Drop me a line private

-- 
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: lack of documentation

2017-05-07 Thread Kiran Subbaraman
There is another piece of documentation that you may find useful: 
http://web2py.readthedocs.io/en/latest/ ... this is the API 
documentation. It hasn't been updated in a while, but holds good for 
most of the APIs.
You could also open up a ipython console, and use the python `dir` 
function, or the `?` at the end of the method to get details of the API. 
You can use the TAB to help with type-ahead, or code lookup.

For example, try this on the ipython console:
`from gluon import html`
`dir html`
` html.xmlescape?`

I guess you have also tried the search capability in the web2py 
documentation?



Kiran Subbaraman
http://subbaraman.wordpress.com/about/

On Sun, 07-05-2017 11:36 PM, Matt Bockman wrote:
I'm also new to web2py and I have trouble with the documentation. I'm 
fairly green with python itself so maybe there are better ways to use 
the documentation or look for things. Sometimes I don't know what 
things are called or how to search for them. One thing I liked about 
developing in C++ with Qt is that I could always find a reference page 
for whatever class I was using that would give very concrete 
information about it. Sometimes I'm confused about what type a 
variable is and I often don't know how to even find out what type it 
is, let alone look up that type in documentation. I've been at it now 
for about 20 hours so I don't have too much time under my belt.


I'm still able to build my web application as fast or faster than 
using no framework with PHP. If I find an improvement to make the 
documentation I will try to contribute.


Cheers,
Matt

On Wednesday, April 26, 2017 at 6:57:50 PM UTC-7, 
jean-mic...@meggitt.com wrote:


Hi,
I'm starting with web2py, it seems a very powerfull tool.
But concerning the documentation, it's difficult to read : in this
document (see link above) it's OK from the beginning up to 75%.
After the 75% the explainations and the code (in 'code' box) are
inverted.
Who is in charge of this, in order to make it readable ?
Thanks.

http://www.web2py.com/books/default/chapter/38/06/la-couche-dabstraction-de-base-de-donnees





--
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: encoding form fields when registering user - bug or feature?

2017-05-07 Thread Anthony
On Sunday, May 7, 2017 at 11:17:40 AM UTC-4, Yebach wrote:
>
> I ment send in storage for form variables. I know it is not stored but in 
> case of safety this could be an issue. Or not? I might be just overreacting 
> :)
>

The form.vars Storage object is held only in memory, and only for the 
duration of the request. The password must be sent to the server and 
processed in memory somehow for some amount of time, otherwise it cannot be 
hashed with the hash stored in the database. What else would you propose?

Anthony

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


[web2py] Re: Private Controller Functions

2017-05-07 Thread Anthony
>From this section: 
http://web2py.com/books/default/chapter/29/04/the-core#Dispatching

*Functions that take arguments or start with a double underscore are not 
> publicly exposed and can only be called by other functions.*
>

Anthony

On Sunday, May 7, 2017 at 5:53:29 PM UTC-4, Matt Bockman wrote:
>
> When trying to figure out how to create a private function in a controller 
> I first searched the web2py book and I spent a good amount of time looking 
> for this. I eventually decided to search the Google group with success. 
>
> My ability to search/browse the web2py book is getting better but I'm 
> still very new at it. Is this convention documented in the web2py book? I 
> was looking in "the core" but I didn't find what I needed there. How can 
> this be added and where would it go? 
>
> Thanks,
> Matt
>
> On Sunday, March 16, 2008 at 2:40:14 PM UTC-7, Massimo Di Pierro wrote:
>>
>> Done in trunk!
>>
>> Massimo
>>
>> On Mar 16, 2008, at 4:07 PM, voltron wrote:
>>
>> >
>> > YESSS!  Cool! I am for that :-))
>> >
>> > On Mar 16, 9:55 pm, Massimo Di Pierro  wrote:
>> >> double underscore I can do. ;-)
>> >>
>> >> Massimo
>> >>
>> >> On Mar 16, 2008, at 11:13 AM, voltron wrote:
>> >>
>> >>
>> >>
>> >>>  I just noted that I voted for the wrong convention:
>> >>
>> >>> yes for  double underscores "__" not for a single underscore "_"
>> >>
>> >>> :-)
>> >>
>> >>> On Mar 16, 5:04 pm, voltron  wrote:
>>  Hmm, I'm not sure Massimo, Imho, I would always consider a well  
>>  known
>>  and defined Pythonic convention( everybody that uses Python  
>>  knows the
>>  double underscore convention), I am sure that all of the new web2py
>>  users like myself made the same mistake when trying to create  
>>  private
>>  functions, this is a good thing:-) ! It would not even have to be
>>  documented because its naturally pythonic, on the other hand we
>>  have a
>>  handful of users( judging from the number of registered users)  
>>  and an
>>  AJAX convention that is not universal and self descriptive, i.e,  
>>  just
>>  seeing a function called "_sendData" would not notify me  
>>  immediately
>>  that it is an AJAX function, I would have done this, "ajax_sendData
>>  ()"
>>  which is self descriptive.
>> >>
>>  I really respect the principle of not breaking Web2py, but is this
>>  not
>>  a bit too early for that? Web2py is very young and probably not so
>>  widely deployed as the other frameworks, so this would be a  
>>  chance to
>>  quickly implement such changes. Even Python itself would implement
>>  code-breaking changes soon, most frameworks undergo such changes  
>>  too,
>>  it is evolution. I seriously doubt that you would drive users away
>>  when such changes are made, on the contrary. I think many would  
>>  like
>>  web2py even more, I would definitely.
>> >>
>>  I respect your opinion, but if you are uncertain, why not poll the
>>  forum? You would know if people are against the changes then
>> >>
>>  On Mar 16, 4:23 pm, mdipierro  wrote:
>> >>
>> > correction use
>> >>
>> > if request.function[0]=='_' and not request.function=='_TEST':  
>> > raise
>> > HTTP(400,'some error')
>> >>
>> > since _TEST is the name of a "virtual" function called by admin  
>> > when
>> > you click on [test] It is automatically generated when testing.
>> >>
>> > Massimo
>> >>
>> > On Mar 16, 10:20 am, mdipierro  wrote:
>> >>
>> >> The more I think about this the more I see a problem. Some
>> >> people for
>> >> example are using the leading _ to indicate a controller
>> >> function used
>> >> for an ajax callback. In order to do what you asked I would break
>> >> their code. Even without breaking code people would still need to
>> >> upgrade the admin app to see the effects. This would break my
>> >> promise
>> >> of backward compatibility. Why don't you simply say, at the  
>> >> top of
>> >> your controller?
>> >>
>> >> if request.function[0]=='_': raise HTTP(400,'some error')
>> >>
>> >> and so you set your own convention.
>> >>
>> >> 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.