I tested again in 3.0.8. The fix for the Exporter class in gluon/sqlhtml.py
introduced a new error:
<class 'AttributeError'> 'DAL' object has no attribute 'compute'
Version
web2py™ Version 3.0.8-stable+timestamp.2024.12.01.23.08.05
Python Python 3.11.2: /home/web2py/myappenv/bin/uwsgi (prefix:
/home/web2py/myappenv)
Traceback (most recent call last):
File "/home/web2py/myapp/gluon/restricted.py", line 214, in restricted
exec(ccode, environment)
File
"/home/web2py/myapp/applications/mgmtbonusform/controllers/target.py", line
2112, in <module>
File "/home/web2py/myapp/gluon/globals.py", line 474, in <lambda>
self._caller = lambda f: f()
^^^
File "/home/web2py/myapp/gluon/tools.py", line 4514, in f
return action(*a, **b)
^^^^^^^^^^^^^^^
File
"/home/web2py/myapp/applications/mgmtbonusform/controllers/target.py", line
2109, in export_data
raise HTTP(200, oExp.export(), **response.headers)
^^^^^^^^^^^^^
File "/home/web2py/myapp/applications/mgmtbonusform/models/utilities.py",
line 139, in export
records = self.represented()
^^^^^^^^^^^^^^^^^^
File "/home/web2py/myapp/gluon/sqlhtml.py", line 4323, in represented
field = self.rows.db[t][f]
~~~~~~~~~~~~^^^
File "/home/web2py/myapp/gluon/packages/pydal/pydal/base.py", line 776,
in __getitem__
return self.__getattr__(str(key))
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/web2py/myapp/gluon/packages/pydal/pydal/base.py", line 788,
in __getattr__
return BasicStorage.__getattribute__(self, key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'DAL' object has no attribute 'compute'
I suppose the VirtualField inserted into the Row is the problem.
Adding the original if-branch resolves it for my situation, but I am not
sure if it has other implications:
if "." not in col:
row.append(record._extra[col])
elif not self.rows.db._adapter.REGEX_TABLE_DOT_FIELD.match(col):
(t, f) = [name.strip('"') for name in col.split(".")]
row.append(record[t][f])
else:
# The grid code modifies rows.colnames, adding double quotes
# around the table and field names -- so they must be removed here.
(t, f) = [name.strip('"') for name in col.split(".")]
field = self.rows.db[t][f]
Massimo Di Pierro schrieb am Montag, 2. Dezember 2024 um 00:44:59 UTC+1:
> Can you please help test version 3.0.7. This port has been painful.
>
> On Thursday, 28 November 2024 at 03:43:13 UTC-8 [email protected] wrote:
>
>> I have a few legacy apps on web2py and I am testing them with Web2Py
>> 3.0.0 on py 3.11 (Debian 12). So far, I found two bugs:
>>
>> 1) Error in ExportClass of sqlhtml.py when using rows.setvirtualfields().
>> It appears, "_extra" is no longer used by DAL:
>> Traceback (most recent call last):
>> File "/home/web2py/myapp/gluon/packages/dal/pydal/objects.py", line
>> 166, in __getattr__
>> return self.__getitem__(k)
>> ^^^^^^^^^^^^^^^^^^^
>> File "/home/web2py/myapp/gluon/packages/dal/pydal/objects.py", line
>> 146, in __getitem__
>> raise KeyError(key)
>> KeyError: '_extra'
>>
>> During handling of the above exception, another exception occurred:
>>
>> Traceback (most recent call last):
>> [...]
>> File "/home/web2py/myapp/gluon/sqlhtml.py", line 4318, in represented
>> row.append(record._extra[col])
>> ^^^^^^^^^^^^^
>> File "/home/web2py/myapp/gluon/packages/dal/pydal/objects.py", line
>> 168, in __getattr__
>> raise AttributeError
>> AttributeError
>>
>> Changing sqlhtml.py in line 4317ff from
>>
>> * if not self.rows.db._adapter.REGEX_TABLE_DOT_FIELD.match(col):
>> row.append(record._extra[col])*
>>
>> to
>>
>>
>>
>> *if not self.rows.db._adapter.REGEX_TABLE_DOT_FIELD.match(col): (t, f)
>> = [name.strip('"') for name in col.split(".")] row.append(record[t][f])*
>>
>> resolved it for me.
>>
>>
>> 2) A second bug is triggered by redirect when a flash message is set:
>> Traceback (most recent call last):
>> File "/home/web2py/myapp/gluon/main.py", line 515, in wsgibase
>> xmlescape(response.flash).replace(b"\n", b"")
>> TypeError: replace() argument 1 must be str, not bytes
>>
>> removing the byte literal prefix fixed it.
>> Massimo Di Pierro schrieb am Montag, 18. November 2024 um 06:44:40 UTC+1:
>>
>>> While will make the transition easier, the increased overlap between the
>>> two products, means web2py (for python3) will be maintained better that it
>>> has ever been. :-)
>>>
>>> On Monday, 28 October 2024 at 19:41:50 UTC-7 [email protected] wrote:
>>>
>>>> Great, and sad news, at the same time. Web2py has been great for us.
>>>> Time to develop new projects in py4web.
>>>>
>>>> On Sunday, October 27, 2024 at 9:32:05 PM UTC-6 Massimo Di Pierro wrote:
>>>>
>>>>> web2py 2.99-beta is out on github. The next release will be 3.0.0.
>>>>>
>>>>> What changed:
>>>>> - support for python 3 only, tested on 3.11 and 3.12
>>>>> - upgraded rocket to the latest rocket3
>>>>> - upgraded yatl to the latest
>>>>> - upgraded pydal to the latest specifically the latter dropped support
>>>>> for the Google Datastore but added, limited and experimental, support for
>>>>> Google Firestore
>>>>>
>>>>> Please help me test it before release 3.0.0 stable.
>>>>>
>>>>> I am not planning further development in web2py (except for bug fixes)
>>>>> since I believe py4web is better but I will continue improve pydal,
>>>>> rocket3, and yatl which are shared between the two projects.
>>>>>
>>>>> 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 [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/web2py/00d19b6a-c1d7-4377-934a-934f787be979n%40googlegroups.com.