[web2py] Re: py4web - some questions

2020-03-02 Thread lyn2py

>
> Try me (install from source)
>
> git clone https://github.com/web2py/py4web.git
> cd py4web
> make assets
> make test
> make install
> py4web-start.py apps
> open http://localhost:8000/todo/index
>
> https://github.com/web2py/py4web

On Tuesday, March 3, 2020 at 1:24:11 AM UTC+8, Jim S wrote:
>
> Where are you seeing a need for make install?  I haven't run across it.
>
> -Jim
>
> On Monday, March 2, 2020 at 9:39:54 AM UTC-6, lyn2py wrote:
>>
>> Hi,
>>
>> May I know where is the "right" or "best" place to put my custom modules 
>> (those I wrote myself) in py4web?
>>
>> I usually have many controller files in web2py. With py4web, does it mean 
>> that there will only be 1 controller file and all the controllers go into 
>> that file only?
>>
>> Why is there a need to "make install"? (sorry for the noob question) I 
>> really liked that I can just use web2py out of the box.
>>
>> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/ac8f1269-2004-4f99-8488-687eb22684b7%40googlegroups.com.


[web2py] py4web - some questions

2020-03-02 Thread lyn2py
Hi,

May I know where is the "right" or "best" place to put my custom modules 
(those I wrote myself) in py4web?

I usually have many controller files in web2py. With py4web, does it mean 
that there will only be 1 controller file and all the controllers go into 
that file only?

Why is there a need to "make install"? (sorry for the noob question) I 
really liked that I can just use web2py out of the box.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/0b907636-2179-40e8-8f90-815c595452c9%40googlegroups.com.


Re: [web2py] Form Validation not working (v2.17.2)

2019-01-17 Thread lyn2py
Now the error message changes to:
Enter a number between -1e+100 and 1e+100



On Thursday, January 17, 2019 at 6:41:02 PM UTC+8, sandeep patel wrote:
>
> @lyn2py
> instead of using Field Type Integer use double
> Like This
> Field('one_field_only', 'double'))
>
> Thanks
> SP
>
> On Thu, Jan 17, 2019 at 3:47 PM lyn2py > 
> wrote:
>
>> My code did not change, but upgrading web2py caused my Form Validation to 
>> fail.
>>
>> Older (working) version: Version 
>> 2.17.1-stable+timestamp.2018.08.05.17.57.00
>>
>> New (not working) version: Version 
>> 2.17.2-stable+timestamp.2018.10.06.11.34.06
>>
>> Controller Code (did not change):
>> def index():
>> form = SQLFORM.factory(
>>Field('one_field_only', 'integer')
>> )
>>
>> if form.process(onvalidation=form_validation).accepted:
>> response.flash = 'form accepted'
>> elif form.errors:
>> response.flash = 'form has errors'
>> else:
>> response.flash = 'please fill the form'
>> return dict(form=form)
>>
>> def form_validation(form):
>> if form.vars.one_field_only=="":
>> form.errors.one_field_only = "My custom error"
>> ...more validation here...
>>
>> As mentioned it worked with the older version. In the new/latest version, 
>> the form_validation error did not work, instead it seems that web2py 
>> generated an error message that says "Enter an integer between 
>> -2.14748e+09 and 2.14748e+09"
>>
>> I need to resolve this issue, as the code is on production 
>> servers. Kindly teach me how to bypass web2py's validators so I can use my 
>> own form validation. Thank you very much!
>>
>>
>> -- 
>> 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.


[web2py] Form Validation not working (v2.17.2)

2019-01-17 Thread lyn2py
My code did not change, but upgrading web2py caused my Form Validation to 
fail.

Older (working) version: Version 2.17.1-stable+timestamp.2018.08.05.17.57.00

New (not working) version: Version 
2.17.2-stable+timestamp.2018.10.06.11.34.06

Controller Code (did not change):
def index():
form = SQLFORM.factory(
   Field('one_field_only', 'integer')
)

if form.process(onvalidation=form_validation).accepted:
response.flash = 'form accepted'
elif form.errors:
response.flash = 'form has errors'
else:
response.flash = 'please fill the form'
return dict(form=form)

def form_validation(form):
if form.vars.one_field_only=="":
form.errors.one_field_only = "My custom error"
...more validation here...

As mentioned it worked with the older version. In the new/latest version, 
the form_validation error did not work, instead it seems that web2py 
generated an error message that says "Enter an integer between -2.14748e+09 
and 2.14748e+09"

I need to resolve this issue, as the code is on production servers. Kindly 
teach me how to bypass web2py's validators so I can use my own form 
validation. Thank you very much!


-- 
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] CSV ex/import cause JSON fields to fail?

2019-01-13 Thread lyn2py
Web2py Version 2.17.2-stable+timestamp.2018.10.06.11.34.06
Using psycopg2
Using python2

I used CSV method to back up (export_to_csv_file) and then dump (im
port_from_csv_file) the Postgres db data to another Postgres db (let's say 
v9.6 to v10), and ran the same query, same code. I actually did another 
backup and dump to the same version (just using a new db) and the same 
issue occurs. 

The table model has a field that is a JSON field

db.define_table('modgb_torrents',
...
Field('jsonformat','json'),
...
)


The same basic query is run, and I printed the result of that field is as 
follows:
For v9.6
print row.jsonformat

result:




For v10 (I did a db dump from the db in the older version)
print row.jsonformat

result:



Kindly advice how to fix?

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.


[web2py] Re: web2py 2.17.1

2018-08-25 Thread lyn2py
I'm using Python 3, and when I run into a traceback, this is the ticket 
details (it's the same one...)

 'NoneType' object has no attribute 'strip'Version
web2py™ Version 2.17.1-stable+timestamp.2018.08.05.17.57.00Traceback

1.

no traceback because template parsing error




On Monday, August 6, 2018 at 9:12:25 AM UTC+8, Massimo Di Pierro wrote:
>
> Hello everybody,
>
> I released pyDAL 18.08 and web2py 2.17.1
> They mostly contain bug fixes as well as better support for python 3 and 
> bootstrap 4 by default.
> Thanks to all those who contributed!
>
> Please check them out and report any issue with them.
>
> I have a been a little slow checking this group because of lots of 
> traveling but I will do my best to catch up. :-)
>
> 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.


[web2py] Re: response.menu links alt attribute and target="blank"

2018-08-21 Thread lyn2py
I see! Thanks Anthony

On Monday, August 20, 2018 at 8:33:15 PM UTC+8, Anthony wrote:
>
> Are you using the default layout.html in the welcome app? If so, it no 
> longer uses the MENU() helper, so the solutions you reference do not work. 
> Instead, you will have to edit the code in layout.html to do what you want.
>
> Anthony
>
> On Monday, August 20, 2018 at 4:46:22 AM UTC-4, lyn2py wrote:
>>
>> Hello,
>>
>> I am using the latest pulled version from GitHub and I am not able to use 
>> either of the solution listed by Anthony
>>
>> Version 2.17.1-stable+timestamp.2018.08.05.17.57.00
>>
>> Solution 1: 
>> ('Label', False, dict(_href=URL(...), _target='blank'))
>>
>> gave this link: http://
>> 127.0.0.1:8000/app/ctrl/index/%7B'_href':%20'/app/ctrl/func
>> ',%20'_target':%20'blank'%7D
>>
>>
>> and
>>
>> Solution 2:
>> ('', False, A('Label', _href=URL(...), _target='blank'))
>>
>> gave this link: http://127.0.0.1:8000/app/ctrl/index/%3Ca%20href= 
>>
>> But if I used the A(...) code in a controller, it prints to console and 
>> screen with correct HTML.
>>
>> Has there been a change in code? Please assist... Thanks!
>>
>>
>>
>>
>> On Monday, April 15, 2013 at 9:50:29 AM UTC+8, Anthony wrote:
>>>
>>> A menu item can be specified like this:
>>>
>>> ('Label', False, dict(_href=URL(...), _target='blank'))
>>>
>>> or this:
>>>
>>> ('', False, A('Label', _href=URL(...), _target='blank'))
>>>
>>> Note, in the second case, the third element can be any HTML helper 
>>> object (including nested helpers).
>>>
>>> Anthony
>>>
>>> On Sunday, April 14, 2013 6:09:56 PM UTC-4, BlueShadow wrote:
>>>>
>>>> Hi,
>>>> I like to be able to set some link attributes in my response menu:
>>>> I want some links to open in a new tab: target="blank"
>>>> and I would love to set some alt atributes for the links in the 
>>>> response menu.
>>>> Is that even possible?
>>>> 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.


[web2py] Re: multiple controllers with one view

2018-08-20 Thread lyn2py
To choose which view, put 

response.view="view.html"

in the 2 controllers that share the same view.

And you need to return the same variables used for the view in both 
controllers.




On Monday, August 20, 2018 at 4:44:29 AM UTC+8, lbjc...@gmail.com wrote:
>
> I have two controllers in an app. 
> One controller has functions that manage DAL tables and forms. The second 
> has imported module that are sometimes called. They both use one view. I 
> have tried to figure out ho to work this out but cant find ho to print 
> results to view from the second controller. With this arrangement, I keep 
> getting an error message:  
>
> name 'conversations' is not defined
>
>
> . My second controller has this code:
> def conversations():
> row = db(db.post.author== auth.user.id).select(db.post.id, db.post.
> convo, orderby=~db.post.id, limitby=(0,1)).first()
> id = row.convo if row else None
> return dict(id=id)
>
>
> with the view.html
> {{=conversations()}}
>
> I tried looking for an example, reference previous items related to this 
> and the only answer I got online is 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.


[web2py] Re: response.menu links alt attribute and target="blank"

2018-08-20 Thread lyn2py
Hello,

I am using the latest pulled version from GitHub and I am not able to use 
either of the solution listed by Anthony

Version 2.17.1-stable+timestamp.2018.08.05.17.57.00

Solution 1: 
('Label', False, dict(_href=URL(...), _target='blank'))

gave this link: http:
//127.0.0.1:8000/app/ctrl/index/%7B'_href':%20'/app/ctrl/func',%20'_target':%20'blank'%7D


and

Solution 2:
('', False, A('Label', _href=URL(...), _target='blank'))

gave this link: http://127.0.0.1:8000/app/ctrl/index/%3Ca%20href= 

But if I used the A(...) code in a controller, it prints to console and 
screen with correct HTML.

Has there been a change in code? Please assist... Thanks!




On Monday, April 15, 2013 at 9:50:29 AM UTC+8, Anthony wrote:
>
> A menu item can be specified like this:
>
> ('Label', False, dict(_href=URL(...), _target='blank'))
>
> or this:
>
> ('', False, A('Label', _href=URL(...), _target='blank'))
>
> Note, in the second case, the third element can be any HTML helper object 
> (including nested helpers).
>
> Anthony
>
> On Sunday, April 14, 2013 6:09:56 PM UTC-4, BlueShadow wrote:
>>
>> Hi,
>> I like to be able to set some link attributes in my response menu:
>> I want some links to open in a new tab: target="blank"
>> and I would love to set some alt atributes for the links in the response 
>> menu.
>> Is that even possible?
>> 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.


[web2py] Re: python2 and python3 in 1 machine

2018-05-07 Thread lyn2py
Yes I'm using this way to run both py2 and py3 on the same machine

Have 2 folders, one for py2 and one for py3.

python2 ...path to py2 folder/web2py.py 

...and do the same for py3.

Works!

On Tuesday, May 8, 2018 at 8:11:37 AM UTC+8, 黄祥 wrote:
>
> plan to test web2py both python2 and python3 in 1 machine, any idea how to 
> do that in the safety way?
> already googling found this:
>
> brew update
> brew install python
> brew install python3
>
> any thought or comment?
>
> 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 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 2.16.1 is OUT

2018-05-06 Thread lyn2py
Hi Massimo, I explained with some examples over 
at: https://groups.google.com/forum/#!topic/web2py/tNmfCY5nxHM

I tried to fiddle with gluon/restricted.py but not knowing what the 
functions / methods are for, I gave up after some hours and used a quick 
fix for now, in hope of a proper traceback ticket for py3 soon. Thank you 
for looking into it!

On Sunday, May 6, 2018 at 10:59:04 AM UTC+8, Massimo Di Pierro wrote:
>
> can you show an example of what you mean?
>
>
> On Friday, 27 April 2018 21:21:47 UTC-5, lyn2py wrote:
>>
>> Hello,
>>
>> The traceback for Python 3 is not like the ones in Python 2 and it can 
>> get difficult to debug the program, is it possible to see a fix soon?
>>
>> Thank you!
>>
>> 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.


[web2py] Re: Traceback for Python 3

2018-05-03 Thread lyn2py
I managed to get a proper traceback with python 3 using:

try:
produce_error(2)
except:
etype, evalue, tb = sys.exc_info()
tbe = traceback.TracebackException( etype, evalue, tb )
print( ''.join(tbe.format()) )

I hope someone can look into how to properly log web2py tickets. Thank you!


On Wednesday, May 2, 2018 at 9:19:38 AM UTC+8, lyn2py wrote:
>
> Now I have an error like this one:
>
> RecursionError: maximum recursion depth exceeded while calling a Python object
>
>
> ...and I have no idea how to debug it, since I'm not using any recursion 
> in my code. I suspect it's an issue with the module or modules (not written 
> by me) I'm using, but I can't troubleshoot it or ask anyone about it 
> without a proper traceback. Admittedly I'm no traceback expert, as a 
> quick-fix, I tried to print the traceback results to console but nothing 
> came up :(
>
>
> On Wednesday, May 2, 2018 at 2:31:43 AM UTC+8, lyn2py wrote:
>>
>> Hello,
>>
>> I've started using python3 with web2py and it has saved me a lot of 
>> encoding headaches.
>>
>> However, the traceback Tickets in web2py are not as comprehensive as 
>> those in python2 with web2py. They look like:
>>
>>  'dict' object has no attribute 'content'Version
>> web2py™ Version 2.16.1-stable+timestamp.2018.03.08.10.23.01Traceback
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>>
>> Traceback (most recent call last):
>>   File "/Users/web2py/gluon/restricted.py", line 219, in restricted
>> exec(ccode, environment)
>> AttributeError: 'dict' object has no attribute 'content'
>>
>> During handling of the above exception, another exception occurred:
>>
>> Traceback (most recent call last):
>>   File "/Users/web2py/gluon/restricted.py", line 141, in __init__
>> self.traceback = traceback.format_exc()
>> AttributeError: 'NoneType' object has no attribute 'strip'
>>
>> In file: /Users/web2py/source/applications/app/controllers/app.py
>>
>> 1.
>>
>>  at 0x110fe34b0, file 
>> "/Users/web2py/applications/app/controllers/app.py", line 1>
>>
>>
>>
>> Now, the above error is easy to troubleshoot, because it is quite obvious 
>> (can just do a search on the specific file, but I've encountered some like:
>>
>> UnicodeEncodeError: 'ascii' codec can't encode character '\u2019' in 
>> position 11: ordinal not in range(128)
>>
>> (yes, I still encounter an encoding issue in python3! haha.)
>>
>> ...and without the specific line in the file, it gets difficult to debug 
>> the code. It took 30 mins to find the problematic line and turns out it 
>> originated from another file (module file). And purely through guesswork I 
>> hit the jackpot after 40mins.
>>
>> In any case, all the tracebacks for Python 3 look like:
>>
>> Traceback (most recent call last):
>>   File "/Users/web2py/gluon/restricted.py", line 219, in restricted
>> exec(ccode, environment)
>> 
>>
>>
>> I hope the traceback Ticket can be more helpful for troubleshooting. 
>> Would appreciate if a fix can be soon...
>>
>> 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.


[web2py] Re: Traceback for Python 3

2018-05-01 Thread lyn2py
Now I have an error like this one:

RecursionError: maximum recursion depth exceeded while calling a Python object


...and I have no idea how to debug it, since I'm not using any recursion in 
my code. I suspect it's an issue with the module or modules (not written by 
me) I'm using, but I can't troubleshoot it or ask anyone about it without a 
proper traceback. Admittedly I'm no traceback expert, as a quick-fix, I 
tried to print the traceback results to console but nothing came up :(


On Wednesday, May 2, 2018 at 2:31:43 AM UTC+8, lyn2py wrote:
>
> Hello,
>
> I've started using python3 with web2py and it has saved me a lot of 
> encoding headaches.
>
> However, the traceback Tickets in web2py are not as comprehensive as those 
> in python2 with web2py. They look like:
>
>  'dict' object has no attribute 'content'Version
> web2py™ Version 2.16.1-stable+timestamp.2018.03.08.10.23.01Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
>
> Traceback (most recent call last):
>   File "/Users/web2py/gluon/restricted.py", line 219, in restricted
> exec(ccode, environment)
> AttributeError: 'dict' object has no attribute 'content'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "/Users/web2py/gluon/restricted.py", line 141, in __init__
> self.traceback = traceback.format_exc()
> AttributeError: 'NoneType' object has no attribute 'strip'
>
> In file: /Users/web2py/source/applications/app/controllers/app.py
>
> 1.
>
>  at 0x110fe34b0, file 
> "/Users/web2py/applications/app/controllers/app.py", line 1>
>
>
>
> Now, the above error is easy to troubleshoot, because it is quite obvious 
> (can just do a search on the specific file, but I've encountered some like:
>
> UnicodeEncodeError: 'ascii' codec can't encode character '\u2019' in 
> position 11: ordinal not in range(128)
>
> (yes, I still encounter an encoding issue in python3! haha.)
>
> ...and without the specific line in the file, it gets difficult to debug 
> the code. It took 30 mins to find the problematic line and turns out it 
> originated from another file (module file). And purely through guesswork I 
> hit the jackpot after 40mins.
>
> In any case, all the tracebacks for Python 3 look like:
>
> Traceback (most recent call last):
>   File "/Users/web2py/gluon/restricted.py", line 219, in restricted
> exec(ccode, environment)
> 
>
>
> I hope the traceback Ticket can be more helpful for troubleshooting. Would 
> appreciate if a fix can be soon...
>
> 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.


[web2py] Traceback for Python 3

2018-05-01 Thread lyn2py
Hello,

I've started using python3 with web2py and it has saved me a lot of 
encoding headaches.

However, the traceback Tickets in web2py are not as comprehensive as those 
in python2 with web2py. They look like:

 'dict' object has no attribute 'content'Version
web2py™ Version 2.16.1-stable+timestamp.2018.03.08.10.23.01Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.

Traceback (most recent call last):
  File "/Users/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
AttributeError: 'dict' object has no attribute 'content'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/web2py/gluon/restricted.py", line 141, in __init__
self.traceback = traceback.format_exc()
AttributeError: 'NoneType' object has no attribute 'strip'

In file: /Users/web2py/source/applications/app/controllers/app.py

1.

 at 0x110fe34b0, file 
"/Users/web2py/applications/app/controllers/app.py", line 1>



Now, the above error is easy to troubleshoot, because it is quite obvious 
(can just do a search on the specific file, but I've encountered some like:

UnicodeEncodeError: 'ascii' codec can't encode character '\u2019' in 
position 11: ordinal not in range(128)

(yes, I still encounter an encoding issue in python3! haha.)

...and without the specific line in the file, it gets difficult to debug 
the code. It took 30 mins to find the problematic line and turns out it 
originated from another file (module file). And purely through guesswork I 
hit the jackpot after 40mins.

In any case, all the tracebacks for Python 3 look like:

Traceback (most recent call last):
  File "/Users/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)



I hope the traceback Ticket can be more helpful for troubleshooting. Would 
appreciate if a fix can be soon...

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.


[web2py] Re: web2py 2.16.1 is OUT

2018-04-27 Thread lyn2py
Hello,

The traceback for Python 3 is not like the ones in Python 2 and it can get 
difficult to debug the program, is it possible to see a fix soon?

Thank you!

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.


[web2py] Re: web2py 2.16.1 is OUT

2018-04-20 Thread lyn2py
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.


[web2py] Google AMP - benefits with web2py?

2017-09-28 Thread lyn2py
Hello guys!

Just stumbled upon something. Google released "AMP" that will reduce page 
load time if you add some syntax to HTML. It is also optimised for mobile.

An introduction article here:
https://www.shopify.com/partners/blog/how-google-s-amp-project-is-changing-the-mobile-web

The official site:
https://www.ampproject.org/learn/overview/

-- 
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] Handle multidimensional post data?

2017-08-03 Thread lyn2py
I have a json field and I want to turn each key-value in the json field 
into an HTML field-value.

For example,

{"add1":"abc", "add2":"xyz"}

into

INPUT( _name="json_field[add1]", _value="abc")
INPUT( _name="json_field[add2]", _value="xyz")

in HTML.

However, when the form is POST-ed, the results are:

{"json_field[add1]": "abc", "json_field[add2]": "xyz"}

But I would like it to be:

json_field = {"add1": "abc", "add2": "xyz"}


How to I get web2py to receive POST-ed multidimensional arrays from a form? 
I don't know where to start.
If it helps, my form is created using SQLFORM and modified to include 
individual fields for each json key-value. The form is POST-ed via submit 
button, without any javascript trapping/intervention.

Thank you for your help!







-- 
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: to XML() or to JSON.parse() ?

2017-07-31 Thread lyn2py
new helper?

On Monday, July 31, 2017 at 10:54:10 PM UTC+8, Pierre wrote:
>
> thanks Anthony
>
> I'll use ASSIGNJS. I'd never heard of this helper.too bad it's 
> unpublished in the book
>

-- 
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] [DAL] AttributeError: 'Expression' object has no attribute 'tablename'

2017-07-19 Thread lyn2py
How do I resolve this error? 

Traceback (most recent call last):
  File "/Users/web2py/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "", line 83, in 
  File "/Users/web2py/web2py/gluon/globals.py", line 422, in write
self.body.write(to_native(xmlescape(data)))
  File "/Users/web2py/web2py/gluon/html.py", line 125, in xmlescape
return to_bytes(data.xml())
  File "/Users/web2py/web2py/gluon/html.py", line 960, in xml
(fa, co) = self._xml()
  File "/Users/web2py/web2py/gluon/html.py", line 952, in _xml
co = b''.join([xmlescape(component) for component in self.components])
  File "/Users/web2py/web2py/gluon/html.py", line 125, in xmlescape
return to_bytes(data.xml())
  File "/Users/web2py/web2py/gluon/html.py", line 960, in xml
(fa, co) = self._xml()
  File "/Users/web2py/web2py/gluon/html.py", line 952, in _xml
co = b''.join([xmlescape(component) for component in self.components])
  File "/Users/web2py/web2py/gluon/html.py", line 125, in xmlescape
return to_bytes(data.xml())
  File "/Users/web2py/web2py/gluon/html.py", line 960, in xml
(fa, co) = self._xml()
  File "/Users/web2py/web2py/gluon/html.py", line 952, in _xml
co = b''.join([xmlescape(component) for component in self.components])
  File "/Users/web2py/web2py/gluon/html.py", line 125, in xmlescape
return to_bytes(data.xml())
  File "/Users/web2py/web2py/gluon/html.py", line 960, in xml
(fa, co) = self._xml()
  File "/Users/web2py/web2py/gluon/html.py", line 952, in _xml
co = b''.join([xmlescape(component) for component in self.components])
  File "/Users/web2py/web2py/gluon/html.py", line 125, in xmlescape
return to_bytes(data.xml())
  File "/Users/web2py/web2py/gluon/html.py", line 960, in xml
(fa, co) = self._xml()
  File "/Users/web2py/web2py/gluon/html.py", line 952, in _xml
co = b''.join([xmlescape(component) for component in self.components])
  File "/Users/web2py/web2py/gluon/html.py", line 125, in xmlescape
return to_bytes(data.xml())
  File "/Users/web2py/web2py/gluon/packages/dal/pydal/objects.py", line 
2497, in xml
rv = self.db.represent('rows_xml', self)
  File "/Users/web2py/web2py/gluon/packages/dal/pydal/base.py", line 834, 
in represent
return self.representers[name](*args, **kwargs)
  File "/Users/web2py/web2py/gluon/sqlhtml.py", line 3322, in __init__
tablemap = dict(((f.tablename, f.table) for f in fieldmap.values()))
  File "/Users/web2py/web2py/gluon/sqlhtml.py", line 3322, in 
tablemap = dict(((f.tablename, f.table) for f in fieldmap.values()))
AttributeError: 'Expression' object has no attribute 'tablename'

The code that throws this error:

def dbselect():
only_after = 
t = db[ 'unique_sites' ]
h = db[ 'TABLE_of_sites' ]
max = h.last_updated.max()
q = h.type_id==1
q&= h.last_updated>datetime.now()-timedelta(weeks=8)
join = t.on(t.url==h.url)
rows = db(q).select(t.ALL, max, groupby=t.ALL, join=join) # this 
produces the error above :(
rows = db(q).select(t.ALL, max, groupby=t.ALL, join=join).as_list() 
#this doesn't throw the error :)
return locals()


VERSION:

*Version 2.15.2-stable+timestamp.2017.07.19.01.21.31*

*Postgresql 9.6 + psycopg2 adapter*



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.


[web2py] Re: web2py 2.15.1 is OUT

2017-07-13 Thread lyn2py
Anthony, pls 
see https://groups.google.com/d/msg/web2py/h4b4xz2NzNM/QHSoRfrcCAAJ

If we put double quotes on the table name, which happens to not be there 
for *aggregates* and *distinct* then the sql query will work.

On Friday, July 14, 2017 at 5:43:57 AM UTC+8, Anthony wrote:
>
> Are you saying that used to work but doesn't any longer?
>
> How about db(db.table).select(max)?
>
> Anthony
>
> On Thursday, July 13, 2017 at 1:16:31 PM UTC-4, lyn2py wrote:
>>
>> I'm using a simple query to get aggregate:
>>
>> max = db.table.date.max()
>> row = db().select(max)
>>
>> Just following the example here 
>> http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#sum-avg-min-max-and-len
>>
>> But I ran into this error:
>>
>> Traceback (most recent call last):
>>   File "/Users/web2py/web2py/gluon/main.py", line 445, in wsgibase
>> serve_controller(request, response, session)
>>   File "/Users/web2py/web2py/gluon/main.py", line 180, in serve_controller
>> page = run_controller_in(request.controller, request.function, 
>> environment)
>>   File "/Users/web2py/web2py/gluon/compileapp.py", line 660, in 
>> run_controller_in
>> vars = vars.xml()
>>   File "/Users/web2py/web2py/gluon/packages/dal/pydal/objects.py", line 
>> 2497, in xml
>> rv = self.db.represent('rows_xml', self)
>>   File "/Users/web2py/web2py/gluon/packages/dal/pydal/base.py", line 834, 
>> in represent
>> return self.representers[name](*args, **kwargs)
>>   File "/Users/web2py/web2py/gluon/sqlhtml.py", line 3319, in __init__
>> tablemap = dict(((f.tablename, f.table) for f in fieldmap.values()))
>>   File "/Users/web2py/web2py/gluon/sqlhtml.py", line 3319, in 
>> tablemap = dict(((f.tablename, f.table) for f in fieldmap.values()))
>> AttributeError: 'Expression' object has no attribute 'tablename'
>>
>>
>> Kindly assist.
>>
>>
>> On Tuesday, July 11, 2017 at 5:40:08 AM UTC+8, Massimo Di Pierro wrote:
>>>
>>> It took a year. Thanks to everybody who contributed. There are a ton of 
>>> bug fixes and speed improvements.
>>>
>>> I would encourage everybody who contributed to add a comment in this 
>>> thread explaining the main features/improvements they have made.
>>>
>>> If anything does not work or was broken it is only fault and I will 
>>> remedy if reported.
>>>
>>> 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.


[web2py] Re: web2py 2.15.1 is OUT

2017-07-13 Thread lyn2py
Thank you Anthony. I always appreciate your input.

I recall using the aggregates max() and count() before and they worked fine 
following the book. That was quite long ago. However, this time, I did not 
try on the "old" web2py version. I upgraded to 2.15.1 and continued to code 
in it.

Using
db(db.table).select(max)



Gave a longer traceback:
Traceback (most recent call last):
  File "/Users/web2py/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "", line 83, in 
  File "/Users/web2py/web2py/gluon/globals.py", line 422, in write
self.body.write(to_native(xmlescape(data)))
  File "/Users/web2py/web2py/gluon/html.py", line 125, in xmlescape
return to_bytes(data.xml())
  File "/Users/web2py/web2py/gluon/html.py", line 960, in xml
(fa, co) = self._xml()
  File "/Users/web2py/web2py/gluon/html.py", line 952, in _xml
co = b''.join([xmlescape(component) for component in self.components])
  File "/Users/web2py/web2py/gluon/html.py", line 125, in xmlescape
return to_bytes(data.xml())
  File "/Users/web2py/web2py/gluon/html.py", line 960, in xml
(fa, co) = self._xml()
  File "/Users/web2py/web2py/gluon/html.py", line 952, in _xml
co = b''.join([xmlescape(component) for component in self.components])
  File "/Users/web2py/web2py/gluon/html.py", line 125, in xmlescape
return to_bytes(data.xml())
  File "/Users/web2py/web2py/gluon/html.py", line 960, in xml
(fa, co) = self._xml()
  File "/Users/web2py/web2py/gluon/html.py", line 952, in _xml
co = b''.join([xmlescape(component) for component in self.components])
  File "/Users/web2py/web2py/gluon/html.py", line 125, in xmlescape
return to_bytes(data.xml())
  File "/Users/web2py/web2py/gluon/html.py", line 960, in xml
(fa, co) = self._xml()
  File "/Users/web2py/web2py/gluon/html.py", line 952, in _xml
co = b''.join([xmlescape(component) for component in self.components])
  File "/Users/web2py/web2py/gluon/html.py", line 125, in xmlescape
return to_bytes(data.xml())
  File "/Users/web2py/web2py/gluon/html.py", line 960, in xml
(fa, co) = self._xml()
  File "/Users/web2py/web2py/gluon/html.py", line 952, in _xml
co = b''.join([xmlescape(component) for component in self.components])
  File "/Users/web2py/web2py/gluon/html.py", line 125, in xmlescape
return to_bytes(data.xml())
  File "/Users/web2py/web2py/gluon/packages/dal/pydal/objects.py", line 
2497, in xml
rv = self.db.represent('rows_xml', self)
  File "/Users/web2py/web2py/gluon/packages/dal/pydal/base.py", line 834, 
in represent
return self.representers[name](*args, **kwargs)
  File "/Users/web2py/web2py/gluon/sqlhtml.py", line 3319, in __init__
tablemap = dict(((f.tablename, f.table) for f in fieldmap.values()))
  File "/Users/web2py/web2py/gluon/sqlhtml.py", line 3319, in 
tablemap = dict(((f.tablename, f.table) for f in fieldmap.values()))
AttributeError: 'Expression' object has no attribute 'tablename'



On Friday, July 14, 2017 at 5:43:57 AM UTC+8, Anthony wrote:
>
> Are you saying that used to work but doesn't any longer?
>
> How about db(db.table).select(max)?
>
> Anthony
>
> On Thursday, July 13, 2017 at 1:16:31 PM UTC-4, lyn2py wrote:
>>
>> I'm using a simple query to get aggregate:
>>
>> max = db.table.date.max()
>> row = db().select(max)
>>
>> Just following the example here 
>> http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#sum-avg-min-max-and-len
>>
>> But I ran into this error:
>>
>> Traceback (most recent call last):
>>   File "/Users/web2py/web2py/gluon/main.py", line 445, in wsgibase
>> serve_controller(request, response, session)
>>   File "/Users/web2py/web2py/gluon/main.py", line 180, in serve_controller
>> page = run_controller_in(request.controller, request.function, 
>> environment)
>>   File "/Users/web2py/web2py/gluon/compileapp.py", line 660, in 
>> run_controller_in
>> vars = vars.xml()
>>   File "/Users/web2py/web2py/gluon/packages/dal/pydal/objects.py", line 
>> 2497, in xml
>> rv = self.db.represent('rows_xml', self)
>>   File "/Users/web2py/web2py/gluon/packages/dal/pydal/base.py", line 834, 
>> in represent
>> return self.representers[name](*args, **kwargs)
>>   File "/Users/web2py/web2py/gluon/sqlhtml.py", line 3319, in __init__
>> tablemap = dict(((f.tablename, f.table) for f in fieldmap.values()))
>>   File "/Users/web2py/web2py/gluon/sqlhtml.py", line 3319, in 
>> tablemap = dict(((

[web2py] Re: web2py 2.15.1 is OUT

2017-07-13 Thread lyn2py
Thank you Leonel,

I actually have a very complex query, and it ran into the error I 
mentioned. In my query I have:
db(query).select(other_fields, aggregate, groupby=...etc..., orderby=...etc
...)

and I ran into the error. So I tried to identify if it was my complex query 
throwing the error, my model or some other part, and over 4 hours (too 
long, I know...) I narrowed down to the aggregate, I tested specifically to 
the example provided by the web2py book. It still gave the same error.

In my normal use-case, I have a "query", but it's still good to know and 
add to the book that it is deprecated.


On Friday, July 14, 2017 at 8:17:11 AM UTC+8, Leonel Câmara wrote:
>
> Note this is deprecated:
>
> row = db().select(max)
>
> Calling db() like that without a query will break common filters for 
> instance.
>

-- 
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.15.1 is OUT

2017-07-13 Thread lyn2py
No I am not using the rname feature

On Friday, July 14, 2017 at 2:26:57 AM UTC+8, Richard wrote:
>
> Are you using rname feature?
>
> If so, the issue may need to be further investigate as why SELECT DISTINCT 
> ON (TABLE_of_sites.title) is not double quoted and all the other table_name 
> and field instance are...
>
> So maybe the flaw is somewhere in the escaping related to rname feature...
>
> Richard
>
> On Thu, Jul 13, 2017 at 2:11 PM, lyn2py <lyn...@gmail.com > 
> wrote:
>
>> Following this lead 
>> https://stackoverflow.com/questions/34708963/error-missing-from-clause-entry-for-table
>>
>> I discovered that if we add double quotes to the tablename, for all 
>> instances of the tablename, like this:
>> "TABLE_of_sites"
>>
>> Then the query will work.
>>
>>
>> On Friday, July 14, 2017 at 1:48:10 AM UTC+8, lyn2py wrote:
>>>
>>> Table code:
>>> db.define_table('TABLE_of_sites', 
>>> Field('site_id', 'reference sites'),
>>> Field('title', 'string'), 
>>> Field('date','datetime'),
>>> ...
>>> Field('updated','datetime', update=request.now, writable=False),
>>> format='%(site_id)s'
>>> )
>>>
>>>
>>> In controller:
>>> table = db['TABLE_of_sites']
>>> rows = db(table).select(distinct=table.title)
>>>
>>> Gives the error:
>>>
>>> ProgrammingError: missing FROM-clause entry for table "table_of_sites"
>>> LINE 1: SELECT DISTINCT ON (TABLE_of_sites.title) "TABLE_of...
>>>
>>> ^
>>>
>>>
>>> I printed the sql query that resulted from the above code. It has the 
>>> FROM-clause, so I don't know why it would give the error. This is the 
>>> printed query:
>>> SELECT DISTINCT ON (TABLE_of_sites.title) "TABLE_of_sites"."id", 
>>> "TABLE_of_sites"."site_id", "TABLE_of_sites"."date", 
>>> "TABLE_of_sites"."title" FROM "TABLE_of_sites" WHERE ("TABLE_of_sites"."id" 
>>> IS NOT NULL);
>>>
>>> I need to select 1 row for entries that appear multiple times for a 
>>> particular title, hence I'm using distinct (or aggregates like max() - 
>>> details in my previous post) but both are not working.
>>>
>>> Thank you for your time and assistance!
>>>
>>>
>>>
>>>
>>> On Tuesday, July 11, 2017 at 5:40:08 AM UTC+8, Massimo Di Pierro wrote:
>>>>
>>>> It took a year. Thanks to everybody who contributed. There are a ton of 
>>>> bug fixes and speed improvements.
>>>>
>>>> I would encourage everybody who contributed to add a comment in this 
>>>> thread explaining the main features/improvements they have made.
>>>>
>>>> If anything does not work or was broken it is only fault and I will 
>>>> remedy if reported.
>>>>
>>>> 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+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.


[web2py] Re: web2py 2.15.1 is OUT

2017-07-13 Thread lyn2py
Following this 
lead 
https://stackoverflow.com/questions/34708963/error-missing-from-clause-entry-for-table

I discovered that if we add double quotes to the tablename, for all 
instances of the tablename, like this:
"TABLE_of_sites"

Then the query will work.

On Friday, July 14, 2017 at 1:48:10 AM UTC+8, lyn2py wrote:
>
> Table code:
> db.define_table('TABLE_of_sites', 
> Field('site_id', 'reference sites'),
> Field('title', 'string'), 
> Field('date','datetime'),
> ...
> Field('updated','datetime', update=request.now, writable=False),
> format='%(site_id)s'
> )
>
>
> In controller:
> table = db['TABLE_of_sites']
> rows = db(table).select(distinct=table.title)
>
> Gives the error:
>
> ProgrammingError: missing FROM-clause entry for table "table_of_sites"
> LINE 1: SELECT DISTINCT ON (TABLE_of_sites.title) "TABLE_of...
>
> ^
>
>
> I printed the sql query that resulted from the above code. It has the 
> FROM-clause, so I don't know why it would give the error. This is the 
> printed query:
> SELECT DISTINCT ON (TABLE_of_sites.title) "TABLE_of_sites"."id", 
> "TABLE_of_sites"."site_id", "TABLE_of_sites"."date", 
> "TABLE_of_sites"."title" FROM "TABLE_of_sites" WHERE ("TABLE_of_sites"."id" 
> IS NOT NULL);
>
> I need to select 1 row for entries that appear multiple times for a 
> particular title, hence I'm using distinct (or aggregates like max() - 
> details in my previous post) but both are not working.
>
> Thank you for your time and assistance!
>
>
>
>
> On Tuesday, July 11, 2017 at 5:40:08 AM UTC+8, Massimo Di Pierro wrote:
>>
>> It took a year. Thanks to everybody who contributed. There are a ton of 
>> bug fixes and speed improvements.
>>
>> I would encourage everybody who contributed to add a comment in this 
>> thread explaining the main features/improvements they have made.
>>
>> If anything does not work or was broken it is only fault and I will 
>> remedy if reported.
>>
>> 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.


[web2py] Re: web2py 2.15.1 is OUT

2017-07-13 Thread lyn2py
Table code:
db.define_table('TABLE_of_sites', 
Field('site_id', 'reference sites'),
Field('title', 'string'), 
Field('date','datetime'),
...
Field('updated','datetime', update=request.now, writable=False),
format='%(site_id)s'
)


In controller:
table = db['TABLE_of_sites']
rows = db(table).select(distinct=table.title)

Gives the error:

ProgrammingError: missing FROM-clause entry for table "table_of_sites"
LINE 1: SELECT DISTINCT ON (TABLE_of_sites.title) "TABLE_of...

^


I printed the sql query that resulted from the above code. It has the 
FROM-clause, so I don't know why it would give the error. This is the 
printed query:
SELECT DISTINCT ON (TABLE_of_sites.title) "TABLE_of_sites"."id", 
"TABLE_of_sites"."site_id", "TABLE_of_sites"."date", 
"TABLE_of_sites"."title" FROM "TABLE_of_sites" WHERE ("TABLE_of_sites"."id" 
IS NOT NULL);

I need to select 1 row for entries that appear multiple times for a 
particular title, hence I'm using distinct (or aggregates like max() - 
details in my previous post) but both are not working.

Thank you for your time and assistance!




On Tuesday, July 11, 2017 at 5:40:08 AM UTC+8, Massimo Di Pierro wrote:
>
> It took a year. Thanks to everybody who contributed. There are a ton of 
> bug fixes and speed improvements.
>
> I would encourage everybody who contributed to add a comment in this 
> thread explaining the main features/improvements they have made.
>
> If anything does not work or was broken it is only fault and I will remedy 
> if reported.
>
> 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] Re: web2py 2.15.1 is OUT

2017-07-13 Thread lyn2py
Here it is...

db.define_table('TABLE_of_sites', 
Field('site_id', 'reference sites'),
Field('title', 'string'), 
Field('date','datetime'),
...
Field('updated','datetime', update=request.now, writable=False),
format='%(site_id)s'
)

There are multiple entries for a particular title, so I want to get the 
MAX(date) entry.

This is the query I used (result = not working):
table = 'TABLE_of_sites'
max = db[table].date.max()
row = db().select(max)


Other queries on the table work fine, but not aggregates. I tried count(), 
max() and they both don't work.

Queries that work are the straightforward ones:
db(db[table]).select()

In fact I also tried distinct and there's an error too, I will make a 
separate post.


On Friday, July 14, 2017 at 1:22:01 AM UTC+8, Richard wrote:
>
> @lyn2py, seems more a issue with naming in your model than anything 
> else... Can you show us your model?
>
> On Thu, Jul 13, 2017 at 1:16 PM, lyn2py <lyn...@gmail.com > 
> wrote:
>
>> I'm using a simple query to get aggregate:
>>
>> max = db.table.date.max()
>> row = db().select(max)
>>
>> Just following the example here 
>> http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#sum-avg-min-max-and-len
>>
>> But I ran into this error:
>>
>> Traceback (most recent call last):
>>   File "/Users/web2py/web2py/gluon/main.py", line 445, in wsgibase
>> serve_controller(request, response, session)
>>   File "/Users/web2py/web2py/gluon/main.py", line 180, in serve_controller
>> page = run_controller_in(request.controller, request.function, 
>> environment)
>>   File "/Users/web2py/web2py/gluon/compileapp.py", line 660, in 
>> run_controller_in
>> vars = vars.xml()
>>   File "/Users/web2py/web2py/gluon/packages/dal/pydal/objects.py", line 
>> 2497, in xml
>> rv = self.db.represent('rows_xml', self)
>>   File "/Users/web2py/web2py/gluon/packages/dal/pydal/base.py", line 834, 
>> in represent
>> return self.representers[name](*args, **kwargs)
>>   File "/Users/web2py/web2py/gluon/sqlhtml.py", line 3319, in __init__
>> tablemap = dict(((f.tablename, f.table) for f in fieldmap.values()))
>>   File "/Users/web2py/web2py/gluon/sqlhtml.py", line 3319, in 
>> tablemap = dict(((f.tablename, f.table) for f in fieldmap.values()))
>> AttributeError: 'Expression' object has no attribute 'tablename'
>>
>>
>> Kindly assist.
>>
>>
>> On Tuesday, July 11, 2017 at 5:40:08 AM UTC+8, Massimo Di Pierro wrote:
>>>
>>> It took a year. Thanks to everybody who contributed. There are a ton of 
>>> bug fixes and speed improvements.
>>>
>>> I would encourage everybody who contributed to add a comment in this 
>>> thread explaining the main features/improvements they have made.
>>>
>>> If anything does not work or was broken it is only fault and I will 
>>> remedy if reported.
>>>
>>> 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+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.


[web2py] Re: web2py 2.15.1 is OUT

2017-07-13 Thread lyn2py
I'm using a simple query to get aggregate:

max = db.table.date.max()
row = db().select(max)

Just following the example 
here 
http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#sum-avg-min-max-and-len

But I ran into this error:

Traceback (most recent call last):
  File "/Users/web2py/web2py/gluon/main.py", line 445, in wsgibase
serve_controller(request, response, session)
  File "/Users/web2py/web2py/gluon/main.py", line 180, in serve_controller
page = run_controller_in(request.controller, request.function, 
environment)
  File "/Users/web2py/web2py/gluon/compileapp.py", line 660, in 
run_controller_in
vars = vars.xml()
  File "/Users/web2py/web2py/gluon/packages/dal/pydal/objects.py", line 
2497, in xml
rv = self.db.represent('rows_xml', self)
  File "/Users/web2py/web2py/gluon/packages/dal/pydal/base.py", line 834, 
in represent
return self.representers[name](*args, **kwargs)
  File "/Users/web2py/web2py/gluon/sqlhtml.py", line 3319, in __init__
tablemap = dict(((f.tablename, f.table) for f in fieldmap.values()))
  File "/Users/web2py/web2py/gluon/sqlhtml.py", line 3319, in 
tablemap = dict(((f.tablename, f.table) for f in fieldmap.values()))
AttributeError: 'Expression' object has no attribute 'tablename'


Kindly assist.


On Tuesday, July 11, 2017 at 5:40:08 AM UTC+8, Massimo Di Pierro wrote:
>
> It took a year. Thanks to everybody who contributed. There are a ton of 
> bug fixes and speed improvements.
>
> I would encourage everybody who contributed to add a comment in this 
> thread explaining the main features/improvements they have made.
>
> If anything does not work or was broken it is only fault and I will remedy 
> if reported.
>
> 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.


[web2py] Re: DAL pg8000 adapter and JSON type

2017-07-12 Thread lyn2py
After switching to psycopg2 I still run into the same errors. However, 
after I updated to 2.15.1 (after Massimo's announcement on the groups), it 
now works.

On Tuesday, July 11, 2017 at 9:44:19 PM UTC+8, Leonel Câmara wrote:
>
> pydal uses text for json fields if you're using pg8000 because pg8000 
> didn't use to support json. If you change to psicopg2 you need to convert 
> the field manually as you did and then use psicopg2 consistently.
>

-- 
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: DAL pg8000 adapter and JSON type

2017-07-06 Thread lyn2py
In addition, I have installed and using psycopg2 driver.

I still run into the error:

(column "json_string__tmp" is of type 
json but expression is of type text
LINE 1: UPDATE "data_table" SET "json_string__tmp"="json_string"...
   ^
HINT:  You will need to rewrite or cast the expression.
)


And this is the traceback (psycopg2):
Traceback (most recent call last):
  File "/Users/web2py/gluon/restricted.py", line 216, in restricted
exec(ccode, environment)
  File "/Users/web2py/applications/groupbuys/models/tables.py", line 85, in 

format=lambda r: '%s %s %s' % (r.condition.name, r.name, r.level)
  File "/Users/web2py/gluon/packages/dal/pydal/base.py", line 587, in 
define_table
table = self.lazy_define_table(tablename, *fields, **args)
  File "/Users/web2py/gluon/packages/dal/pydal/base.py", line 621, in 
lazy_define_table
polymodel=polymodel)
  File "/Users/web2py/gluon/packages/dal/pydal/adapters/base.py", line 778, 
in create_table
return self.migrator.create_table(*args, **kwargs)
  File "/Users/web2py/gluon/packages/dal/pydal/migrator.py", line 297, in 
create_table
fake_migrate=fake_migrate
  File "/Users/web2py/gluon/packages/dal/pydal/migrator.py", line 417, in 
migrate_table
self.adapter.execute(sub_query)
  File "/Users/web2py/gluon/packages/dal/pydal/adapters/__init__.py", line 
67, in wrap
return f(*args, **kwargs)
  File "/Users/web2py/gluon/packages/dal/pydal/adapters/base.py", line 416, 
in execute
rv = self.cursor.execute(command, *args[1:], **kwargs)
ProgrammingError: column "json_string__tmp" is of type json but expression 
is of type text
LINE 1: UPDATE "data_table" SET "json_string__tmp"="json_string"...
   ^
HINT:  You will need to rewrite or cast the expression.

I have tried to cast the expression, again, manually, in psql, but the 
column type just keeps reverting to 'text'.

Thank you.


On Thursday, July 6, 2017 at 11:53:39 AM UTC+8, lyn2py wrote:
>
> what do you mean by " manually altered the type to JSON"?  
>
>
> I meant that I logged into the Postgresql DB and ran a command to cast the 
> right type, i.e. "json", for that particular column.
>
>
> On Thursday, July 6, 2017 at 4:49:14 AM UTC+8, Massimo Di Pierro wrote:
>>
>> what do you mean by " manually altered the type to JSON"? Anyway, please 
>> use psycopg2 instead of pg8000.
>>
>> On Tuesday, 4 July 2017 04:03:00 UTC-5, lyn2py wrote:
>>>
>>> I'm using Postgresql, with the pg8000 adapter.
>>>
>>> One of the fields I have is of 'json' type
>>>
>>> Field('json_string','json'),
>>>
>>>
>>> And each time I restart the web2py server, this error will show one 
>>> time. Refreshing the page the second time makes it go away:
>>>
>>> ProgrammingError: (u'ERROR', u'ERROR', u'42804', u'column 
>>> "json_string__tmp" is of type json but expression is of type text', u'You 
>>> will need to rewrite or cast the expression.', u'48', u'parse_target.c', 
>>> u'540', u'transformAssignedExpr', u'', u'')
>>>
>>>
>>> I checked the db itself and the schema says:
>>> Column = json_string
>>> Type = text
>>>
>>> So I did a search and manually altered the type to JSON. After restart, 
>>> no errors! It was good.
>>> BUT... subsequent restarting of the server brought back the error. So I 
>>> checked the db again and the Type is changed back to 'text' again
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>

-- 
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: DAL pg8000 adapter and JSON type

2017-07-05 Thread lyn2py

>
> what do you mean by " manually altered the type to JSON"?  


I meant that I logged into the Postgresql DB and ran a command to cast the 
right type, i.e. "json", for that particular column.


On Thursday, July 6, 2017 at 4:49:14 AM UTC+8, Massimo Di Pierro wrote:
>
> what do you mean by " manually altered the type to JSON"? Anyway, please 
> use psycopg2 instead of pg8000.
>
> On Tuesday, 4 July 2017 04:03:00 UTC-5, lyn2py wrote:
>>
>> I'm using Postgresql, with the pg8000 adapter.
>>
>> One of the fields I have is of 'json' type
>>
>> Field('json_string','json'),
>>
>>
>> And each time I restart the web2py server, this error will show one time. 
>> Refreshing the page the second time makes it go away:
>>
>> ProgrammingError: (u'ERROR', u'ERROR', u'42804', u'column "json_string__tmp" 
>> is of type json but expression is of type text', u'You will need to rewrite 
>> or cast the expression.', u'48', u'parse_target.c', u'540', 
>> u'transformAssignedExpr', u'', u'')
>>
>>
>> I checked the db itself and the schema says:
>> Column = json_string
>> Type = text
>>
>> So I did a search and manually altered the type to JSON. After restart, 
>> no errors! It was good.
>> BUT... subsequent restarting of the server brought back the error. So I 
>> checked the db again and the Type is changed back to 'text' again
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>

-- 
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] DAL pg8000 adapter and JSON type

2017-07-04 Thread lyn2py
I'm using Postgresql, with the pg8000 adapter.

One of the fields I have is of 'json' type

Field('json_string','json'),


And each time I restart the web2py server, this error will show one time. 
Refreshing the page the second time makes it go away:

ProgrammingError: (u'ERROR', u'ERROR', u'42804', u'column "json_string__tmp" is 
of type json but expression is of type text', u'You will need to rewrite or 
cast the expression.', u'48', u'parse_target.c', u'540', 
u'transformAssignedExpr', u'', u'')


I checked the db itself and the schema says:
Column = json_string
Type = text

So I did a search and manually altered the type to JSON. After restart, no 
errors! It was good.
BUT... subsequent restarting of the server brought back the error. So I 
checked the db again and the Type is changed back to 'text' again










-- 
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] DAL sqlite vs postgresql: Row Orders are different?

