multiply yatl.helpers

23 views
Skip to first unread message

Lucas

unread,
Aug 30, 2025, 10:02:52 AM (8 days ago) Aug 30
to py4web
hello one and all,

I used to be able to TD('...')*3 within TR() and it would create 3 new instances of TD and insert it into the TR(), for instance.  it was a very elegant way of writing the code.  now I have to *[TD('...') for x in range(3)] to achieve the same result.  can we put that original TD('...')*3 functionality back into the yatl.helpers?

and is it possible to add BR = TAG['br/'] or so into yatl.helpers also?  I use BR constantly.

thank you in advance.  lucas

Massimo DiPierro

unread,
Sep 1, 2025, 12:15:30 PM (6 days ago) Sep 1
to py4web
You almost can, you just need an extra set of []:

>>> str(TR(*[TD()]*3))
'<tr><td></td><td></td><td></td></tr>'

Is this acceptable?

I would prefer not to add more helpers to yatl to avoid a proliferation. Specifically the use of BR is not something I want to encourage since it is better handled with DIV display property and border-bottom.
As you can you can define [[ BR = TAG['br/']  ]] in your layout and it will be available everywhere.

Lucas

unread,
Sep 1, 2025, 8:41:58 PM (6 days ago) Sep 1
to py4web
yes, that multiplying by the list syntax is ok.  

and I have the [[BR=TAG['br/'] ]] in my layout.html and common.py because it is just easier than playing with css every minute of the day.  

there is so much rewriting from web2py that is practically like learning a new language.  I know it is faster because it is stripped down, but a lot is different.  sorry for complaining, I just have about 14 years of solid web2py code that is really quite good and functional.

Massimo DiPierro

unread,
Sep 2, 2025, 12:13:53 AM (5 days ago) Sep 2
to Lucas, py4web
Well. The templates and the dal are the same. That's all I can promise.

But definitively interested in ideas about how to make it better. Perhaps we need a more sophisticated scaffolding app.

--
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/bee23324-0106-4beb-9c1f-f56801c85d4bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages