Задать вопрос

Тел: +7 965 3737 888

474

Просмотров

2

Ответов

Switch/case tags.

Meant mostly as a demo of how to do complex block tags, here's a switch/case implementation.

It's deliberately simplistic: no default cases, no multiple values for the same case, etc. This is so that you can focus on the technique.

Pay particular attention to how both switch and case pull out their child nodes and save them for later rendering. This is a very useful technique for these types of "structured" template tags.

Вопрос полезен? Да0/Нет0
file_5002.py(3.1Кб)
None

Ответы (2):

Ответjacobian:05.07.2007
Ответ полезен? Да0/Нет0

@wiz: as I said in the description, this is deliberately simplistic; all I'm trying to do is show off a certain pattern. Added default cases is left as an exercise to the reader :)

Ответwiz:05.07.2007
Ответ полезен? Да0/Нет0

Why not default case?