On 2005-12-08, Michael Graham <[EMAIL PROTECTED]> wrote:
>
> How about this instead?
>
> :year:(\d{4})/:day:(\d{1,2}/:month:(\d{1,2})
That's OK, that's more like my original proposal (before I made the wiki
page). Django does something more like this. Here's some example of
their syntax:
(r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'news.views.article_detail'),
(r'^articles/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d+)/$',
'news.views.article_detail'),
The first one, without the names, is just very ugly. Our syntax would at
least be slightly less noisy. I further simplified it by removing the
extra colons:
:year(\d{4})/:day(\d{1,2})/:month(\d{1,2})
> Sure it's ugly, but at least the matching logic is all in one place.
> Plus hopefully its ugliness discourages abuse. We can even allow multi-
> line commented maps (after a fashion):
>
>
> ':year:(\d{4})', # year, e.g. 9008
> '/',
> ':day:(\d{1,2}', # day, e.g. 99
> '/',
> ':month:(\d{1,2})', # month, e.g. 72
>
> => { app => 'Blog' rm => 'by_date' },
Hmm, maybe in v2.
<thinks more>
We could just make this a "qr" thingie, and get commenting like this for
free.
But that could be slightly confusing if we are using ":" and "?" in
special ways. I don't mind the verbose syntax for declaring something
is optional.
> But if the idea is to provide more matching logic to the routing system,
> then maybe a different syntax could be used for optional parameters?
>
> ':year/?month/?day'
This would be OK too, although the question mark could begin to be
confused with the beginning of a query string in this case.
> After all, isn't one of Perl's superpowers the ability to solve problems
> with punctuation?
Yes. Punctuation is also Perl's kryptonite, so we need to be careful.
Mark
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[email protected]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]