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 #287 (closed task: wontfix)

Opened 13 years ago

Last modified 8 years ago

[PATCH] Subway features

Reported by: peterhunt Owned by: anonymous
Priority: normal Milestone:
Component: TurboGears Version:
Severity: normal Keywords:


Attached is a patch containing implementations of the following Subway features.

URL mapping

Rather than manually adding controllers to your RootController?, there is now an automatic way to build the controller tree:

from turbogears import controllers
class MyRoot(controllers.RootController):
    # RootController implies mount_path = "/"
    # define methods here for the site root

class MyOtherController(controllers.Controller):
    mount_path = "/other"
    # define methods here for /other/*

Automatic form filling

By passing a variable, tg_fill_form = True, in your dictionary, htmlfill will be activated and fill in any form fields with their submitted values AND handle any <form:error> tags.

Easier form validation error handling

I've added an error_html parameter to turbogears.controllers.expose(), which specifies the template to render when cherrypy.request.form_errors is not empty. You can specify different actions inside your action method by checking if cherrypy.request.form_errors is empty.

Things to come

Soon, I'll add htmlfill_schemabuilder support. But for now, check out these changes. All of these changes should be backwards-compatible. Let me know how you like them :)

Peter Hunt floydophone@…


turboway.diff Download (9.2 KB) - added by peterhunt 13 years ago.
The patch in svn diff format.

Change History

Changed 13 years ago by peterhunt

The patch in svn diff format.

comment:1 Changed 13 years ago by michele

Some comments:

URL mapping

What advantages will give us? If you hardcode the mount point in this way you wouldn't be able to mount a thirdparty class without modifing it, for example CatWalk (but also any other toolbox app) is used by the toolbox but you can easily mount it on your app tree without any modification. I would rather see an effort to push into CherryPy?/TG a full and simple to use url mapper, like Routes and the Django one but based on CherryPy?. I know you can make those complex url schemas using nested classes but then your controllers will become quite ugly and difficult to understand, that's an important topic (particulary for site that need a migration and hence url remapping), it would be nice to get at some point a cherrypy based solution that feels well integrated and not hacked, that's also one of the thing people are often complaining about ( http://www.petersblog.org/node/1075). CherryPy? 2.2 should make this easier IIRC.

Form validation error handling

Have you seen ticket #258? To me it seems a more clean/explicit approch to the problem, this error_html seems a bit too magic.

comment:2 Changed 13 years ago by anonymous

  • Summary changed from Subway features to [PATCH] Subway features

comment:3 Changed 13 years ago by kevin

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

There were several messages posted to the mailing list on these topics, but discussion failed to materialize. Without clear advantages (and a bit more discussion to show what those advantages are), I can't take this patch.

Note: See TracTickets for help on using tickets.