Closed moschlar closed 10 years ago
I think it's a good feature, but not one that should involve too much changes, we should try to avoid adding something too complex for a feature that the user can implement by himself in a bunch of lines of code.
the tg.flash.TGFlash class can probably be modified to use a template instead of plain string substitution and also make possible to pass a dictionary as the message instead of a string. Would that be a good enough solution? In that case we can probably manage to make something that is fully backward compatible but also makes possible to render templates inside the flash.
I'm playing around here: https://github.com/moschlar/tgext.flash
The workshop branch has a different implementation that doesn't rely anymore on webflash and supports python3, if you want to experiment there we can easily merge a proposed patch that keeps backward compatibility.
Should be TG>=2.3 compatible in https://github.com/moschlar/tgext.flash/tree/38887b6b084c3e10cd58283c4d071c9941162ab3 I only use imports which are present in <2.3 and >=2.3 .
Maybe we can merge it after some more refinements, I'll tell the mailing list about it, maybe someone has ideas ;).
I'd like to keep it available as an extension so it is usable for <2.3, too!
This is something which looks great to have but is missing some core features. Can we extend tgext.flash with the missing JS support (which is foundamental when used with caching) or should we provide a custom implementation in TurboGears itself?
See also #52
:+1:
I really would like to be able to customize the looks of the flash element, and I think using "real" templates would be the best approach (think ToscaWidgets style).
I would try to wrap it around the current implementation using
WebFlash
so that it needs to be actively activated and configured inapp_config
but would otherwise be non-disruptive to the current implementation.Are there any objections if I were to implement it and make a pull request? I.e. would you consider merging it, if it's done properly, or can I spend my time more useful? :smile: