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 #113 (closed defect: fixed)

Opened 14 years ago

Last modified 12 years ago

[PATCH] Split expose into separate decorators for processing input and output

Reported by: seancazzell@… Owned by: kevin
Priority: normal Milestone: 0.9
Component: TurboGears Version:
Severity: normal Keywords:
Cc:

Description

(See Also  Posting to TurboGears Mailing List)

I would like to propose that we break up the @expose decorator into two or more separate decorators. The current implementation of @expose has a lot of functionality in it which makes it almost impossible to use other decorators on your controller methods without breaking things.

(The reason is @expose must be the first decorator on your method so it can use inspect.getargspec on the controller method. And since @expose does the dict->template/json translation, other decorators do not get a chance to alter the dict before template/json processing.)

We can split the expose decorator into two parts - input processing and output processing. Currently, input processing includes validators and inputform - if we put these into their own decorator(s), then it would allow additional decorators to get in the middle and do useful things.

@expose(template="myproject.templates.foo")
@unpack(... validators and inputform stuff here ...)
def foo(bar):
    # ...

Attachments

split_expose.diff Download (5.1 KB) - added by seancazzell@… 14 years ago.
A quick implementation splitting expose into expose+unpack

Change History

Changed 14 years ago by seancazzell@…

A quick implementation splitting expose into expose+unpack

comment:1 Changed 14 years ago by michele

Sean, since you are working on decorator functions maybe you can take a look (if you have time) at ticket #80.

comment:2 Changed 14 years ago by anonymous

  • Owner changed from kevin to seancazzell@…

comment:3 Changed 14 years ago by seancazzell@…

  • Owner changed from seancazzell@… to anonymous

Got too busy to clean this patch up :/

comment:4 Changed 14 years ago by michele

  • Summary changed from Split expose into separate decorators for processing input and output to [PATCH] Split expose into separate decorators for processing input and output

This patch needs to be updated and finalized.

comment:5 Changed 14 years ago by kevin

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

comment:6 Changed 14 years ago by kevin

  • Status changed from assigned to closed
  • Resolution set to fixed
  • Milestone set to 0.9

I have split the decorator in [394]. The new decorator for input is called validate.

Note: See TracTickets for help on using tickets.