#1963: Pages of quickstarted TG 1.1 app do not validate
-------------------------+--------------------------------------------------
 Reporter:  chrisz       |        Owner:  chrisz  
     Type:  defect       |       Status:  reopened
 Priority:  high         |    Milestone:  1.1     
Component:  TurboGears   |      Version:  1.1 HEAD
 Severity:  major        |   Resolution:          
 Keywords:  needs tests  |  
-------------------------+--------------------------------------------------
Comment (by chrisz):

 There are actually two separate issues:

   a) Having appropriate default doctypes for different formats (must have)

   b) Additionally, allow full flexibility to have a doctype different from
 the default for a particular controller (nice to have)

 Regarding a)

 We could allow setting `default_encoding` as a mapping from format names
 to doctype names. The default value for this mapping could be simply
 {{{
 'html': 'html', 'xhtml': 'xhtml'
 }}}
 Then the code in ``_get_render_options`` could be changed to:
 {{{
     if self.default_doctype and not fragment:
         if isinstance(self.default_doctype, dict):
             if format in self.default_doctype:
                 kwargs['doctype'] = self.default_doctype[format]
         else:
             kwargs['doctype'] = self.default_doctype
 }}}

 Regarding b)

 three ideas how this could be solved:

 1) We could add an optional `option` keyword parameter with default None
 to the Buffet render() method and then do something like:
 {{{
     if options:
         kwargs.update(options)
 }}}
 This would allow overriding any option, including the doctype, at render
 time. Unfortunately, though I don't understand why, the standard Buffet
 interface does not include any such optional parameters. So we would not
 comply 100% with the standard.

 2) We could somehow pass the docstring along with the format, e.g.
 separated by a blank or as a tuple. This is similar to how !TurboKid
 passes the Kid-specific output format parameter.

 3) We could pass additional parameters along with the template name in URL
 query parameter notation, as breve does (see
 [http://github.com/cwells/breve/blob/master/breve/plugin/buffet.py here]).

 Or maybe all of this is not needed, since as a workaround you can pass an
 instantiated serializer, like this:
 {{{
 from genshi.output import XHTMLSerializer
 format = XHTMLSerializer(doctype='xhtml-transitional')
 }}}
 If this is an acceptable workaround for b) (haven't tested it yet), we
 just need to document it properly.

-- 
Ticket URL: <http://trac.turbogears.org/ticket/1963#comment:21>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to