2017-06-30 Thread lyn2py
I ran my app on *sqlite* and things are working well, so I ported it over 
to *postgresql*... however I noticed one glaring difference in the results 
retrieved immediately...

On sqlite, no matter how many times I edit an entry, for example, an entry 
with id==1, it will always be the first row on the list of rows retrieved 
from the DB.

On postgresql, after editing an entry, for example the same entry with 
id==1, that row is no longer on the first row, but instead it falls to the 
last row retrieved. This is ok if the behavior is consistent with other 
rows, but I cannot seem to replicate it... different rows just gives 
different results.

After looking around for answers, I found that this is a characteristic of 
postgresql:
https://dba.stackexchange.com/questions/48989/postgresql-indeterminate-ordering-of-results

Hence:
I would like to add a default to all my db().select()'s *orderby* to order 
by *table.id*. I am wondering what is the correct code for it so that I 
don't have to go back to edit every single db().select() that I have.

Or do you know of another solution for this?

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.


[web2py] Re: I to access the admin from Mozilla on Ubuntu ?

2017-05-23 Thread lyn2py
Is this an web2py an instance on a production server or virtualenv or local 
desktop?


On Tuesday, May 23, 2017 at 8:30:08 PM UTC+8, robin deatherage wrote:
>
> Ive tried many times and have reset everything and also deleted all 
> browser history. Here is the Ticket error it sends--
> Internal errorTicket issued: 
> admin/127.0.0.1.2017-05-22.12-36-19.2dbabf02-f0f8-4cef-9c53-9287f3212a47 
> 
>

