py4web 1.20251207.1 is out

88 views
Skip to first unread message

Massimo DiPierro

unread,
Dec 7, 2025, 9:27:59 PM (9 days ago) Dec 7
to py4web
py4web 1.20251207.1 is out

- it now supports .py4web_ignore with the same syntax as .gitignore and it is used to filter files in the UI, thanks Tom
- Auth emails body can be in HTML, thanks Hadi
- we have a new pydal with pymssql support (experimental)






pe...@anewalt.com

unread,
Dec 8, 2025, 7:26:29 PM (8 days ago) Dec 8
to py4web
Massimo - just installed this version, it's been a little while since upgrading.  Using this version, I find that, in a form, the form.vars object contains less info than it used to.  It seems to only contain fields that are readable/writable.  Looking back a few versions, I see this behavior since 20251109.  form.vars in 20251012 and prior also contained fields that were not readable.  This in itself is not a problem for me, but what is causing me problems is the following:

For list:integer fields, I don't like the standard multi-select object where you have to press Ctrl and click multiple items - instead I build a select object with a scrolling list of checkboxes, which I find gives a much better user experience.  To do it, I need to add fields to the form, which I do in the template.  For example:
            <!-- skip diet widget and build a scrollable list of checkboxes instead: -->
            [[vals = form.vars['diets'] or [] ]]
            <ul class="scroller">
            [[for (k,v) in db.diets:]]
                <li><label for=[[=v]]>
                    <input type=checkbox name="diets_[[=k]]" id="[[=k]]" [[="checked" if k in vals else ""]]> [[=v]]
                </label></li>
            [[pass]]
            </ul>

In the controller, when the form is submitted, I then need to look through form.vars for fields named "diets_1", "diets_2" etc and rebuild the 'diets' value based on which ones are checked:
recipe.diets = process_diets(form)        # update our custom form item for diets
def process_diets(form):
    dietList = []
    for name, val in form.vars.items():
        if name.startswith('diets_') and val == 'on': # checkbox selected gives 'on'
            dietList.append(makeInt(name.split('-')[-1]))
    return dietList

The controller no longer sees these extra fields in form.vars.  So I need my custom fields in the form, and I need the controller to recognize them!  Is there another way that I can accomplish this?

Massimo DiPierro

unread,
Dec 9, 2025, 2:36:22 AM (8 days ago) Dec 9
to py4web
Can you try request.POST.get("diets_1"), etc? Those variables are technically your own and not managed by the form but they should be in request.POST

pe...@anewalt.com

unread,
Dec 9, 2025, 9:36:57 AM (7 days ago) Dec 9
to py4web
I was able to get them from request.forms, which I think is essentially the same thing?

Massimo DiPierro

unread,
Dec 10, 2025, 2:07:07 AM (7 days ago) Dec 10
to py4web
yes, the same.

pe...@anewalt.com

unread,
Dec 10, 2025, 10:48:24 AM (6 days ago) Dec 10
to py4web
ok, I can make it work.  But, as I work through various areas of my app, I find a lot of places where I use or check values from form.vars, and many of those values now no longer appear there.  Was this change necessary?

Massimo DiPierro

unread,
Dec 12, 2025, 8:29:14 PM (4 days ago) Dec 12
to py4web
I think this is cleaner and avoid problems down the road. Values that are not generated by the for itself should not make it into form.vars because they do not a corresponding Field that can handle it. It calls for trouble and possible vulnerabiluuties.

pe...@anewalt.com

unread,
Dec 13, 2025, 1:45:44 PM (3 days ago) Dec 13
to py4web
ok, understood.  Sounds like a considered decision which I'm sure is for the better.  My only remaining comment is that this is new behavior as of early November, and whether what I was doing was an intended use of the framework or not, it had worked for years and this caused a disruption.  As such, a heads-up or a one-liner in release notes would have been most helpful.  Thanks as always for your efforts in building and maintaining this framework.

Massimo DiPierro

unread,
Dec 13, 2025, 2:09:14 PM (3 days ago) Dec 13
to pe...@anewalt.com, py4web
I apologize for this. I did not recognize that this changes would be disruptive as I did not envision your use case. I will definitively be more careful and add a test about this.

--
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/3f7a9f0a-b64d-41dd-9e57-0907adc6a832n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages