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 #1162 (closed enhancement: invalid)

Opened 12 years ago

Last modified 11 years ago

Generic controller method output modifying decorator

Reported by: ajones Owned by: anonymous
Priority: low Milestone:
Component: TurboGears Version: 1.0b1
Severity: minor Keywords:
Cc:

Description

I think it would be useful to have a generic decorator that examines and modifies the output of a controller method. This can be used to create decorators that inject, remove, or change the output of a controller method. I have created a sample implementation that can be viewed here:

 http://paste.turbogears.org/paste/392

Change History

comment:1 Changed 12 years ago by jorge.vargas

This sounds interesting but is it practical? in your sample usage I'll prefer to do that sorting on the db just because it's faster.

comment:2 Changed 12 years ago by ajones

  • Status changed from new to closed
  • Resolution set to invalid

At the time I wrote this, it seemed like it would turn out to be more useful than I now think it is. The whole thing started with someone asking for something similar to Rails' acts_as_voteable. This would make it easier to write a decorator that injects voting (or commenting, or versioned, etc) widgets around another widget.

The frustration that made me want to submit this though was that there is currently no middle ground between making a widget universally available and putting the code for it directly into the required controllers. Although I think that is an important point, I don't know if a decorator that would itself have to be decorated to really be useful is the right solution for this.

comment:3 Changed 11 years ago by kevin

  • Milestone __future__ deleted
Note: See TracTickets for help on using tickets.