-- 
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] Representation (DAL)

2017-05-21 Thread lyn2py
I have 2 tables:

db.define_table('TABLE_1',
Field('name','string'),
format='%(name)s'
)

db.define_table('TABLE_2',
Field('tab_id','reference TABLE_1'),
Field('name','string'),
format='%(tab_id)s %(name)s'
)

Let's say TABLE_1 has an entry like:
id = 1,
name = 'Fred',

=> represented as 'Fred'

And TABLE_2 has an entry like:
id = 1,
tab_id = 1,
name = 'Cousin'

=> represented as '1 Cousin'

I would like to have *TABLE_2*'s format/representation to be '*Fred Cousin*' 
instead of '*1 Cousin*' - may I know if this is possible, and how I can 
achieve this?

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.


[web2py] Re: Diplay a list in a view like an array [URGENT]

2017-05-19 Thread lyn2py
Result looks fine, actually. Are there empty elements in the list, or are 
you calling any empty img in those elements, or are there any accidental 
elements before "IMC"

On Friday, May 19, 2017 at 3:48:30 PM UTC+8, sunda...@gmail.com wrote:
>
>
> 
>
>
> 
>
>

-- 
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: Diplay a list in a view like an array [URGENT]

2017-05-19 Thread lyn2py
This looks to be a CSS issue.

Can you share your code? In your view

On Friday, May 19, 2017 at 2:57:14 PM UTC+8, sunda...@gmail.com wrote:
>
> Hello everyone,
>
>
> So i started web2py it have been 1 month but i have still have some 
> questions. What is sad is that with normal html and css it could be easier 
> for me, but my workplace want me to use web2py.
>
> The question is that in my view i receive a list. Each element of the list 
> got an image. and what i want is to display this list(image) like an array. 
> i want the display to be elegant. like
>
> If this is the page i want this kind of display : 
>
>
> Image1   Image2 Image3
> Image4   Image5 Image6
>
>
> etc
>
> Actually i am using this,  _class':'col-sm-4 ... it works but have bugs 
> like the diplay is like ( there is some hole inside the array, and i don't 
> know why) 
>
>
> Image1   Image2 Image3
>
>   Image4
> Image5   Image6
>
> Plz Helpp me its so urgent  
>
>

-- 
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: How do I troubleshoot this? (DAL)

2017-05-18 Thread lyn2py
Finally resolved the import. I added a line to 

File "../web2py/gluon/packages/dal/pydal/objects.py"

csv.field_size_limit(500 * 1024 * 1024)

and it worked!

Hope that helped someone. 


On Friday, May 19, 2017 at 9:52:35 AM UTC+8, lyn2py wrote:
>
> My code for exporting/importing is extracted from the book, it is simply:
>
> def export_db():
> db.export_to_csv_file(open('db_dump.csv', 'wb'))
> return 
>
> def import_db():
> db.import_from_csv_file(open('db_dump.csv', 'rb'))
> return 
>
> I just run the function and out comes the db_dump.csv
> I did not make any changes to that file. I imported back, but ran into the 
> error:
>
> File "../web2py/gluon/packages/dal/pydal/objects.py", line 947, in 
> import_from_csv_file
> for lineno, line in enumerate(reader):
> Error: field larger than field limit (131072)
>
>
> I don't know if it's the double quotes doubling up, or if some of my 
> "text" type data is too large. I don't understand the error. I need to keep 
> the data, so I dare not play around with it. I thought that it would be a 
> solution that can maintain the integrity of the data.
>
> Please help. 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.


[web2py] Re: How do I troubleshoot this? (DAL)

2017-05-18 Thread lyn2py
My code for exporting/importing is extracted from the book, it is simply:

def export_db():
db.export_to_csv_file(open('db_dump.csv', 'wb'))
return 

def import_db():
db.import_from_csv_file(open('db_dump.csv', 'rb'))
return 

I just run the function and out comes the db_dump.csv
I did not make any changes to that file. I imported back, but ran into the 
error:

File "/Users/charlyn/web2py/source/gluon/packages/dal/pydal/objects.py", line 
947, in import_from_csv_file
for lineno, line in enumerate(reader):
Error: field larger than field limit (131072)


I don't know if it's the double quotes doubling up, or if some of my "text" 
type data is too large. I don't understand the error. I need to keep the 
data, so I dare not play around with it. I thought that it would be a 
solution that can maintain the integrity of the data.

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


[web2py] Re: How do I troubleshoot this? (DAL)

2017-05-18 Thread lyn2py
If it helps, I tried to open the CSV file in a 3rd party reader and it 
comes up an error.

I tried to look at in using a text editor, and I suspect in might be 
because I have "text" type fields that hold data containing double quotes. 
For example, something that looks like this in the DB:
The correct way to do this is  or 

Appears in the CSV file as:
The correct way to do this is  or 

The double quotes seem to double up by themselves - not sure if this is the 
expected or correct behavior...

I also have rather huge chunks of data in those text fields (it varies), 
again not sure if this info helps.

If there is any clue on how to resolve this, kindly assist!

Thank you




On Thursday, May 18, 2017 at 7:46:58 PM UTC+8, lyn2py wrote:
>
> I did as Anthony and Pierre suggested, first export to CSV, then remove 
> all files from database/ folder, load web2py one time to create the right 
> table names etc, then import data... but I ran into an error:
>
> File "../web2py/gluon/packages/dal/pydal/objects.py", line 947, in 
> import_from_csv_file
> for lineno, line in enumerate(reader):
> Error: field larger than field limit (131072)
>
>
> Basically, I am stuck...
>
>
> On Wednesday, May 17, 2017 at 1:44:08 AM UTC+8, Anthony wrote:
>>
>> SQLite only supports changing table names and adding columns. You might 
>> consider exporting the tables to CSV, drop the tables and have web2py 
>> re-create them, and then import the CSV data (back up the database file 
>> before doing any of this).
>>
>> Anthony
>>
>> On Tuesday, May 16, 2017 at 12:48:18 PM UTC-4, lyn2py wrote:
>>>
>>> I think I found it with Anthony's lead.
>>>
>>> I opened the sqlite db with a 3rd party browser, and looked for it.
>>>
>>> I found on many of the tables: 
>>>
>>> "site_id" INTEGER REFERENCES "abcde_sites" ("id") ON DELETE CASCADE
>>>
>>> abcde_sites is my old table name.
>>> how do I change it to the new tablename with web2py?
>>> I ask this because there may be other table names that I would like to 
>>> change, due to the code evolving
>>>
>>> Thank you!
>>>
>>>
>>>
>>>
>>>
>>> On Tuesday, May 16, 2017 at 9:06:22 PM UTC+8, Anthony wrote:
>>>>
>>>> On Monday, May 15, 2017 at 10:09:18 PM UTC-4, lyn2py wrote:
>>>>>
>>>>> I had a setup that was working. But it's broken after I changed the 
>>>>> name of a table. This was what I did:
>>>>>
>>>>>
>>>>>1. Shut down web2py
>>>>>2. Edit the model - table name + all references to the table name
>>>>>3. Edit the sqlite - table name
>>>>>
>>>>> You would also need to change all the foreign key constraints in other 
>>>> tables that reference the table.
>>>>
>>>> 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: Define table but not add it to the database

2017-05-18 Thread lyn2py
Thanks Sundar, but attaching DBs don't allow me to reference the "attached" 
tables right?

On Thursday, May 18, 2017 at 5:27:03 PM UTC+8, Sundar wrote:
>
> See https://www.sqlite.org/lang_attach.html solves your problem.
>
> Cheers.
> ===
>
> On Tuesday, May 16, 2017 at 5:46:25 PM UTC+5:30, lyn2py wrote:
>>
>> Is there is a way to define a table without adding it to the sqlite 
>> database? I wish to define a table and have data in that table, but not add 
>> it to the sqlite db.
>>
>> The reason is because I have a table with a fixed set of data, that I use 
>> across different apps.
>>
>> 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.


[web2py] Re: How do I troubleshoot this? (DAL)

2017-05-18 Thread lyn2py
I did as Anthony and Pierre suggested, first export to CSV, then remove all 
files from database/ folder, load web2py one time to create the right table 
names etc, then import data... but I ran into an error:

File "../web2py/gluon/packages/dal/pydal/objects.py", line 947, in 
import_from_csv_file
for lineno, line in enumerate(reader):
Error: field larger than field limit (131072)


Basically, I am stuck...


On Wednesday, May 17, 2017 at 1:44:08 AM UTC+8, Anthony wrote:
>
> SQLite only supports changing table names and adding columns. You might 
> consider exporting the tables to CSV, drop the tables and have web2py 
> re-create them, and then import the CSV data (back up the database file 
> before doing any of this).
>
> Anthony
>
> On Tuesday, May 16, 2017 at 12:48:18 PM UTC-4, lyn2py wrote:
>>
>> I think I found it with Anthony's lead.
>>
>> I opened the sqlite db with a 3rd party browser, and looked for it.
>>
>> I found on many of the tables: 
>>
>> "site_id" INTEGER REFERENCES "abcde_sites" ("id") ON DELETE CASCADE
>>
>> abcde_sites is my old table name.
>> how do I change it to the new tablename with web2py?
>> I ask this because there may be other table names that I would like to 
>> change, due to the code evolving
>>
>> Thank you!
>>
>>
>>
>>
>>
>> On Tuesday, May 16, 2017 at 9:06:22 PM UTC+8, Anthony wrote:
>>>
>>> On Monday, May 15, 2017 at 10:09:18 PM UTC-4, lyn2py wrote:
>>>>
>>>> I had a setup that was working. But it's broken after I changed the 
>>>> name of a table. This was what I did:
>>>>
>>>>
>>>>1. Shut down web2py
>>>>2. Edit the model - table name + all references to the table name
>>>>3. Edit the sqlite - table name
>>>>
>>>> You would also need to change all the foreign key constraints in other 
>>> tables that reference the table.
>>>
>>> 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: Define table but not add it to the database

2017-05-17 Thread lyn2py
Please bear with me while I explain my use case:

I have a list of "standard" websites, like all the major search engines. 
Traditionally, I can make do with a python list, like so:

list_of_sites =['google.com','yahoo.com',...]


However, the code base has evolved and it's much better to have other data 
too, like:

one_site = dict(
url='google.com',
name='Google',
short='G',
..and many more..
)

I have that for each site. As you can see, having a table will serve this 
data much better.

My problem is when I need to use this same list of sites, but for different 
apps (as defined by web2py, i.e. having a new folder within the application 
folder)
I will need to add these sites each time and when I make an edit, I have to 
edit the same table but over many apps.

And in each app, there are other tables that reference data from this 
table, like so:

Field('site_id', 'reference abcde_sites')


I thought, if there is a way to hardcode this table into a file, somewhat, 
so that I just need to duplicate the file, or even, just reference or load 
the same file, and web2py will include it as a web2py's "define.table".

As the last resort I may use a "list of dicts", but I do not know how to 
keep the current references to this particular table.

In summary, I am using sqlite db. There is a table that I don't wish to 
store in the sqlite db, but yet have that particular table data be served / 
accessed like a normal table (as if from the db). Is that possible, and how 
can I achieve this?

Why did I ask this question? Because I vaguely recall some very old 
examples of web2py where items are inserted to a "virtual" table, that only 
exists in that controller (it wasn't defined in the model). So only when 
you call that controller, that particular table will be "loaded", and with 
that particular set of data. If another controller tried to access that 
table, that data had vanished.

Thank you.



On Wednesday, May 17, 2017 at 6:48:16 AM UTC+8, Anthony wrote:
>
> On Tuesday, May 16, 2017 at 12:34:01 PM UTC-4, lyn2py wrote:
>>
>> Thanks Anthony, I'm sorry my question was ambiguous.
>>
>> I meant to define a table and to add data to a table that doesn't exist 
>> in the sqlite table, but yet web2py can get the data (I can "hardcode" the 
>> data into the controller or model). How do I achieve that? Or rather can I?
>>
>
> Sorry, still not clear what you are really trying to do. Maybe show the 
> code you would like to write and what you want to happen once the code 
> executes. It's still not clear whether this table exists in the SQLite 
> database, some other database, or nowhere at all (and if the latter, then 
> where the data goes).
>
> 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: How do I troubleshoot this? (DAL)

2017-05-16 Thread lyn2py
I think I found it with Anthony's lead.

I opened the sqlite db with a 3rd party browser, and looked for it.

I found on many of the tables: 

"site_id" INTEGER REFERENCES "abcde_sites" ("id") ON DELETE CASCADE

abcde_sites is my old table name.
how do I change it to the new tablename with web2py?
I ask this because there may be other table names that I would like to 
change, due to the code evolving

Thank you!





On Tuesday, May 16, 2017 at 9:06:22 PM UTC+8, Anthony wrote:
>
> On Monday, May 15, 2017 at 10:09:18 PM UTC-4, lyn2py wrote:
>>
>> I had a setup that was working. But it's broken after I changed the name 
>> of a table. This was what I did:
>>
>>
>>1. Shut down web2py
>>2. Edit the model - table name + all references to the table name
>>3. Edit the sqlite - table name
>>
>> You would also need to change all the foreign key constraints in other 
> tables that reference the table.
>
> 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: Define table but not add it to the database

2017-05-16 Thread lyn2py
Thanks Anthony, I'm sorry my question was ambiguous.

I meant to define a table and to add data to a table that doesn't exist in 
the sqlite table, but yet web2py can get the data (I can "hardcode" the 
data into the controller or model). How do I achieve that? Or rather can I?

Thank you again!


On Tuesday, May 16, 2017 at 9:09:44 PM UTC+8, Anthony wrote:
>
> On Tuesday, May 16, 2017 at 8:16:25 AM UTC-4, lyn2py wrote:
>>
>> Is there is a way to define a table without adding it to the sqlite 
>> database? I wish to define a table and have data in that table, but not add 
>> it to the sqlite db.
>>
>
> You can do db.define_table(..., migrate=False). This assumes the table 
> already exists in the database referenced by db.
>
> 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] Define table but not add it to the database

2017-05-16 Thread lyn2py
Is there is a way to define a table without adding it to the sqlite 
database? I wish to define a table and have data in that table, but not add 
it to the sqlite db.

The reason is because I have a table with a fixed set of data, that I use 
across different apps.

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.


