Field upload error py4web-1.20241204.1 - pydal-20250526.4

44 views
Skip to first unread message

Jacinto Parga

unread,
Jun 3, 2025, 10:38:57 AM6/3/25
to py4web
Hi, 
With a form like this:
form = Form(
        [
            Field(
                "attach",
                "upload",
                label=T("File"),
            ),
        ],
        form_name="formulario_adjuntos",
        submit_value=str(T("Submit")),
        keep_values=False,
        csrf_session=session,
        dbio=False,
    )

I get an error like: 

Traceback (most recent call last):
  File "/.../py4env/lib/python3.12/site-packages/py4web/core.py", line 1045, in wrapper
    ret = func(*func_args, **func_kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../py4env/lib/python3.12/site-packages/py4web/core.py", line 1030, in wrapper
    raise exception
  File "/home/jacinto/py4env/lib/python3.12/site-packages/py4web/core.py", line 1006, in wrapper
    context["output"] = func(*args, **kwargs)
                        ^^^^^^^^^^^^^^^^^^^^^
  File "/.../apps/_default/controllers.py", line 900, in anadir_adjunto
    form = Form(
           ^^^^^
  File "/.../py4env/lib/python3.12/site-packages/py4web/utils/form.py", line 865, in __init__
    validated_vars[field.name] = field.store(
                                 ^^^^^^^^^^^^
  File "/.../py4env/lib/python3.12/site-packages/pydal/objects.py", line 2245, in store
    elif self.db._adapter.folder:
         ^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute '_adapter'


Works fine with: 
py4web-1.20241204.1.dist-info
pydal-20241204.1.dist-info

Massimo DiPierro

unread,
Jun 3, 2025, 10:41:35 AM6/3/25
to Jacinto Parga, py4web

Is it possible you are defining the form outside of an action or @action.uses(db) is missing?


--
You received this message because you are subscribed to the Google Groups "py4web" group.
To unsubscribe from this group and stop receiving emails from it, send an email to py4web+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/py4web/d5af67ef-1faa-4a26-92ce-8c931cf1aba7n%40googlegroups.com.

Jacinto Parga

unread,
Jun 3, 2025, 2:16:52 PM6/3/25
to py4web
No, it is not missing, and it Works fine with: 
py4web-1.20241204.1
pydal-20241204.1

@action.uses(
"mytemplate.html",
db,
session,
T,
url_signer.verify(),
Inject(T=T, url_signer=url_signer),
flash,
)

Massimo

unread,
Jun 4, 2025, 2:10:42 AM6/4/25
to py4web
I think it is fixed
Reply all
Reply to author
Forward
0 new messages