On Aug 25, 1:13 pm, Michele Comitini <michele.comit...@gmail.com>
wrote:
> why not have a dictionary?
>
> controllers = {'route-me-if-you-can': any_time_you_want}
> if lookup misses method name is searched as it is?

That would be a viable alternative to routes, except it's not
desirable to have to hand-code routes except when you want to do
something 'special' -- hyphens on the web are quickly becoming more
common then underscores.

> > Are Python restrictions relevant for applications and controllers? Or just 
> > filename restrictions? I'm not sure.

Generally speaking, no restrictions are relevant (not even filename
restrictions) except for total URL length (all typical servers have
some maximum URL length that they'll handle, as do browsers).
However, url-encoded paths (like /some%20where/over/there) are to be
avoided at all costs.  Pretty much [a-zA-Z0-9/_~.-] are the characters
that are commonly used in URLs (not counting ?, &, and = for query
strings), with strict lower-case only or camel-case both being trendy
in that order, and with hyphens showing up better underlined links
unlike underscores.

If possible, it's especially good practice provide only URLs that
users can write down easily, such as <http://myblog.com/articles/5>,
and especially favoring ones that are self descriptive, like <http://
myblog.com/articles/net-neutrality-and-you>, for obvious reasons (I
personally consider hybridized URLs like <http://myblog.com/articles/5/
net-neutrality-and-you> to be junk because there are two unique
identifiers in the URL).

Reply via email to