[web2py] Re: How do I troubleshoot this? (DAL)

2017-05-16 Thread lyn2py
I have data in that table that I want to keep. How do I accomplish this? 
I'm sorry if this seems an easy question, but I am not familiar with 
importing and exporting data such that the integrity of the data is 
preserved.

Thank you.

On Tuesday, May 16, 2017 at 5:01:15 PM UTC+8, Pierre wrote:
>
> drop the table in question and save your db.py file again. It should 
>> recreate the table with a new name
>>
>
>
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#drop
>  
>

-- 
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] How do I troubleshoot this? (DAL)

2017-05-15 Thread lyn2py
I had a setup that was working. But it's broken after I changed the name of 
a table. This was what I did:


   1. Shut down web2py
   2. Edit the model - table name + all references to the table name
   3. Edit the sqlite - table name
   4. Set fake_migrate_all=True
   5. Start the server
   6. Load a page
   7. Take away fake_migrate_all=True
   

Pages load fine without errors, until I needed to write to the db. This is 
the traceback:


Traceback (most recent call last):
  File ".../web2py/gluon/restricted.py", line 216, in restricted
exec(ccode, environment)
  File ".../web2py/applications/myapp/controllers/mycontroller.py:index", 
line 136, in 
  File ".../web2py/gluon/globals.py", line 405, in 
self._caller = lambda f: f()
  File ".../web2py/applications/myapp/controllers/mycontroller.py:index", 
line 15, in index
  File ".../web2py/applications/myapp/modules/mymodule.py", line 87, in 
write_to_db
res = t.update_or_insert(q, **ins)
  File ".../web2py/gluon/packages/dal/pydal/objects.py", line 804, in 
update_or_insert
newid = self.insert(**values)
  File ".../web2py/gluon/packages/dal/pydal/objects.py", line 741, in insert
ret = self._db._adapter.insert(self, self._listify(fields))
  File ".../web2py/gluon/packages/dal/pydal/adapters/base.py", line 492, in 
insert
raise e
OperationalError: no such table: main.abcde_sites

Some notes...

   - "abcde_sites" is the old table name
   - I have no idea why "main." will appear in front of it.
   - I don't have any code that says "abcde_sites" in my controllers, 
   modules or models. They have been updated to the new table name, 
   "collective_sites"
   - I created a new app, copied all the code I have in controllers, 
   models, modules and it works (pages load fine, can write to db)
   - I tried deleting all the .table files + sql.log, do a 
   fake_migrate_all=True, and it still doesn't work (when the code that writes 
   stuff to sqlite db is evoked)
   - I tried the deleting of .table files + sql.log with restarting the 
   server, and it still doesn't work 

Please advise!

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.


[web2py] Re: Using Stripe's Checkout w/ web2py

2017-03-21 Thread lyn2py
You might need to be more detailed describing your issue. 

On Wednesday, March 22, 2017 at 11:19:21 AM UTC+8, Scott Hunter wrote:
>
> Has anyone been able to use Stripe's Checkout with web2py?  If so, how did 
> you do it?  I'm having trouble getting the token it generates back.
>
> - Scott
>

-- 
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 admin > database datetime field error

2017-03-18 Thread lyn2py
I'm at testing stage, so sqlite, with plans to move over to postgresql, 
which I discovered to handle such nonexistent dates similarly.

Yes I can do a select on fields that do not have dates.


On Friday, March 17, 2017 at 8:15:10 AM UTC+8, Dave S wrote:
>
>
>
> On Thursday, March 16, 2017 at 3:59:47 PM UTC-7, lyn2py wrote:
>>
>>
>> I've loaded a bunch of data into the DB, and some of the tables and rows 
>> has the datetime field "-00-00"
>>
>> That caused web2py admin > this app's database to raise an error because 
>> of the datetime field:
>> "year is out of range"
>>
>>
>
> Which database are you using?
>  
>
>> (1) I tried to use filter_out on the field but it is not working. What 
>> can I do for this error?
>>
>> def filter_out_datetime(table, fields):
>> def check_datetime(self, dt):
>> if dt=='-00-00 00:00:00':
>> return ''
>> else:
>> return dt
>> for field in fields:
>> db[table][field].filter_out = lambda val, cdt=check_datetime: cdt(val)
>>
>> (2) Is there a way to retrieve all fields of "datetime" type in web2py? I 
>> have a number of such fields across the many tables. And may be adding 
>> more...
>>
>> (3) How do I use SQLCustomType for this use case?
>>
>>
>> Thank you!
>>
>
> Can you do a select where you request only the fields that are *not* 
> supposed to have dates (a name field, for instance)?
>
> /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] Web2py admin > database datetime field error

2017-03-16 Thread lyn2py

I've loaded a bunch of data into the DB, and some of the tables and rows 
has the datetime field "-00-00"

That caused web2py admin > this app's database to raise an error because of 
the datetime field:
"year is out of range"

(1) I tried to use filter_out on the field but it is not working. What can 
I do for this error?

def filter_out_datetime(table, fields):
def check_datetime(self, dt):
if dt=='-00-00 00:00:00':
return ''
else:
return dt
for field in fields:
db[table][field].filter_out = lambda val, cdt=check_datetime: cdt(val)

(2) Is there a way to retrieve all fields of "datetime" type in web2py? I 
have a number of such fields across the many tables. And may be adding 
more...

(3) How do I use SQLCustomType for this use case?


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.


[web2py] Any way to log automatically?

2017-03-03 Thread lyn2py
I've written an app that is quite involved, and it has gotten very slow as 
I add code to it. I would like to see what goes on behind the scenes (like 
what function was invoked, what variables were passed to the function, and 
if possible, the time it takes to run), so that I don't have the code doing 
unnecessary stuff.

Is there a way to do that with web2py without having to go into each 
function / Class method to include a logging device?

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.


[web2py] Things to do to secure server running purely web2py?

2017-02-16 Thread lyn2py
I am planning to go with DigitalOcean or Linode or Aliyun.

What do you do or steps do you take to secure your server?

Thank you, I am a noob at 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.


[web2py] Re: DAL _before_update callback

2017-01-12 Thread lyn2py
Well... after taking time out to write the entire story... my mistake.

In define_tables > Field, I assigned it (a long time ago) as "string" 
instead of "integer". So the comparison was switched around, because it was 
comparing a single digit, e.g. 5, to a double digit number, like 15. It's 
all fixed per the web2py book when I enforced "int()". Gr. 

