Hi!

I've seen there have been threads on url design before in this mailing list, but I'm facing a problem that is starting to annoy me a little, and i'm wondering if I'm doing something wrong, or this is a symptom of overly-loose url design

The fundamental issue is fastdata, using DataController. It works fine, and for those who don't know how it works, you can do:

    foo = DataController(model.SomeModel)

and then go to

/foo/

to get a list of all the rows in the SomeModel table, and then you can edit one by going to

/foo/5/edit

and add one with

/foo/add

It's all very nice and 'REST'ful.

My problems start when I want to be able to link to the 'view' screen, and then link from there to the edit screen, viz:
    <a href="edit">Edit</a>
in my template.

Viewing a row from the table can be achieved by going to any of:

/foo/5
/foo/5/
/foo/5/show

But this causes problems when you're in /foo/5 because /foo/edit is a 404.

So the fundamental problem I see is, there's what seems to be a bug in the way turbogears handles URIs, in general - in that it treats
/foo/bar
and
/foo/bar/
as being the same thing, but this is quite obviously not the case - because it causes significant problems with relative urls.

There is a ticket for this issue:

http://trac.turbogears.org/turbogears/ticket/323
http://www.cherrypy.org/wiki/ExposeAs

It seems that the best solution is to do something along the lines doing an implicit redirect to one, or the other, using a kwarg to @expose, such as:

  @expose(slash=True)
  def show(self, obj): ....

There is something mentioned about this not working for POST - only GET - but my reaction is immediately - users use GET themselves, but they never enter a POST manually. The programmer is responsible for getting the slash right for the POST case. We should just raise a 404 or a 500 or something for the missing slash/POST case.
--
Regards,
Stephen Thorne
Development Engineer

Scanned by the NetBox from NetBox Blue
(http://netboxblue.com/)

Reply via email to