Roundup Tracker - Issues

Message8554

Author rouilj
Recipients rouilj, schlatterbeck
Date 2026-10-12.20:19:32
Message-id <1791836372.88.0.630684673936.issue2551434@roundup-tracker.org>
In-reply-to
Hi Ralf:

> For some re-use in the web interface I'm not just registering
functions but also other objects.

I didn't even know that was possible. I though utils were only
functions.
I added calling things as a method to reduce the number of arguments I
needed to pass.
Is registering a string or other object as a util documented somewhere?

The registered_at data allows a useful error message (source for the
other definition)
if a util with the same name is registered twice. It took me a while to
figure out why
my new utility was doing something it shouldn't have been doing before I
added collision
detection to the util registry 8-).

Can you show me the code for registering this string and how it's used
in a template?
With this info I can try to see what options we have.

Also this python is valid:

>>> f = {}
>>> f['a'] = lambda: "foo"
>>> f['a']._stuff = "bar"

so wrapping your string in a lambda might work. Let me know if it does.
It's a (not so great) workaround for sure but ....

Maybe changing the registerUtil function to check the util type and if
it's not a callable
add the property to the util object/class without any source info would
work?

We could also roll back the diagnostic info. I would have to see how
collision detection
would work. Currently you can't register two utils under the same name.
However you can
override a util that is defined on the class.

With an example I may have other ideas (maybe even registerUtilObject()
to
join registerUtilMethod()).

Sorry I broke your stuff.

-- rouilj
History
Date User Action Args
2026-10-12 20:19:32rouiljsetmessageid: <1791836372.88.0.630684673936.issue2551434@roundup-tracker.org>
2026-10-12 20:19:32rouiljsetrecipients: + rouilj, schlatterbeck
2026-10-12 20:19:32rouiljlinkissue2551434 messages
2026-10-12 20:19:32rouiljcreate