On Thursday, January 12, 2017 at 11:35:12 PM UTC+8, lyn2py wrote:
>
> Hi guys, I just wanted to confirm this.
>
> The web2py book (link = 
> http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#callbacks-on-record-insert-delete-and-update)
>  
> says:
> "The return values of these callback should be None or False. If any of 
> the _before_* callback returns a True value it will abort the actual 
> insert/update/delete operation."
>
> But my experience differs, I am comparing the value in db ("query set") 
> and the value I am about to insert ("fields"). 
> CRITERION: If the "query set" is a smaller value, abort the update 
> operation.
> So, per the instruction in the web2py book, I made it like so:
> db.table._before_update.append(lambda s,f: qs(number)<f['number'])
>
> which means the "query set" is smaller than the "fields", then, it's TRUE, 
> so, abort update. 
>
> But it didn't work until I switched the operator sign to make the 
> statement FALSE, like so:
> db.table._before_update.append(lambda s,f: qs(number)>f['number'])
>
> which means the "query set" is NOT smaller than the "fields". It would 
> abort update. 
>
> Am I confused about something or does the web2py book need an edit/update?
>
> Thank you 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.


[web2py] DAL _before_update callback

2017-01-12 Thread lyn2py
Hi guys, I just wanted to confirm this.

The web2py book (link = 
http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#callbacks-on-record-insert-delete-and-update)
 
says:
"The return values of these callback should be None or False. If any of the 
_before_* callback returns a True value it will abort the actual 
insert/update/delete operation."

But my experience differs, I am comparing the value in db ("query set") and 
the value I am about to insert ("fields"). 
CRITERION: If the "query set" is a smaller value, abort the update 
operation.
So, per the instruction in the web2py book, I made it like so:
db.table._before_update.append(lambda s,f: qs(number)f['number'])

which means the "query set" is NOT smaller than the "fields". It would 
abort update. 

Am I confused about something or does the web2py book need an edit/update?

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


Re: [web2py] Re: homebrew python not working with web2py

2017-01-03 Thread lyn2py
It is working now. O.O Sorry for the noise and thank you for your time Mark.

I blew a fuse in the house and then it worked. Prior to that I restarted 
the computer and it still didn't work. This is crazy and not 
reproducible... YMMV...



On Tuesday, January 3, 2017 at 10:54:35 PM UTC+8, lyn2py wrote:
>
> No, did not try the zip. It doesn't have to do with the release, rather it 
> is the version of python that was installed by homebrew. I read somewhere 
> that it is unstable, I don't know why that would be the case. While we are 
> on the topic, did you try the python installation by homebrew? Is web2py 
> running with the python 2 installed by homebrew for you?
>
> which python was included in my first post, here it is again:
>
> $ which python
>
> /usr/local/bin/python
>
>
>
>
> HOMEBREW
>
> $ python
>
> Python 2.7.13 (default, Dec 17 2016, 23:03:43) 
>
> [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
>
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> import os
>
> >>> print os.environ['PYTHONPATH']
>
> Traceback (most recent call last):
>
>   File "", line 1, in 
>
>   File 
> "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py"
> , line 40, in __getitem__
>
> raise KeyError(key)
>
> KeyError: 'PYTHONPATH'
>
> >>> import sys
>
> >>> print sys.path
>
> ['', 
> '/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python27.zip'
> , 
> '/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7'
> , 
> '/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin'
> , 
> '/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac'
> , 
> '/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages'
> , 
> '/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk'
> , 
> '/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old'
> , 
> '/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload'
> , '/usr/local/lib/python2.7/site-packages']
>
>
> SYSTEM
>
> $ /usr/bin/python
>
> Python 2.7.10 (default, Oct 23 2015, 19:19:21) 
>
> [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
>
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> import os
>
> >>> print os.environ['PYTHONPATH']
>
> Traceback (most recent call last):
>
>   File "", line 1, in 
>
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py"
> , line 23, in __getitem__
>
> raise KeyError(key)
>
> KeyError: 'PYTHONPATH'
>
> >>> import sys
>
> >>> print sys.path
>
> ['', 
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip'
> , '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7'
> , 
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin'
> , 
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac'
> , 
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages'
> , 
> '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python'
> , 
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk'
> , 
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old'
> , 
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload'
> , 
> '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC'
> , '/Library/Python/2.7/site-packages']
>
>
>
>
>
> On Tuesday, January 3, 2017 at 6:00:53 PM UTC+8, Mark Graves wrote:
>>
>> Also, under each please list the output of:
>>
>> import os
>> print os.environ['PYTHONPATH']
>>
>> import sys
>> print sys.path
>>
>> On Tue, Jan 3, 2017 at 3:58 AM, Mark Graves <mgra...@gmail.com> wrote:
>>
>>> Wait wait, whats the output of 
>>>
>>> which python
>>>
>>> On Tue, Jan 3, 2017 at 3:43 AM, Mark Graves <mgra...@gmail.com> wrote:
>>>
>>>> did you try the downloaded via zip version?
>>>&g

Re: [web2py] Re: homebrew python not working with web2py

2017-01-03 Thread lyn2py
No, did not try the zip. It doesn't have to do with the release, rather it 
is the version of python that was installed by homebrew. I read somewhere 
that it is unstable, I don't know why that would be the case. While we are 
on the topic, did you try the python installation by homebrew? Is web2py 
running with the python 2 installed by homebrew for you?

which python was included in my first post, here it is again:

$ which python

/usr/local/bin/python




HOMEBREW

$ python

Python 2.7.13 (default, Dec 17 2016, 23:03:43) 

[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

>>> import os

>>> print os.environ['PYTHONPATH']

Traceback (most recent call last):

  File "", line 1, in 

  File 
"/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py"
, line 40, in __getitem__

raise KeyError(key)

KeyError: 'PYTHONPATH'

>>> import sys

>>> print sys.path

['', 
'/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python27.zip'
, 
'/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7'
, 
'/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin'
, 
'/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac'
, 
'/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages'
, 
'/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk'
, 
'/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old'
, 
'/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload'
, '/usr/local/lib/python2.7/site-packages']


SYSTEM

$ /usr/bin/python

Python 2.7.10 (default, Oct 23 2015, 19:19:21) 

[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

>>> import os

>>> print os.environ['PYTHONPATH']

Traceback (most recent call last):

  File "", line 1, in 

  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py"
, line 23, in __getitem__

raise KeyError(key)

KeyError: 'PYTHONPATH'

>>> import sys

>>> print sys.path

['', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin'
, 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac'
, 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages'
, 
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python'
, 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk'
, 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old'
, 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload'
, 
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC'
, '/Library/Python/2.7/site-packages']





On Tuesday, January 3, 2017 at 6:00:53 PM UTC+8, Mark Graves wrote:
>
> Also, under each please list the output of:
>
> import os
> print os.environ['PYTHONPATH']
>
> import sys
> print sys.path
>
> On Tue, Jan 3, 2017 at 3:58 AM, Mark Graves <mgra...@gmail.com 
> > wrote:
>
>> Wait wait, whats the output of 
>>
>> which python
>>
>> On Tue, Jan 3, 2017 at 3:43 AM, Mark Graves <mgra...@gmail.com 
>> > wrote:
>>
>>> did you try the downloaded via zip version?
>>>
>>> On Mon, Jan 2, 2017 at 9:01 AM, lyn2py <lyn...@gmail.com > 
>>> wrote:
>>>
>>>> Nope :)
>>>>
>>>> On Monday, January 2, 2017 at 10:55:59 AM UTC+8, Mark Graves wrote:
>>>>>
>>>>> Is it in a virtual environment?
>>>>>
>>>>> -Mark
>>>>>
>>>>> On Sun, Jan 1, 2017 at 8:37 PM, lyn2py <lyn...@gmail.com> wrote:
>>>>>
>>>>>> First, it is a working folder that I've been using. It breaks the 
>>>>>> moment when I use homebrew's version of python to start web2py. It works 
>>>>>> when I use the system's python. Both commands are on the same directory.
>>>>>> Secondly, I have tried git clone recursive in a brand new folder, but 
>>>>>> it's still the same re

Re: [web2py] Re: homebrew python not working with web2py

2017-01-02 Thread lyn2py
Nope :)

On Monday, January 2, 2017 at 10:55:59 AM UTC+8, Mark Graves wrote:
>
> Is it in a virtual environment?
>
> -Mark
>
> On Sun, Jan 1, 2017 at 8:37 PM, lyn2py <lyn...@gmail.com > 
> wrote:
>
>> First, it is a working folder that I've been using. It breaks the moment 
>> when I use homebrew's version of python to start web2py. It works when I 
>> use the system's python. Both commands are on the same directory.
>> Secondly, I have tried git clone recursive in a brand new folder, but 
>> it's still the same result.
>>
>> On Monday, January 2, 2017 at 9:51:55 AM UTC+8, Mark Graves wrote:
>>>
>>> potential quick fix before giving it thought:
>>>
>>> did you:
>>>
>>>  git submodule update --init --recursive
>>> You can easily try this by creating a new web2py installation in a 
>>> different folder so you don't mess up exising apps.
>>>
>>> Also, is it broken with the downloaded version via zip?
>>>
>>> On Sun, Jan 1, 2017 at 9:02 AM, lyn2py <lyn...@gmail.com> wrote:
>>>
>>>>
>>>>
>>>> On Saturday, December 31, 2016 at 5:06:07 AM UTC+8, Mark Graves wrote:
>>>>>
>>>>> How did you install web2py?  as a zip? via git? 
>>>>>
>>>>
>>>> *git clone*
>>>>
>>>>
>>>>> Did you ever pip install gluon? 
>>>>>
>>>>
>>>> *nope* 
>>>>
>>>>
>>>>> Did you install web2py / python at different times?
>>>>>
>>>>
>>>> *I've been using web2py for years using the system python, and I only 
>>>> installed python via homebrew recently for other purposes, and homebrew 
>>>> automatically replaced the system python as the default one to use (no 
>>>> complaints, since it's a higher version), which was why I discovered that 
>>>> it won't work with web2py. The only thing, I presume, is different, is the 
>>>> version of python. If you see the code in my first post, the respective 
>>>> versions for SYSTEM vs HOMEBREW are 2.7.10 and 2.7.13.*
>>>>  
>>>>
>>>>>
>>>>> Can you try under each python version to do:
>>>>>
>>>>> import gluon.widget
>>>>>
>>>>
>>>> *Oh good suggestion. I tried with both, and they both imported it fine. 
>>>> So it works in command-line python, but not with web2py (I dunno the right 
>>>> word for this... app / desktop app / guy)? I'll be happy to run any tests 
>>>> to figure out why... but do you think there might be something wrong with 
>>>> the version installed by homebrew??*
>>>>
>>>>  
>>>>
>>>>>
>>>>> On Thursday, December 29, 2016 at 11:29:08 PM UTC-6, lyn2py wrote:
>>>>>>
>>>>>> I am not sure if this is the right place to ask this, but it only 
>>>>>> happens with web2py (for now).
>>>>>>
>>>>>> Due to a need to use pip, I used homebrew to install python. 
>>>>>> Sidenote: Homebrew used to require additional configuration to work 
>>>>>> as "the python" on the system, but now it does everything automatically. 
>>>>>> So 
>>>>>> when I type
>>>>>>
>>>>>> $ which python
>>>>>>
>>>>>> ...I get the one that homebrew installed.
>>>>>>
>>>>>> Onward...
>>>>>> I tried 
>>>>>>
>>>>>> $ python web2py.py
>>>>>>
>>>>>> ...which is the homebrew installed one, and ran into this error:
>>>>>>
>>>>>> Traceback (most recent call last):
>>>>>>
>>>>>>   File "/Users/web2py/web2py.py", line 21, in 
>>>>>>
>>>>>> import gluon.widget
>>>>>>
>>>>>>   File "/Users/web2py/gluon/__init__.py", line 31, in 
>>>>>>
>>>>>> "You can also download a complete copy from http://www.web2py.com
>>>>>> ."
>>>>>>
>>>>>> RuntimeError: web2py depends on pydal, which apparently you have not 
>>>>>> installed.
>>>>>>
>>>>>> Probably you cloned the repository using git without '--recursive'
>>&

Re: [web2py] Re: homebrew python not working with web2py

2017-01-01 Thread lyn2py
First, it is a working folder that I've been using. It breaks the moment 
when I use homebrew's version of python to start web2py. It works when I 
use the system's python. Both commands are on the same directory.
Secondly, I have tried git clone recursive in a brand new folder, but it's 
still the same result.

On Monday, January 2, 2017 at 9:51:55 AM UTC+8, Mark Graves wrote:
>
> potential quick fix before giving it thought:
>
> did you:
>
>  git submodule update --init --recursive
> You can easily try this by creating a new web2py installation in a 
> different folder so you don't mess up exising apps.
>
> Also, is it broken with the downloaded version via zip?
>
> On Sun, Jan 1, 2017 at 9:02 AM, lyn2py <lyn...@gmail.com > 
> wrote:
>
>>
>>
>> On Saturday, December 31, 2016 at 5:06:07 AM UTC+8, Mark Graves wrote:
>>>
>>> How did you install web2py?  as a zip? via git? 
>>>
>>
>> *git clone*
>>
>>
>>> Did you ever pip install gluon? 
>>>
>>
>> *nope* 
>>
>>
>>> Did you install web2py / python at different times?
>>>
>>
>> *I've been using web2py for years using the system python, and I only 
>> installed python via homebrew recently for other purposes, and homebrew 
>> automatically replaced the system python as the default one to use (no 
>> complaints, since it's a higher version), which was why I discovered that 
>> it won't work with web2py. The only thing, I presume, is different, is the 
>> version of python. If you see the code in my first post, the respective 
>> versions for SYSTEM vs HOMEBREW are 2.7.10 and 2.7.13.*
>>  
>>
>>>
>>> Can you try under each python version to do:
>>>
>>> import gluon.widget
>>>
>>
>> *Oh good suggestion. I tried with both, and they both imported it fine. 
>> So it works in command-line python, but not with web2py (I dunno the right 
>> word for this... app / desktop app / guy)? I'll be happy to run any tests 
>> to figure out why... but do you think there might be something wrong with 
>> the version installed by homebrew??*
>>
>>  
>>
>>>
>>> On Thursday, December 29, 2016 at 11:29:08 PM UTC-6, lyn2py wrote:
>>>>
>>>> I am not sure if this is the right place to ask this, but it only 
>>>> happens with web2py (for now).
>>>>
>>>> Due to a need to use pip, I used homebrew to install python. 
>>>> Sidenote: Homebrew used to require additional configuration to work as 
>>>> "the python" on the system, but now it does everything automatically. So 
>>>> when I type
>>>>
>>>> $ which python
>>>>
>>>> ...I get the one that homebrew installed.
>>>>
>>>> Onward...
>>>> I tried 
>>>>
>>>> $ python web2py.py
>>>>
>>>> ...which is the homebrew installed one, and ran into this error:
>>>>
>>>> Traceback (most recent call last):
>>>>
>>>>   File "/Users/web2py/web2py.py", line 21, in 
>>>>
>>>> import gluon.widget
>>>>
>>>>   File "/Users/web2py/gluon/__init__.py", line 31, in 
>>>>
>>>> "You can also download a complete copy from http://www.web2py.com.;
>>>>
>>>> RuntimeError: web2py depends on pydal, which apparently you have not 
>>>> installed.
>>>>
>>>> Probably you cloned the repository using git without '--recursive'
>>>>
>>>> To fix this, please run (from inside your web2py folder):
>>>>
>>>>
>>>>
>>>>  git submodule update --init --recursive
>>>>
>>>>
>>>>
>>>> You can also download a complete copy from http://www.web2py.com.
>>>>
>>>>
>>>> But when I run this command, which uses the system's python, it works!
>>>>
>>>> $ /usr/bin/python web2py.py
>>>>
>>>> I could always add "/usr/bin/" as a habit when starting web2py, but why 
>>>> doesn't homebrew's installed python work? Are they not the same?
>>>>
>>>> When I run python in command line, HOMEBREW:
>>>>
>>>> $ python
>>>>
>>>> Python 2.7.13 (default, Dec 17 2016, 23:03:43) 
>>>>
>>>> [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
>>>>
>>>> Type "hel

[web2py] Re: homebrew python not working with web2py

2017-01-01 Thread lyn2py


On Saturday, December 31, 2016 at 5:06:07 AM UTC+8, Mark Graves wrote:
>
> How did you install web2py?  as a zip? via git? 
>

*git clone*


> Did you ever pip install gluon? 
>

*nope* 


> Did you install web2py / python at different times?
>

*I've been using web2py for years using the system python, and I only 
installed python via homebrew recently for other purposes, and homebrew 
automatically replaced the system python as the default one to use (no 
complaints, since it's a higher version), which was why I discovered that 
it won't work with web2py. The only thing, I presume, is different, is the 
version of python. If you see the code in my first post, the respective 
versions for SYSTEM vs HOMEBREW are 2.7.10 and 2.7.13.*
 

>
> Can you try under each python version to do:
>
> import gluon.widget
>

*Oh good suggestion. I tried with both, and they both imported it fine. So 
it works in command-line python, but not with web2py (I dunno the right 
word for this... app / desktop app / guy)? I'll be happy to run any tests 
to figure out why... but do you think there might be something wrong with 
the version installed by homebrew??*

 

>
> On Thursday, December 29, 2016 at 11:29:08 PM UTC-6, lyn2py wrote:
>>
>> I am not sure if this is the right place to ask this, but it only happens 
>> with web2py (for now).
>>
>> Due to a need to use pip, I used homebrew to install python. 
>> Sidenote: Homebrew used to require additional configuration to work as 
>> "the python" on the system, but now it does everything automatically. So 
>> when I type
>>
>> $ which python
>>
>> ...I get the one that homebrew installed.
>>
>> Onward...
>> I tried 
>>
>> $ python web2py.py
>>
>> ...which is the homebrew installed one, and ran into this error:
>>
>> Traceback (most recent call last):
>>
>>   File "/Users/web2py/web2py.py", line 21, in 
>>
>> import gluon.widget
>>
>>   File "/Users/web2py/gluon/__init__.py", line 31, in 
>>
>> "You can also download a complete copy from http://www.web2py.com.;
>>
>> RuntimeError: web2py depends on pydal, which apparently you have not 
>> installed.
>>
>> Probably you cloned the repository using git without '--recursive'
>>
>> To fix this, please run (from inside your web2py folder):
>>
>>
>>
>>  git submodule update --init --recursive
>>
>>
>>
>> You can also download a complete copy from http://www.web2py.com.
>>
>>
>> But when I run this command, which uses the system's python, it works!
>>
>> $ /usr/bin/python web2py.py
>>
>> I could always add "/usr/bin/" as a habit when starting web2py, but why 
>> doesn't homebrew's installed python work? Are they not the same?
>>
>> When I run python in command line, HOMEBREW:
>>
>> $ python
>>
>> Python 2.7.13 (default, Dec 17 2016, 23:03:43) 
>>
>> [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
>>
>> Type "help", "copyright", "credits" or "license" for more information.
>>
>> >>> exit()
>>
>> ...and, SYSTEM:
>>
>> $ /usr/bin/python
>>
>> Python 2.7.10 (default, Oct 23 2015, 19:19:21) 
>>
>> [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
>>
>> Type "help", "copyright", "credits" or "license" for more information.
>>
>> >>> exit()
>>
>> Thank you 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.


[web2py] homebrew python not working with web2py

2016-12-29 Thread lyn2py
I am not sure if this is the right place to ask this, but it only happens 
with web2py (for now).

Due to a need to use pip, I used homebrew to install python. 
Sidenote: Homebrew used to require additional configuration to work as "the 
python" on the system, but now it does everything automatically. So when I 
type

$ which python

...I get the one that homebrew installed.

Onward...
I tried 

$ python web2py.py

...which is the homebrew installed one, and ran into this error:

Traceback (most recent call last):

  File "/Users/web2py/web2py.py", line 21, in 

import gluon.widget

  File "/Users/web2py/gluon/__init__.py", line 31, in 

"You can also download a complete copy from http://www.web2py.com.;

RuntimeError: web2py depends on pydal, which apparently you have not 
installed.

Probably you cloned the repository using git without '--recursive'

To fix this, please run (from inside your web2py folder):



 git submodule update --init --recursive



You can also download a complete copy from http://www.web2py.com.


But when I run this command, which uses the system's python, it works!

$ /usr/bin/python web2py.py

I could always add "/usr/bin/" as a habit when starting web2py, but why 
doesn't homebrew's installed python work? Are they not the same?

When I run python in command line, HOMEBREW:

$ python

Python 2.7.13 (default, Dec 17 2016, 23:03:43) 

[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

>>> exit()

...and, SYSTEM:

$ /usr/bin/python

Python 2.7.10 (default, Oct 23 2015, 19:19:21) 

[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

>>> exit()

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


[web2py] Re: Non-Editable field in SQLFORM

2016-12-12 Thread lyn2py
It will always be allowed to take a value in insert, a value that you 
assign it to, for example, via "default", like so:
db.table.field.default = some_value

To make the field non-editable to the end user, use:
db.table.field.editable = False
...
form = SQLFORM(db.table)

for the above examples, replace *table* with *your table name* and *field* 
with *your field name*.

You can find out the details in Chapter in 06 The database abstraction layer 

 and 07 Forms and validators 



On Friday, December 9, 2016 at 11:38:55 PM UTC+8, Amit Kumar Modak wrote:
>
> Hello,
>
> How can I make a field non-editable in SQLFORM, while it should be allowed 
> to take a value in insert.
>
>
> Regards,
> Amit
>

-- 
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: db Field unique=True

2016-12-07 Thread lyn2py
Thank you Niphlod, I had to read your answer twice to fully understand what 
you meant. Now I get it. I appreciate your pointers!

Thank you Stifan for the suggestion. I am deliberately not using that 
because the result is too long, and the uid will be used on html for id and 
other future purposes.



On Wednesday, December 7, 2016 at 6:17:04 AM UTC+8, Niphlod wrote:
>
> web2py forms use postbacks (the submit is directed to the same address 
> that generated it) so the general flow is the following:
>
> - user hits the page
> - the form was not submitted nor accepted nor errored (goes to the last 
> else)
> - user fills the forms and click submit
> - form was submitted: it can be accepted or errored (goes to if 
> form.accepted or if form.errors)
>
> From the moment user submitted the form that errored to the form 
> rightfully compiled there is no shared state.
> If you really need what you're asking (I'm quite sure that your logic may 
> be pleased with e.g. generate a random uid just in the "accepted" branch) 
> you need to alter the logic: persist the need of generating a new uid 
> somewhere, i.e. the session, and then alter the default value for uid 
> accordingly.
> Or just make your own db I/O with e.g. SQLFORM.factory .
>
>

-- 
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] db Field unique=True

2016-12-06 Thread lyn2py
Hello!

I have set a field to "unique=True", it is a generated "unique id". I write 
in quotes because there are no guarantees, although there is a slim chance 
that a generated id is repeated. In the rare case that it happens, it would 
raise a form.error

My question is, how do I "regenerate" the id when the form.error arises?

I tried:
form = SQLFORM(db[tablo])
if form.process().accepted:
   response.flash = 'form accepted'
elif form.errors:
   form.vars.gen_uid = gen_uid(4) #this is the function to generate an id
   response.flash = 'form has errors'
else:
   response.flash = 'please fill out the form'
return dict(form=form)


But doing the above doesn't change the value of the field "gen_uid"

I appreciate your help! :)

-- 
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: response.menu + HTML5 attributes

2016-12-05 Thread lyn2py
That worked!!! Fantastically. I tried .replace() and many more, but it 
didn't occur to me to try it this way! My gratitude, Anthony :)

On Monday, December 5, 2016 at 11:51:48 PM UTC+8, Anthony wrote:
>
> See http://web2py.com/books/default/chapter/29/05/the-views#HTML-helpers, 
> in particular:
>
> Notice that helper attributes are passed as keyword arguments to the 
> helper. In some cases, however, attribute names include special characters 
> that are not allowed in Python identifiers (e.g., hyphens) and therefore 
> cannot be used as keyword argument names. For example:
>
>
>
> DIV('text', _data-role='collapsible')
>  
>
> will not work because "_data-role" includes a hyphen, which will produce a 
> Python syntax error.
>
> In such cases you have a couple of options. You can use the data argument 
> (this time without a leading underscore) to pass a dictionary of related 
> attributes without their leading hyphen, and the output will have the 
> desired combinations e.g.
>
>
>
> >>> print DIV('text', data={'role': 'collapsible'}) >>> data-role="collapsible">text
>  
>
> or you can instead pass the attributes as a dictionary and make use of 
> Python's ** function arguments notation, which maps a dictionary of 
> (key:value) pairs into a set of keyword arguments:
>
>
>
> >>> print DIV('text', **{'_data-role': 'collapsible'}) >>> data-role="collapsible">text
>  
>
> Anthony
>
> On Monday, December 5, 2016 at 2:36:01 AM UTC-5, lyn2py wrote:
>>
>>
>> Hello guys! Long time no see :)
>>
>> With HTML5 attributes being widely used, I thought I could add one to the 
>> response.menu
>>
>> I tried but it didn't work, I appreciate help and pointers! =)
>>
>> This is the current response.menu generated HTML (specifically, the 
>> *first* ul):
>>
>> 
>> ...
>> ...
>> ...
>> 
>>
>>
>> This is the result I would like to attain:
>>
>> ...
>> ...
>> ...
>> 
>>
>>
>>
>> It's easy to change the class. But how to I add the HTML5 attribute?
>>
>>
>> Kindly note that it is simply "data-dropdown-menu" without any "=". 
>>
>>
>> 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.


[web2py] response.menu + HTML5 attributes

2016-12-04 Thread lyn2py

Hello guys! Long time no see :)

With HTML5 attributes being widely used, I thought I could add one to the 
response.menu

I tried but it didn't work, I appreciate help and pointers! =)

This is the current response.menu generated HTML (specifically, the *first* 
ul):


...
...
...



This is the result I would like to attain:

...
...
...




It's easy to change the class. But how to I add the HTML5 attribute?


Kindly note that it is simply "data-dropdown-menu" without any "=". 


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.


[web2py] Re: DAL min on 2 date columns

2015-07-08 Thread lyn2py
I have a database of data, which will periodically update the older entries or 
newly inserted entries, depending on how old the entry is, or if it was a newly 
created entry. 

For instance, the availability of a website. 

Someone adds a new website, date created is request.now
I schedule a worker to scan the db for the min date created, and min date 
updated 
This entry comes up, I perform the check and update the db etc

The question is how to write the query to get min for two date fields... Thank 
you guys. I appreciate your help. 

-- 
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 and AngularJs route collision

2015-07-08 Thread lyn2py
use web2py for routing and angular for frontend

On Wednesday, July 8, 2015 at 8:53:41 PM UTC+8, Aravind S wrote:

 Our *web2py* project has two parts :

 1) Dashboard console (Single Page App).

 2) Customer Form.

 We are now trying to rebuild the *dashboard console* using *Angular js* which 
 sits under the following url:

 http://domain.com/app/controller/function?id=b2eemail=a...@abc.com#/

 *Issue :* Angular routes are re-routed by web2py which is undesirable.

 *Question :* How do I disable the web2py routing for that particular 
 controller-function? Or any other possible solutions?

 I've written my angular-app logics under *App/static/angular_app/* and 
 views are in*App/static/angular_app/views* (web2py static folder)

 Please take a look at my stackoverflow post:


 http://stackoverflow.com/questions/31182466/web2py-and-angularjs-route-collision


-- 
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] DAL min on 2 date columns

2015-07-07 Thread lyn2py
Hi,

If I have 2 columns, date_created, date_updated

db.define_table('table', 
Field('date_created', 'datetime',default=request.now),
Field('date_updated', 'datetime',update=request.now),
)

and I want to do a DAL query to get the datetime that is the furthest from 
now (i.e. the db entry is the oldest) on both the date_created and 
date_updated. I know how to do it if it's just one column, but how should I 
do this if two columns are involved?


-- 
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] new (actually old) feature in trunk: /welcome/appadmin/manage/auth

2015-06-29 Thread lyn2py
Thank you for highlighting this! Learnt something new today

On Monday, June 29, 2015 at 10:12:19 PM UTC+8, Massimo Di Pierro wrote:

 You are right. we should make it more clear.

 On Monday, 29 June 2015 08:16:36 UTC-5, 黄祥 wrote:

 i think it's already documented on web2py book
 ref :

 http://web2py.com/books/default/chapter/29/09/access-control#Application-Management-via-privileged-users--Experimental-

 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] Re: Markmin Blockquote

2014-12-28 Thread lyn2py
I see niphlod, this is the code:

def index():
text = 
##H2

paragraph text
+s
+locals
+r
paragraph text
paragraph text

###H3

-
  This is a paragraph in a blockquote

  + item 1
  + item 2
  -- item 2.1
  -- item 2.2
  + item 3

  -
  0 | 0 | X
  0 | X | 0
  X | 0 | 0
  -:tableclass1
-

- [[key]] value


mm = MARKMIN(text)
return locals()

And this is the output:

H2

paragraph text

   1. s
   2. locals
   3. r

paragraph text paragraph text
H3

This is a paragraph in a blockquote + item 1 + item 2 -- item 2.1 -- item 
2.2 + item 3 - 0 | 0 | X 0 | X | 0 X | 0 | 0 -:tableclass1


   - value



Notice the block quote is rendered as a single line. The code for the block 
quote I copied and pasted from
http://www.web2py.com/init/static/markmin.html

But it doesn't look like the html output on the example webpage :(

The version is a recent pull, details:
2.10.0-beta+timestamp.2014.10.16.15.58.50
(Running on Rocket 1.2.6, Python 2.7.8) 

Thank you for your patience niphlod

On Sunday, December 28, 2014 5:33:56 PM UTC+8, Niphlod wrote:

 sorry but I'm having problems understanding what's the issue...without 
 proper newlines that will remain a single line and not a blockquote...



-- 
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: Markmin Blockquote

2014-12-28 Thread lyn2py
When I add the newline, the result became two hr, one at the top and the 
other at the bottom, specifically:

-

  This is a paragraph in a blockquote

  + item 1
  + item 2
  -- item 2.1
  -- item 2.2
  + item 3

  -
  0 | 0 | X
  0 | X | 0
  X | 0 | 0
  -:tableclass1
-

Output:

H2

paragraph text

   1. s
   2. locals
   3. r

paragraph text paragraph text
H3
--

This is a paragraph in a blockquote

   1. item 1
   2. item 2
  - item 2.1
  - item 2.2
   3. item 3

00X0X0X00
--

   - value



And it's no longer a block quote?

On Sunday, December 28, 2014 10:32:10 PM UTC+8, Niphlod wrote:

 ok, this is far more helpful try with an empty line between - 
 and This is a paragraph in a blockquote


-- 
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] Markmin Blockquote

2014-12-27 Thread lyn2py
Hi guys I'm trying MARKMIN here and the block quotes I have look like this

  This is a paragraph in a blockquote + item 1 + item 2 -- item 2.1 -- item 
2.2 + item 3 - 0 | 0 | X 0 | X | 0 X | 0 | 0 -:tableclass1

And not like the one shown in:

  http://www.web2py.com/init/static/markmin.html

May I know what I'm doing wrong? I've also tried using # header per the 
instructions on that page but it isn't working either...

Thanks guys!

-- 
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: Markmin Blockquote

2014-12-27 Thread lyn2py
Sorry niphlod, it looks just like that, a single line with no newlines...

This is a paragraph in a blockquote + item 1 + item 2 -- item 2.1 -- item 
2.2 + item 3 - 0 | 0 | X 0 | X | 0 X | 0 | 0 -:tableclass1



On Sunday, December 28, 2014 12:45:09 AM UTC+8, Niphlod wrote:

 if you don't paste your contents in a code block on the forum, it's 
 impossible to tell you what's wrong because normal posts don't keep 
 spacing and newlines

 On Saturday, December 27, 2014 2:53:02 PM UTC+1, lyn2py wrote:

 Hi guys I'm trying MARKMIN here and the block quotes I have look like this

   This is a paragraph in a blockquote + item 1 + item 2 -- item 2.1 -- 
 item 2.2 + item 3 - 0 | 0 | X 0 | X | 0 X | 0 | 0 
 -:tableclass1

 And not like the one shown in:

   http://www.web2py.com/init/static/markmin.html

 May I know what I'm doing wrong? I've also tried using # header per the 
 instructions on that page but it isn't working either...

 Thanks guys!



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

2014-11-18 Thread lyn2py
I think a lot has to do with the culture. Notice in Meteor there is a very 
commercial culture about it. In web2py it's a family of giving and sharing. 
At least that's how I perceive it. I feel more comfortable here.

On Tuesday, November 18, 2014 7:15:04 PM UTC+8, Ramos wrote:

 Funding web2py could punch it to the future faster

 Meteor did it , why cant web2py get some fundings ?


 https://www.meteor.com/blog/2012/07/25/meteors-new-112-million-development-budget

 Regards
 António


-- 
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] Ubuntu, Nginx, Web2py - how to deploy Awstats on server?

2014-11-13 Thread lyn2py
Hi guys, I just looked up how to do it, but because web2py uses special 
Nginx configurations, I'd like to ask if anyone installed Awstats on the 
Ubuntu, Nginx, WSGI configuration, and how did you do it?

This is the closest I can find regarding installing Awstats but I'm stumped 
at the access.log files. (i have a few domains and Web2py handles them for 
me, directing to different apps).

http://kamisama.me/2013/03/20/install-configure-and-protect-awstats-for-multiple-nginx-vhost-on-debian/

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.


[web2py] Re: Deployment

2014-10-19 Thread lyn2py
Why would you want to do that?

On Saturday, October 18, 2014 10:20:17 AM UTC+8, Jigar Mistry wrote:

 Hello everyone,

 Is this possible to deploy single web2py app on nginx without web2py?



 Thanks,
 Jigar Mistry


-- 
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: Semantic UI instead of bootstap

2014-10-15 Thread lyn2py
It's good for the widgets but not the grid.

It looks better by itself than to mix with others like zurb and bootstrap. 
It's a tad bigger, and different kind of style.
Out of the box, I personally did not find its styling as nice as zurb and 
bootstrap, and it requires to input quite a bit of code to produce. There 
was a widget that I couldn't get it to display properly, and there was no 
easy way to search for answers on stack overflow or google like the others 
(because it's much younger) 
I tried but gave up and went with another instead. That was when I needed 
to change my code and boy... it's an overhaul.

Others that may interest you: purecss, uikit, bootflat (bootstrap has a lot 
of flat ui's available, most of the nice ones are premium at codecanyon)

On Monday, October 13, 2014 10:19:34 PM UTC+8, Ramos wrote:

 is semantic UI a good frontend ?

 http://semantic-ui.com/

 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: translating the views

2014-10-01 Thread lyn2py
Translation Markmin is available.

T.M('**bold** this text')

On Wednesday, October 1, 2014 6:03:44 PM UTC+8, Pablo Angulo wrote:

 I sometimes find very inconvenient the translate feature. Some views 
 contain a lot of static text, so if I want to translate it I would do: 

 p{{=T('I sometimes find very inconvenient the translate feature. Some 
 views contain a lot of text, so if I want to translate it I would 
 do:')}}/p 

 but if there are other html tags, I have to choose between: 

 {{=T('''pSome  strongimportant/strong text and other 
 liemphasizes/li items./p 
 pAnother paragraph/p 
 pand the last one/p''')}} 

 which is not ideal because any translator can break the DOM correctness 
 of the page for just one language, or 
 p{{=T('Some')}} strong{{=T(''important'')}}/strong ... 

 which is cumbersome, and the complete sentence may not make sense at all 
 if the pieces are translated at random order. 

 I'm considering using MARKMIN, so the view would be: 

 {{=MARKMIN(T(''' 
 # Title 

 this is **bold** or ''italic'' and this [[a link http://web2py.com]] 
 '''))}} 

 But before I dive deeper: what do you think? 



-- 
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] lxml - cannot import etree

2014-09-24 Thread lyn2py
Hello there, I am adding lxml to the modules folder. And ran into error 
(below).


   1. I am using the latest version of web2py from git
   2. I used to use lxml this way and it worked (that was 2 years ago)
   3. This app was created brand new with the only line added from lxml import 
   etree, objectify
   4. lxml was downloaded using command git clone 
   git://github.com/lxml/lxml.git lxml, according 
   to http://lxml.de/index.html#download
   
Thank you I appreciate any assistance!

type 'exceptions.ImportError' cannot import name etree
Versionweb2py™Version 2.9.11-stable+timestamp.2014.09.15.18.31.17PythonPython 
2.7.5: /usr/bin/python (prefix: 
/System/Library/Frameworks/Python.framework/Versions/2.7)

Traceback

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

Traceback (most recent call last):
  File /Users/./gluon/restricted.py, line 224, in restricted
exec ccode in environment
  File /Users/./applications/app/controllers/default.py 
http://127.0.0.1:8000/admin/default/edit/authority/controllers/default.py, 
line 3, in module
from lxml import etree, objectify
ImportError: cannot import name etree


 

-- 
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: lxml - cannot import etree

2014-09-24 Thread lyn2py
Yes you are right Leonel, I just found this:
http://lxml.de/2.1/build.html

it needs to be compiled first. 

Thank you!

On Wednesday, September 24, 2014 11:07:57 PM UTC+8, Leonel Câmara wrote:

 Did you compile lxml? I'm also not sure non pure Python modules work in 
 the app modules folder.


-- 
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: import_from_csv_file and unique

2014-08-29 Thread lyn2py
Thanks Derek. If the uuid field were specified, shouldn't the specified field 
be used, the way a uuid field is used, to de-duplicate records?

-- 
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] import_from_csv_file and unique

2014-08-28 Thread lyn2py
Assistance, anyone? 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.


[web2py] import_from_csv_file and unique

2014-08-23 Thread lyn2py
Hi again :)

I would like to import a CSV file but set the unique field/column to 
*full_name_code* (instead of *uuid*).

So here's what I did:
def import_csv():
form = SQLFORM.factory(
Field('csv_file','upload',uploadfield=False)
)
if form.process().accepted:
ff = request.vars.csv_file.file
db.table.import_from_csv_file(ff, unique='full_name_code')
response.flash = 'Import Successful!'
return locals()

But…. it just adds records and I end up with duplicate full_name_codes in 
the database.

And this happens even though I have set:
db.define_table('table', 
Field('full_name_code', 'string',unique=True),
...
)

May I know how I can import CSV using a unique field that I specify?

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.


[web2py] response.flash not hiding when empty

2014-08-20 Thread lyn2py
I'm not using the welcome app since I will be moving away from using BS3 in 
my next app, but I want to keep the functionality of response.flash.

So I added web2py.js (I did not include web2py_ajax.html because I won't be 
needing the other items)

The response.flash functionality was in place, however with one problem… 
when the page loads and response.flash is None (it is not declared at 
all!), an empty box loads (with a small X).

I just want to check if anyone has experienced this and how to resolve it 
(or where to look to resolve 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.


[web2py] Re: response.flash not hiding when empty

2014-08-20 Thread lyn2py
This is the code in the HTML HEAD:

...css files here...

  script src={{=URL('static','zurb/js/vendor/modernizr.js')}}/script
  script 
src=//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js/script
  script src={{=URL('static','zurb/js/vendor/fastclick.js')}}/script
  script src={{=URL('static','js/web2py.js')}}/script

Appreciate any help. Thanks!


On Wednesday, August 20, 2014 10:15:25 PM UTC+8, lyn2py wrote:

 I'm not using the welcome app since I will be moving away from using BS3 
 in my next app, but I want to keep the functionality of response.flash.

 So I added web2py.js (I did not include web2py_ajax.html because I won't 
 be needing the other items)

 The response.flash functionality was in place, however with one problem… 
 when the page loads and response.flash is None (it is not declared at 
 all!), an empty box loads (with a small X).

 I just want to check if anyone has experienced this and how to resolve it 
 (or where to look to resolve 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.


[web2py] Re: response.flash not hiding when empty

2014-08-20 Thread lyn2py
OMG troubleshooted for the whole day, even tried replicating in a minimal 
app with no avail.

One good question from Niphlod resolved it… LOL

Wasted hours. Thank you very much sir!

On Wednesday, August 20, 2014 11:39:40 PM UTC+8, Niphlod wrote:

 where is web2py.css ?

 On Wednesday, August 20, 2014 5:36:58 PM UTC+2, lyn2py wrote:

 This is the code in the HTML HEAD:

 ...css files here...

   script src={{=URL('static','zurb/js/vendor/modernizr.js')}}/script
   script src=//
 ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js/script
   script src={{=URL('static','zurb/js/vendor/fastclick.js')}}/script
   script src={{=URL('static','js/web2py.js')}}/script

 Appreciate any help. Thanks!


 On Wednesday, August 20, 2014 10:15:25 PM UTC+8, lyn2py wrote:

 I'm not using the welcome app since I will be moving away from using BS3 
 in my next app, but I want to keep the functionality of response.flash.

 So I added web2py.js (I did not include web2py_ajax.html because I won't 
 be needing the other items)

 The response.flash functionality was in place, however with one problem… 
 when the page loads and response.flash is None (it is not declared at 
 all!), an empty box loads (with a small X).

 I just want to check if anyone has experienced this and how to resolve 
 it (or where to look to resolve 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.


[web2py] Re: email not sent

2014-08-17 Thread lyn2py
Yup, you need to change logging to the smtp gmail server, in other words, 
switch them around (put the smtp first followed by logging).

Logging will print the email in the console, which you can use to check the 
contents.

On Sunday, August 17, 2014 1:50:05 PM UTC+8, Alex Glaros wrote:

 on PythonAnywhere, I get email not sent error

 did I do anything wrong?

 ## configure email
 mail = auth.settings.mailer
 mail.settings.server = 'logging' or 'smtp.gmail.com:587'
 mail.settings.sender = 'al...@gmail.com javascript:' # your 
 email

 2014-08-17 04:51:36,559 :email not sent
 
 From: a...@gmail.com javascript:
 To: a...@gmail.com javascript:
 Subject: Password reset

 Click on the link 
 https://alexglaros.pythonanywhere.com/engagementSquared/default/user/reset_password/140
  to reset your password
 


 2014-08-17 04:48:48 announcing my loyalty to the Emperor...
 2014-08-17 04:51:36 WARNING:web2py:email not 
 sent#012#012From: 
 alex...@gmail.com#012To: a...@gmail.com#012Subject: Password 
 reset#012#012Click on the link 
 https://alexglaros.pythonanywhere.com/engagementSquared/default/user/reset_password9ce8cd5
  
 to reset your password#012

 thanks,

 Alex Glaros



-- 
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] How to use this module?

2014-08-12 Thread lyn2py
With reference to SimpleCV http://simplecv.org. Although it is a PY (I 
can drop into the modules folder and just import), it has a number of 
dependencies:

pygame=1.9.1
PIL==1.1.7
nose=1.0.0
ipython=0.12
numpy=numpy-2.0.0


Please correct me if I am wrong:

   1. Only pure python modules can be used from the *modules* folder?
   2. If they contain C,C++ files they cannot be used from the *modules* 
   folder? (or rather, how can I use them by dropping them into the modules 
   folder? I prefer this method since it is more portable)
   
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.


[web2py] Re: Web2py, authenticating two types of profile

2014-08-11 Thread lyn2py
Have you looked at auth groups?

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

You can create different types of accounts without separate tables.

On Sunday, August 10, 2014 3:01:14 PM UTC+8, eric cuver wrote:

 nobody know how we can create two types of accounts or login ?

 Le samedi 9 août 2014 00:27:03 UTC+2, eric cuver a écrit :

 hello everybody,

 i want create one application. i  need to create two types of accounts 
 or login. Each of them should be able to register/login/... buyer/customer 
  account defined by different tables in db.
 how i can do with web2py

 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.


[web2py] Re: Web2py, authenticating two types of profile

2014-08-11 Thread lyn2py
Ok, thanks for sharing your findings :) I think I misinterpreted your 
question :)

On Monday, August 11, 2014 11:04:34 PM UTC+8, eric cuver wrote:

 i find my solution

 it's that 
 http://stackoverflow.com/questions/23974774/creating-two-separate-registration-forms-in-web2py?rq=1

 thank you to help

 Le lundi 11 août 2014 12:25:58 UTC+2, lyn2py a écrit :

 Have you looked at auth groups?

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

 You can create different types of accounts without separate tables.

 On Sunday, August 10, 2014 3:01:14 PM UTC+8, eric cuver wrote:

 nobody know how we can create two types of accounts or login ?

 Le samedi 9 août 2014 00:27:03 UTC+2, eric cuver a écrit :

 hello everybody,

 i want create one application. i  need to create two types of accounts 
 or login. Each of them should be able to register/login/... buyer/customer 
  account defined by different tables in db.
 how i can do with web2py

 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.


[web2py] Re: Additional submit buttons on form

2014-08-11 Thread lyn2py
A few things…

1)

   - args takes a list
   - vars takes a dict
   
