durusmail: quixote-users: Draft of Quixote white paper
Draft of Quixote white paper
2003-06-25
2003-06-28
2003-06-30
2003-06-30
2003-06-30
2003-06-30
Draft of Quixote white paper
Jason Sibre
2003-06-28
> what's a more challenging question (for me at least) is where to hang
> the /add method when you don't have a object tree, but a layer of
> similar objects at the same depth; for example, .../appointments/1,
> /2, /3 etc.  It's obvious what .../appointments/2/edit means, but
> what .../appointments/2/add doesn't make much sense.  (Although
> .../2/copy is pretty cool.)
>
> The best I can figure is to do .../appointments/add.  Not sure how
> this fits into the pattern.

Not saying this is the best way to do it, Mark, but I recently addressed the
issue you describe by using the underscore (_) as a url placeholder
indicating a new object.  I didn't use an 'add' method, because I didn't
need one...

Using your example:
 .../appointments/_/edit  -  Means edit a new appointment object.

In _q_lookup, I would lookup an id and map it to an object (as is usual),
but if the id component was the '_', I took it to mean a new object was
being requested, so rather than load one, I initialized a new (blank) one,
and returned it.  I had to re-engineer parts of my application layer to get
that to work right, because I didn't initially plan on doing things that
way, but in the end, it works well, and eliminates the need to have seperate
edit and add forms as well.  I was using the Forms, so the same url was used
for displaying the form and saving the data.

Jason Sibre


reply