On Thu, 2007-08-09 at 21:37 +0000, SmileyChris wrote: > On Aug 10, 12:16 am, Malcolm Tredinnick <[EMAIL PROTECTED]> > wrote: > > I'm not sure what the syntax would look like at the moment, but it's > > something I need to think about: it would help solve one or two i18n > > rough spots, too. > > {% alias my_url %}{% url music "rock","112" %}{% endalias %} > {{ my_url }} {{ my_url }} {{ my_url }} > > Seems simple enough.
Hmmm.. maybe, but.. One thing I like about the "with" tag is that it is scoped. Outside of the tag block, the alias had no meaning, so their was no namespace pollution. Your proposal puts the alias into the page's namespace for all time (I guess it inherits through extended templates, too). That's why I was having trouble coming up with something already: my idea of perfect would be a tag has a way to specify both what it is aliasing and what it's scope is. Without ugliness like {% with {% ... %} as foo %}. Maybe a tag like "alias" should only live in its containing "block" tag, if any. It would also be nice if there was a way to unify variable lookup aliasing and tag result aliasing, so that you don't have to think too hard about which tag to use. Having both "with" and "alias" is not ideal. It'll lead to lots of user blunders. Making something hard to use incorrectly is a good goal to aim for. This isn't something we have to solve overnight, so it's worth thinking about a bit more, I feel. Those are the rough design ideas I've have when mulling this over. Maybe I'm high, but probably not. Regards, Malcolm -- No one is listening until you make a mistake. http://www.pointy-stick.com/blog/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---