do you mean to use vars instead of args?

2) If deploy_name is a field in the form, and you want to get the value of 
it on clicking the button, you need to use javascript, like jQuery or the 
likes. 

3) Actually I am not sure what you want to achieve, so I can only guess, 
and I may be wrong. 

   - By default, web2py will submit the form to itself and return back the 
   original form. You can call other functions from within that function. 
   - In your quoted case (the button's code), clicking on the button only 
   takes the user to another page instead of submitting the form. 
   


On Monday, August 11, 2014 8:11:19 PM UTC+8, Stephen Weiss wrote:


 I'm in search of a way to have multiple submit buttons on a form that 
 would perform a different function depending on whichever button was 
 pressed.

 After pressing whichever button, the form should be submitted and after 
 performing the function, return the user back to the original form.


 I have a standard 'index' method that builds the form and adds another 
 button like:

form.add_button(Reset, URL(reset, args = dict(deploy_name = 
 request.vars.deploy_name)))


 When i press the Reset button, it calls the *reset* method I have 
 defined, but I have two problems:

 1. I can't seem to get the value of the deploy_name, which is a field on 
 the form.
Is args the proper method of passing variable information or should I 
 be using something else?

 2. I can't seem to redisplay the form as it originally started out as.
 I tried adding a *redirect('index')* call to the end of the *reset* 
 method, but that causes strange operation.

 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.


[web2py] Re: Additional submit buttons on form

2014-08-11 Thread lyn2py
Maybe you can let us see your code and explain what you would like to do, 
if you would like some input on the direction of how to do it?

On Tuesday, August 12, 2014 12:52:14 AM UTC+8, Stephen Weiss wrote:


 Well, I'm VERY new to Web2Py, so at this point I've got a lot of learning 
 to do...

 After doing some more reading, I think I need to use vars.

 Yes deploy_name is a field on the form from which I'd like to obtain user 
 input.

 I'm really not sure what the recommended approach to work this page within 
 the Web2Py framework.

 The page has a number of fields, some drop-down selections from db tables, 
 another (deploy_name) a text field.

 The deploy_name field can be used in different functions, thus I need 
 multiple buttons.  

 The standard Submit button, works as expected, but as you state, the Reset 
 button does not.

 However, I'd like the second (and possibly more buttons) to use the 
 deploy_name field, which is why I'm redirecting to a different method.
 It appears as though that's not the proper way of handling this scenario 
 then?

 Should all the buttons submit then instead of redirect?
 Is there a way to determine in the controller code which button the user 
 pressed?

 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.


[web2py] MARKMIN italics not working with didn't

2014-08-10 Thread lyn2py
Just spotted this bug.

If you have a ' in your text, it cannot be italicized, instead it is 
printed as is.

Examples to test:
''try this, it works''

''but then this doesn't work''


-- 
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: MARKMIN italics not working with didn't

2014-08-10 Thread lyn2py
Thanks guys. Going to trunk now :)

On Sunday, August 10, 2014 10:30:37 PM UTC+8, Leonel Câmara wrote:

 I think changing markmin regex_em from ''(?Pt[^\s']+(?: 
 +[^\s']+)*)'' to ''(?Pt([^\s']| |'(?!'))+)'' would solve 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.


Re: [web2py] Re: Resizing a user uploaded image

2014-08-09 Thread lyn2py
Did you manage to figure this out?

I am trying out the gluon/ contrib/ imageutils and it isn't working for me 
either.

The 
db.table_name.picture.requires = RESIZE(200, 200)

and 

db.table_name.thumbnail.compute = lambda row: THUMB(row.picture, 200, 200)

Both are not working for me. Instead the picture is being uploaded in its 
original size. 


On Wednesday, January 9, 2013 7:30:14 AM UTC+8, Daniele Pestilli wrote:

 I put imageutils in my app's modules directory, then I added:
 Field(thumbnail, upload, uploadfolder=os.path.join(request.folder, 
 'uploads', 'profiles', 'thumbs')),
 to the appropriate database table, and below that, in the same file 
 (db.py) I wrote:

 from imageutils import THUMB
 db.tutor.thumbnail.compute = lambda row: THUMB(row.picture, 200, 200)

 but the resizing doesn't seem to work. Am I doing something wrong?


 On Tue, Jan 8, 2013 at 9:29 PM, Michele Comitini michele@gmail.com 
 javascript: wrote:

 I use wand for the task: http://pypi.python.org/pypi/Wand/0.1.10
 there are many other bindings on the impressive *magick libraries, but
 this one being a ctypes implementation is light and fast enough..

 mic


 2013/1/8 Bruno Rocha rocha...@gmail.com javascript::
  I am using this recipe:
 
  
 http://www.web2pyslices.com/slice/show/1522/generate-a-thumbnail-that-fits-in-a-box
 
  I have plans to integrate it with a JavaScript Cropper plugin to get the
  dimensions.
 
  --
 
 
 

 --






-- 
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: Bare Login using API key

2014-08-07 Thread lyn2py
Ok thank you for pointing out the security measures. I'm new to this so I 
had no idea about it.

Is it better to do away with *login:p...@url.com* and use instead 
*url.com/call/jsonrpc/api_key *, or what would be the correct / recommended 
method to serve APIs with web2py?

Thank you, I appreciate it.


On Thursday, August 7, 2014 4:09:16 AM UTC+8, Massimo Di Pierro wrote:

 You will find those parameters hashed in 
 request.env.HTTP_AUTHORIZATION
 (this puzzles me because it is supposed to 
 be request.env.http_authorization) in web2py.

 Anyway, this method of authentication is discouraged for security reasons 
 and most browsers including Chrome and IE strip the from the URL:
 http://support.microsoft.com/default.aspx?scid=kb;%5bLN%5d;834489

 On Tuesday, 5 August 2014 21:39:10 UTC-5, lyn2py wrote:

 Hi Massimo, in case you missed this, this is a call out, I hope you can 
 shed some light on this.

 If I would like to do something like:

 http://api_key:api_secret@some_url.com/default/call/jsonrpc



 On Thursday, July 31, 2014 2:19:36 PM UTC+8, lyn2py wrote:

 Thanks Leonel! I just thought that web2py had something like that 
 already in place, perhaps needed to add a correct decorator, and I didn't 
 need to reinvent the wheel.

 Sidenote to Massimo: What do you think of the idea? Have a decorator to 
 check for a special field or fields (API key related, like API key, API 
 secret) in order to get a particular / restricted access to the API calls.



 On Thursday, July 31, 2014 2:06:21 AM UTC+8, Leonel Câmara wrote:

 An easy way would be to have your default.py/call function check the 
 API key and raise HTTP(403) if it's not valid. You could subclass Auth, 
 make your own basic_login using the API key, use that as the Auth for your 
 application, and then use auth.requires_login() in call, but it seems 
 unnecessarily complicated for 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.


[web2py] Facebook OAuth - newbie question

2014-08-07 Thread lyn2py
Hello, 

I have setup the code for FB oauth per web2py book here:
http://web2py.com/books/default/chapter/29/09/access-control

The code here:

## Define oauth application id and secret.
FB_CLIENT_ID='xxx'
FB_CLIENT_SECRET=

## import required modules
try:
import json
except ImportError:
from gluon.contrib import simplejson as json
from facebook import GraphAPI, GraphAPIError
from gluon.contrib.login_methods.oauth20_account import OAuthAccount


## extend the OAUthAccount class
class FaceBookAccount(OAuthAccount):
OAuth impl for FaceBook
AUTH_URL=https://graph.facebook.com/oauth/authorize;
TOKEN_URL=https://graph.facebook.com/oauth/access_token;

def __init__(self):
OAuthAccount.__init__(self, None, FB_CLIENT_ID, FB_CLIENT_SECRET,
  self.AUTH_URL, self.TOKEN_URL,
  scope='email,user_about_me,user_activities, 
user_birthday, user_education_history, user_groups, user_hometown, 
user_interests, user_likes, user_location, user_relationships, 
user_relationship_details, user_religion_politics, user_subscriptions, 
user_work_history, user_photos, user_status, user_videos, publish_actions, 
friends_hometown, friends_location,friends_photos',
  state=auth_provider=facebook,
  display='popup')
self.graph = None

def get_user(self):
'''Returns the user using the Graph API.
'''
if not self.accessToken():
return None

if not self.graph:
self.graph = GraphAPI((self.accessToken()))

user = None
try:
user = self.graph.get_object(me)
except GraphAPIError, e:
session.token = None
self.graph = None

if user:
if not user.has_key('username'):
username = user['id']
else:
username = user['username']

if not user.has_key('email'):
email = '%s.fakemail' %(user['id'])
else:
email = user['email']

return dict(first_name = user['first_name'],
last_name = user['last_name'],
username = username,
email = '%s' %(email) )

## use the above class to build a new login form
auth.settings.login_form=FaceBookAccount()



And I have tried logging in, the page displays and asks for my permissions, 
which is all good.

But then, it doesn't appear that I have logged in, in my app. I keep 
returning to the login page like I have not logged in.
And I checked the database, no new auth_user entries have been created 
there either…

May I know if I had missed a step or did something incorrectly?

I appreciate any help or guidance. 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.


Re: [web2py] Facebook OAuth - newbie question

2014-08-07 Thread lyn2py
Good one Michele!

This was what I did:

if not self.accessToken():
print 'no accesstoken'
return None

No accessToken(), what then should I do? Or where should I consult?

On Friday, August 8, 2014 5:40:09 AM UTC+8, Michele Comitini wrote:

 Could be a session problem.
 Check that your session is created and works across page reloads.

 Also check the get_user() method there could be some error raised there 
 (most likely by the GraphApi),  use the debugger or simply put some logging 
 statements to see what's going on

 I had also troubles with https not properly setup on my side so check that 
 too


 2014-08-07 19:37 GMT+02:00 lyn2py lyn...@gmail.com javascript::

 Hello, 

 I have setup the code for FB oauth per web2py book here:
 http://web2py.com/books/default/chapter/29/09/access-control

 The code here:

 ## Define oauth application id and secret.

 FB_CLIENT_ID='xxx'
 FB_CLIENT_SECRET=

 ## import required modules
 try:
 import json
 except ImportError:
 from gluon.contrib import simplejson as json
 from facebook import GraphAPI, GraphAPIError
 from gluon.contrib.login_methods.oauth20_account import OAuthAccount


 ## extend the OAUthAccount class
 class FaceBookAccount(OAuthAccount):

 OAuth impl for FaceBook
 AUTH_URL=https://graph.facebook.com/oauth/authorize;

 TOKEN_URL=https://graph.facebook.com/oauth/access_token;

 def __init__(self):

 OAuthAccount.__init__(self, None, FB_CLIENT_ID, FB_CLIENT_SECRET,

   self.AUTH_URL, self.TOKEN_URL,

   scope='email,user_about_me,user_activities, 
 user_birthday, user_education_history, user_groups, user_hometown, 
 user_interests, user_likes, user_location, user_relationships, 
 user_relationship_details, user_religion_politics, user_subscriptions, 
 user_work_history, user_photos, user_status, user_videos, publish_actions, 
 friends_hometown, friends_location,friends_photos',

   state=auth_provider=facebook,
   display='popup')

 self.graph = None

 def get_user(self):

 '''Returns the user using the Graph API.
 '''
 if not self.accessToken():

 return None

 if not self.graph:

 self.graph = GraphAPI((self.accessToken()))

 user = None
 try:

 user = self.graph.get_object(me)

 except GraphAPIError, e:

 session.token = None

 self.graph = None

 if user:
 if not user.has_key('username'):

 username = user['id']

 else:
 username = user['username']

 
 if not user.has_key('email'):

 email = '%s.fakemail' %(user['id'])

 else:
 email = user['email']

 return dict(first_name = user['first_name'],

 last_name = user['last_name'],

 username = username,
 email = '%s' %(email) )

 ## use the above class to build a new login form
 auth.settings.login_form=FaceBookAccount()



 And I have tried logging in, the page displays and asks for my 
 permissions, which is all good.

 But then, it doesn't appear that I have logged in, in my app. I keep 
 returning to the login page like I have not logged in.
 And I checked the database, no new auth_user entries have been created 
 there either…

 May I know if I had missed a step or did something incorrectly?

 I appreciate any help or guidance. 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+un...@googlegroups.com javascript:.
 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] Facebook OAuth - newbie question

2014-08-07 Thread lyn2py
I looked through the code gluon.contrib.login_methods.oauth20_account and 
just banged out something to test in the module for the Facebook class.

from gluon import current
print current.request.vars #gave Storage {}


Looks like it isn't getting the request.vars.code it's supposed to get...


On Friday, August 8, 2014 10:50:53 AM UTC+8, lyn2py wrote:

 Good one Michele!

 This was what I did:

 if not self.accessToken():
 print 'no accesstoken'
 return None

 No accessToken(), what then should I do? Or where should I consult?

 On Friday, August 8, 2014 5:40:09 AM UTC+8, Michele Comitini wrote:

 Could be a session problem.
 Check that your session is created and works across page reloads.

 Also check the get_user() method there could be some error raised there 
 (most likely by the GraphApi),  use the debugger or simply put some logging 
 statements to see what's going on

 I had also troubles with https not properly setup on my side so check 
 that too


 2014-08-07 19:37 GMT+02:00 lyn2py lyn...@gmail.com:

 Hello, 

 I have setup the code for FB oauth per web2py book here:
 http://web2py.com/books/default/chapter/29/09/access-control

 The code here:

 ## Define oauth application id and secret.

 FB_CLIENT_ID='xxx'
 FB_CLIENT_SECRET=

 ## import required modules
 try:
 import json
 except ImportError:
 from gluon.contrib import simplejson as json
 from facebook import GraphAPI, GraphAPIError
 from gluon.contrib.login_methods.oauth20_account import OAuthAccount


 ## extend the OAUthAccount class
 class FaceBookAccount(OAuthAccount):

 OAuth impl for FaceBook
 AUTH_URL=https://graph.facebook.com/oauth/authorize;

 TOKEN_URL=https://graph.facebook.com/oauth/access_token;

 def __init__(self):

 OAuthAccount.__init__(self, None, FB_CLIENT_ID, FB_CLIENT_SECRET,

   self.AUTH_URL, self.TOKEN_URL,

   scope='email,user_about_me,user_activities, 
 user_birthday, user_education_history, user_groups, user_hometown, 
 user_interests, user_likes, user_location, user_relationships, 
 user_relationship_details, user_religion_politics, user_subscriptions, 
 user_work_history, user_photos, user_status, user_videos, publish_actions, 
 friends_hometown, friends_location,friends_photos',

   state=auth_provider=facebook,
   display='popup')

 self.graph = None

 def get_user(self):

 '''Returns the user using the Graph API.
 '''
 if not self.accessToken():

 return None

 if not self.graph:

 self.graph = GraphAPI((self.accessToken()))

 user = None
 try:

 user = self.graph.get_object(me)

 except GraphAPIError, e:

 session.token = None

 self.graph = None

 if user:
 if not user.has_key('username'):

 username = user['id']

 else:
 username = user['username']

 
 if not user.has_key('email'):

 email = '%s.fakemail' %(user['id'])

 else:
 email = user['email']

 return dict(first_name = user['first_name'],

 last_name = user['last_name'],

 username = username,
 email = '%s' %(email) )

 ## use the above class to build a new login form
 auth.settings.login_form=FaceBookAccount()



 And I have tried logging in, the page displays and asks for my 
 permissions, which is all good.

 But then, it doesn't appear that I have logged in, in my app. I keep 
 returning to the login page like I have not logged in.
 And I checked the database, no new auth_user entries have been created 
 there either…

 May I know if I had missed a step or did something incorrectly?

 I appreciate any help or guidance. 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+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.


  1   2   3   4   5   >