web2py 2.99.0-beta

130 views
Skip to first unread message

Massimo Di Pierro

unread,
Oct 28, 2024, 3:32:05 AM10/28/24
to web2py-users
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


Raul Monares

unread,
Oct 29, 2024, 2:41:50 AM10/29/24
to web2py-users
Great, and sad news, at the same time. Web2py has been great for us. Time to develop new projects in py4web.

Massimo Di Pierro

unread,
Nov 18, 2024, 5:44:40 AM11/18/24
to web2py-users
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. :-)

simon...@gmail.com

unread,
Nov 28, 2024, 11:43:13 AM11/28/24
to web2py-users
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

unread,
Dec 1, 2024, 11:44:59 PM12/1/24
to web2py-users
Can you please help test version 3.0.7. This port has been painful.

simon...@gmail.com

unread,
Dec 2, 2024, 11:20:12 AM12/2/24
to web2py-users
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]
Reply all
Reply to author
Forward
0 new messages