[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: [TurboGears] kwargs for render() Alessandro Molina Wed Feb 08 11:01:33 2012

On Wed, Feb 8, 2012 at 1:30 PM, Christoph Zwerschke <[EMAIL PROTECTED]> wrote:
> Am 08.02.2012 12:10, schrieb Alessandro Molina:
>> Now it should be possible to use all the three options:
>>   - Do not pass doctype to tg.render.render mean automatic detection
>>   - Set it to None to enforce no doctype
>>   - Set it to any string to force it if available for that content_type
> Ok, I'll add tests for all these use cases.

Should already be covered by the "test_genshi_autodoctype_*" and
"test_genshi_doctype_removal"  suite of tests, so you should be fairly
safe modifying that parts.

> We still have to clarify what takes precedence, templating.genshi.doctype
> (which was set excplicitly, but as a static value) or the doctype derived
> from response.content_type via doctypes_for_content_type.

response.content_type should have precedence but favoring the
templating.genshi.doctype option when available.
The current behavior seems quite good.
Making templating.genshi.doctype have precedence would make impossible
to be able to serve anything else apart from whatever you choose in
templating.genshi.doctype and that would prevent being able to use
genshi to generate xml documents or as a text templating system for
anything else.

> Also, maybe we should allow templating.genshi.doctype to be a dict in which
> case doctypes_for_content_type would be updated by that dict. Same for
> templating.genshi.method and methods_for_content_type.

That seems to be a good idea, it would allow to disable doctype or add
specific doctype options for custom cases.

> We could then let templating.genshi.doctype take precedence (as we currently
> do), but we shouldn't set in the quickstart templates any more so that the
> default automatic detection is active.

I would say that we currently let response.content_type have
precedence, as the doctype that you specified gets used only if it is
said to be valid for the response.content_type. Otherwise the first
valid doctype for that content_type is used. So response.content_type
can override templating.genshi.doctype, but not the opposite, which
should be a good behavior.

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