On Fri, 30 Mar 2007 at 15:51, Richard Harding wrote:
> iain duncan wrote:
>> On Fri, 2007-30-03 at 20:14 +0100, Nick Murdoch wrote:
>>> I was under the impression that Genshi would never support <?python ...
>>> ?> blocks.
>>>
>>> Frankly, you shouldn't need to use them (with Genshi or Kid), although
>>> admittedly it does make some things easier. I do my best not to use them
>>> though; it does rather break the concept of doing your logic in one
>>> place (controllers) and templating in another.
>>
>> The genshi guys did post on their roadmap that they would be supporting
>> it soon. I hope they didn't change their minds.
>>
>> I agree that you shouldn't need it for production sites, but it's really
>> convenient for prototyping amongst multiple coders. You can make a nice
>> python stub that pretends to be your gears site while you are breaking
>> the gears site. ;)
>>
>> Iain
>
> I don't know. It works out nice. I've setup a test site with the beta
> genshi code for .4 and I use a python block to check the current url vs.
> nav menu to highlight the current page you're on from the nav menu. It's
> display logic and makes sense to me to belong in the template vs.
> forcing me to manually enter a "current_page" I have to pass in every
> dict. from the controller.

The one place I've used a <? block so far is to compute the value of a
complex display-logic variable (a count depending on multiple conditions).
The controller doesn't, and shouldn't need to, care about the count that
the display logic needs, it is just concerned with passing in the correct
data structure for display.  The count is required only because of the
arguably weird way that html table rowspans work.  Display logic only.
Adding the "extra data" in the controller would make the controller code,
and the data structure passed to the template, uglier, and would tie
it into the display logic in a way that _breaks_ the MVC separation.
The alternative of computing the value every time I need it would make
my template much uglier and harder to maintain.

Unless there's some Kid trick I don't know for setting the value of
a variable?

--David

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to