[web2py] Re: web2py 2.15.1 is OUT

2017-08-03 Thread Leonel Câmara
Alex please create an issue in github, that's a genuine python 3 bug, 
exactly the kind we want to find during this experimental python 3 support 
phase.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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-08-03 Thread Alex
I tested the latest version 2.15.2 and I've got a problem when accessing 
ajax post parameters with web2py under Python 3.

The client sends a PUT request using jquery like this:
$.ajax('', {
data: JSON.stringify({
report: report
outputFormat: 'pdf'
}),
type: "PUT", contentType: "application/json",
...


in the controller I access the parameters, e.g.

output_format = request.vars.outputFormat


when using Python 2.7 the variable output_format is set to 'pdf' as 
expected. When using Python 3.5 the variable is None.

Alex

On Thursday, August 3, 2017 at 5:26:31 AM UTC+2, Richard wrote:
>
> I recall having conversation about that, I am not sure, I think it 
> language file or pickle objects that get modify in a no way back manner... 
> But, sure the app code it not affected... I should retrieve this 
> exchange... will try tomorrow.
>
> Richard
>
> On Wed, Aug 2, 2017 at 9:53 PM, Anthony > 
> wrote:
>
>> On Wednesday, August 2, 2017 at 12:26:45 PM UTC-4, Richard wrote:
>>>
>>> Don't forget to copy/paste (backup) you app before you try Python 3, 
>>> because there is no way back with the app once you use it under python 3 as 
>>> certain stuff are modify by python 3 that let your app unusable with python 
>>> 2 after.
>>>
>>
>> That sounds extreme, as you can certainly simply redeploy the original 
>> Python 2 code in a Python 2 environment -- there is a way back.
>>
>> 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+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.


Re: [web2py] Re: web2py 2.15.1 is OUT

2017-08-03 Thread Anthony
On Wednesday, August 2, 2017 at 11:26:31 PM UTC-4, Richard wrote:
>
> I recall having conversation about that, I am not sure, I think it 
> language file or pickle objects that get modify in a no way back manner...
>

I think only the sessions and error tickets should be affected, as they are 
pickled. Language files should be OK -- they are just plain Python code 
(containing a Python dictionary).

Regarding sessions, simply copying/backing up the old sessions might not be 
particularly helpful -- if you do revert back to the old sessions, they 
will end up being outdated anyway.

The bigger point, though, should be that it is not intended that you would 
switch back and forth between Python 2 and Python 3 using the same 
application folders -- pick a Python version and stick with it.

Anthony

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


Re: [web2py] Re: web2py 2.15.1 is OUT

2017-08-02 Thread Richard Vézina
I recall having conversation about that, I am not sure, I think it language
file or pickle objects that get modify in a no way back manner... But, sure
the app code it not affected... I should retrieve this exchange... will try
tomorrow.

Richard

On Wed, Aug 2, 2017 at 9:53 PM, Anthony  wrote:

> On Wednesday, August 2, 2017 at 12:26:45 PM UTC-4, Richard wrote:
>>
>> Don't forget to copy/paste (backup) you app before you try Python 3,
>> because there is no way back with the app once you use it under python 3 as
>> certain stuff are modify by python 3 that let your app unusable with python
>> 2 after.
>>
>
> That sounds extreme, as you can certainly simply redeploy the original
> Python 2 code in a Python 2 environment -- there is a way back.
>
> Anthony
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: web2py 2.15.1 is OUT

2017-08-02 Thread Anthony
On Wednesday, August 2, 2017 at 12:26:45 PM UTC-4, Richard wrote:
>
> Don't forget to copy/paste (backup) you app before you try Python 3, 
> because there is no way back with the app once you use it under python 3 as 
> certain stuff are modify by python 3 that let your app unusable with python 
> 2 after.
>

That sounds extreme, as you can certainly simply redeploy the original 
Python 2 code in a Python 2 environment -- there is a way back.

Anthony

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


Re: [web2py] Re: web2py 2.15.1 is OUT

2017-08-02 Thread Richard Vézina
Don't forget to copy/paste (backup) you app before you try Python 3,
because there is no way back with the app once you use it under python 3 as
certain stuff are modify by python 3 that let your app unusable with python
2 after.

Richard

On Wed, Aug 2, 2017 at 9:24 AM, Anthony  wrote:

> On Wednesday, August 2, 2017 at 9:13:31 AM UTC-4, bonbe wrote:
>>
>> The same thing happened to me.
>>
>> Are you saying that has happened with the latest release (2.15.2), or
> only with 2.15.0b1?
>
> Please use Python3.
>>
>> web2py should continue to work with Python 2, so there is no need to move
> to Python 3. If there is a bug, it will be fixed.
>
> Anthony
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Re: web2py 2.15.1 is OUT

2017-08-02 Thread Anthony
On Wednesday, August 2, 2017 at 9:13:31 AM UTC-4, bonbe wrote:
>
> The same thing happened to me.
>
> Are you saying that has happened with the latest release (2.15.2), or only 
with 2.15.0b1?

Please use Python3.
>
> web2py should continue to work with Python 2, so there is no need to move 
to Python 3. If there is a bug, it will be fixed.

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

2017-08-02 Thread bonbe


The same thing happened to me.
Please use Python3.



2017年7月17日月曜日 21時11分58秒 UTC+9 vince:
>
> i download from 
> https://mdipierro.pythonanywhere.com/examples/static/web2py_src.zip
>
> on first line of changelog it's 2.15.0b1
>
> and when i run web2py.py error as below
>
> Traceback (most recent call last):
>   File "./web2py.py", line 21, in 
> import gluon.widget
>   File "/home/web2py/gluon/__init__.py", line 38, in 
> from .dal import DAL, Field
>   File "/home/web2py/gluon/dal.py", line 19, in 
> from gluon import sqlhtml
>   File "/home/web2py/gluon/sqlhtml.py", line 32, in 
> from pydal.helpers.methods import smart_query, bar_encode, _repr_ref, 
> merge_tablemaps
> ImportError: cannot import name merge_tablemaps 
>
> -vince
>
> 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-17 Thread Leonel Câmara
Carlos your problem was already reported:
https://github.com/web2py/web2py/issues/1672

Before the next release which will have the fix the workaround is:

form = SQLFORM.factory(db.tabela.campo.clone())


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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-17 Thread Carlos Costa
I have a problem with this version.

This does not work anymore:

db.define_table('tabela', Field('campo'))
form = SQLFORM.factory(db.tabela.campo)

I throws this:

Traceback (most recent call last):
  File "C:\Users\carlos.costa\Downloads\web2py\gluon\restricted.py", line 219, 
in restricted
exec(ccode, environment)
  File 
"C:/Users/carlos.costa/Downloads/web2py/applications/teste/controllers/default.py"
 , line 
66, in 
  File "C:\Users\carlos.costa\Downloads\web2py\gluon\globals.py", line 409, in 

self._caller = lambda f: f()
  File 
"C:/Users/carlos.costa/Downloads/web2py/applications/teste/controllers/default.py"
 , line 
13, in teste
form = SQLFORM.factory(db.tabela.campo)
  File "C:\Users\carlos.costa\Downloads\web2py\gluon\sqlhtml.py", line 1919, in 
factory
return SQLFORM(DAL(None).define_table(table_name, *fields),
  File 
"C:\Users\carlos.costa\Downloads\web2py\gluon\packages\dal\pydal\base.py", line 
587, in define_table
table = self.lazy_define_table(tablename, *fields, **args)
  File 
"C:\Users\carlos.costa\Downloads\web2py\gluon\packages\dal\pydal\base.py", line 
599, in lazy_define_table
table = table_class(self, tablename, *fields, **args)
  File 
"C:\Users\carlos.costa\Downloads\web2py\gluon\packages\dal\pydal\objects.py", 
line 351, in __init__
field.bind(self)
  File 
"C:\Users\carlos.costa\Downloads\web2py\gluon\packages\dal\pydal\objects.py", 
line 1633, in bind
'Field %s is already bound to a table' % self.longname)
ValueError: Field tabela.campo is already bound to a table



Em segunda-feira, 10 de julho de 2017 18:40:08 UTC-3, Massimo Di Pierro 
escreveu:
>
> 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-17 Thread Leonel Câmara
Vince that seems like a bug in the way you updated web2py you seem to be 
using the old DAL.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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-17 Thread vince
i download 
from https://mdipierro.pythonanywhere.com/examples/static/web2py_src.zip

on first line of changelog it's 2.15.0b1

and when i run web2py.py error as below

Traceback (most recent call last):
  File "./web2py.py", line 21, in 
import gluon.widget
  File "/home/web2py/gluon/__init__.py", line 38, in 
from .dal import DAL, Field
  File "/home/web2py/gluon/dal.py", line 19, in 
from gluon import sqlhtml
  File "/home/web2py/gluon/sqlhtml.py", line 32, in 
from pydal.helpers.methods import smart_query, bar_encode, _repr_ref, 
merge_tablemaps
ImportError: cannot import name merge_tablemaps 

-vince

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-14 Thread Dave S


On Friday, July 14, 2017 at 1:12:39 AM UTC-7, Dave S wrote:
>
>
>
> On Thursday, July 13, 2017 at 6:20:21 PM UTC-7, Dave S wrote:
>>
>>
>>
>> On Thursday, July 13, 2017 at 2:43:57 PM UTC-7, Anthony wrote:
>>>
>>> Are you saying that used to work but doesn't any longer?
>>>
>>>
>> There are 3 examples in the book at the link.  They work in 2.14.6 using 
>> -S (and I did cut-n-paste to check).
>>
>>
> They seem to work in 2.15.0b1.
>
> (Note:  the examples depend on earlier examples, starting at "Other 
> Operators".)
>

And now I can add "work in 2.15.1" to the report.

/dps
 

>
>
>
>>
>>  
>>
>>> How about db(db.table).select(max)?
>>>
>>> Anthony
>>>
>>>
>> /dps
>>
>>
> Me again.
> -d
>  
>
>>  
>>
>>> 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-14 Thread Dave S


On Thursday, July 13, 2017 at 5:17:11 PM UTC-7, 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.
>

Do we need another pull request on the book, since the examples are there? 
 (They were last edited in 2013, it appears.)

/dps
 

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


[web2py] Re: web2py 2.15.1 is OUT

2017-07-14 Thread Dave S


On Thursday, July 13, 2017 at 6:20:21 PM UTC-7, Dave S wrote:
>
>
>
> On Thursday, July 13, 2017 at 2:43:57 PM UTC-7, Anthony wrote:
>>
>> Are you saying that used to work but doesn't any longer?
>>
>>
> There are 3 examples in the book at the link.  They work in 2.14.6 using 
> -S (and I did cut-n-paste to check).
>
>
They seem to work in 2.15.0b1.

(Note:  the examples depend on earlier examples, starting at "Other 
Operators".)



>
>  
>
>> How about db(db.table).select(max)?
>>
>> Anthony
>>
>>
> /dps
>
>
Me again.
-d
 

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

[web2py] Re: web2py 2.15.1 is OUT

2017-07-13 Thread Dave S


On Thursday, July 13, 2017 at 2:43:57 PM UTC-7, Anthony wrote:
>
> Are you saying that used to work but doesn't any longer?
>
>
There are 3 examples in the book at the link.  They work in 2.14.6 using -S 
(and I did cut-n-paste to check).



 

> How about db(db.table).select(max)?
>
> Anthony
>
>
/dps

 

> 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 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 > 
> 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 Leonel Câmara
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.


[web2py] Re: web2py 2.15.1 is OUT

2017-07-13 Thread Anthony
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.


Re: [web2py] Re: web2py 2.15.1 is OUT

2017-07-13 Thread Richard Vézina
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  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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Re: web2py 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 > 
> 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.


Re: [web2py] Re: web2py 2.15.1 is OUT

2017-07-13 Thread Richard Vézina
@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  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.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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: web2py 2.15.1 is OUT

2017-07-13 Thread Anthony
On Thursday, July 13, 2017 at 1:03:31 PM UTC-4, Massimo Di Pierro wrote:
>
> @Anthony,
>
> could you provide a simple example?
>

model:

db.define_table('mytable',
Field('name'),
Field('photo', 'upload'))

controller:

def main_page():
return dict()

def form_component():
return dict(form=SQLFORM(db.mytable).process())

main_page.html view:

{{=LOAD('form_component', ajax=True)}}

With the above code, the file uploads for the db.mytable.photo field will 
now work (except in older browsers that do not support FormData). 
Previously, the way web2py.js handled Ajax form submissions (via 
jQuery.serialize) did not support file uploads, so the above code would 
fail to upload files for the db.mytable.photo field.

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

2017-07-13 Thread Massimo Di Pierro
@Anthony,

could you provide a simple example?

Massimo

On Tuesday, 11 July 2017 15:19:58 UTC-5, Anthony wrote:
>
> One new feature is that in modern browsers (that support FormData), web2py 
> Ajax components now support file uploads out of the box (no need for 
> third-party plugins).
>
> Anthony
>
> On Monday, July 10, 2017 at 5:40:08 PM UTC-4, 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-11 Thread Anthony
One new feature is that in modern browsers (that support FormData), web2py 
Ajax components now support file uploads out of the box (no need for 
third-party plugins).

Anthony

On Monday, July 10, 2017 at 5:40:08 PM UTC-4, 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.