Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1798 (closed defect: fixed)

Opened 11 years ago

Last modified 11 years ago

Use Pylons renderers rather than buffet

Reported by: mramm Owned by: mramm
Priority: high Milestone:
Component: TurboGears Version: trunk
Severity: normal Keywords:
Cc:

Description (last modified by mramm) (diff)

We need to stop using pylons.buffet because it's being deprecated.

Pylons now as render_gensh and render_mako functions and instructions on how to write your own renderer. We should pick up on this.

But we need a generic render function which takes an engine parameter and calls the correct renderer.

The renderers dictionary should be setup in environment.py with standard renderers setup by default.

 {'genshi':render_genshi, 'mako':render_mako'} 

Ideally we will still support the 'enginename:templatelocation" syntax from TG1, but throw a deprecation warning asking people to pass these in as separate parameters in expose.

if no engine name is passed in to @expose and they aren't declaring it using the above legacy syntax, we should use the default from the config.

which should also be setup in environment.py

Attachments

configuration.diff Download (812 bytes) - added by TimurIzhbulatov 11 years ago.
fix for setup_genshi_renderer()

Change History

comment:1 Changed 11 years ago by mramm

  • Milestone changed from 2.0 to 2.0-preview-1

comment:2 Changed 11 years ago by mramm

  • Summary changed from Stop using buffet to Use Pylons renderers rather than buffet

comment:3 Changed 11 years ago by mramm

  • Status changed from new to assigned
  • Owner changed from anonymous to mramm

comment:4 Changed 11 years ago by mramm

  • Milestone changed from 2.0-preview-1 to 2.0-preview-2

Most of the work to setup the new renderers is committed. The controller still needs to be updated to use the renderers,

However, the renderers depend on a small change in Pylons, which is post Pylons 0.9.7 beta 5, so they will not be used in TG 1.9.7 alpha 1. The tentative plan is for the next pylons release to be the release candidate, and we'll do another alpha, and switch over to the new renderers at that time.

So I'm moving this to preview-2

comment:5 Changed 11 years ago by mramm

  • Milestone changed from 2.0-preview-2 to 2.0-preview-3

Moving to preview-3 because pylons release will not happen before preview-2

comment:6 Changed 11 years ago by mramm

  • Status changed from assigned to closed
  • Resolution set to fixed
  • Description modified (diff)

A working version of this is checked in now. The genshi TemplateLoader? does not support dotted notation by default (that is only provided in the buffet plugin) so this is NOT backwards compatable with the current expose functionality. You must now provide the filename (and whatever path information is nessisary) in expose, including the .html extension. Furthermore, we're now regestring the template directory in the search path directly, so expose can be simpler. The old expose:

    @expose('testproject.templates.index')
    def index(self):
        return dict(page='index')

Should be replaced by the new expose:

    @expose('index.html')
    def index(self):
        return dict(page='index')

comment:7 Changed 11 years ago by TimurIzhbulatov

  • Status changed from closed to reopened
  • Resolution fixed deleted

setup_genshi_renderer() is broken

Changed 11 years ago by TimurIzhbulatov

fix for setup_genshi_renderer()

comment:8 Changed 11 years ago by mramm

  • Status changed from reopened to closed
  • Resolution set to fixed

comment:9 Changed 11 years ago by anonymous

  • Milestone 1.9.7a4 deleted

Milestone 1.9.7a4 deleted

Note: See TracTickets for help on using tickets.