[reportlab-users] New snippet posted: colourising code with Pygments

Marius Gedminas marius at gedmin.as
Thu Dec 17 16:37:49 EST 2009


On Thu, Dec 17, 2009 at 03:48:51PM +0000, Andy Robinson wrote:

> 2009/12/17 Marius Gedminas <marius at gedmin.as>:

> > Incidentally, how is this snippet server implemented?  Would it be hard

> > to make it use human-friendly URLs like

> >

> >    http://www.reportlab.com/snippets/11/colourising-code-with-pygments

> >

> It's standard Django so what you suggest is technically trivial.


Cool.


> 'Friendly URLs' are OK in principle as long as the original author

> chooses a good name, and does not change it. These things are highly

> likely to get linked to.


It'd still work if you ignore the friendly part and only pay attention
to the URL. Perhaps redirect to the new friendly URL if the title was
changed (or lost due to word-wrapping in emails or whatnot), so that if
the user then copies it, she'll get the up-to-date version.


> The other concern is to keep it short. I prefer URLs which can be

> read OK after being indented 2-3 times in email discussions. We're

> up to 37 chars already with a two-digit code and I am not sure if,

> say, a 30-char limit would be enough.


Good point.


> We looked at several systems.

> - ActiveState Python cookbook uses numbers only

> - Djangosnippets uses numbers only

> - Stackoverflow uses what you suggest..

>

> > For

> > serving requests, just ignore the human-friendly extra step in the URL

> > and use the '11' for identification.

>

> If someone browsed to /snippets/11/, should the browser redirect them

> to /snippets/11/colourised-python/code/ , or the other way round?


I think so: when I share URLs, I open them in the browser, then copy and
paste. If we want the friendly URL to be shared, the browser should
redirect to the canonical (friendly) version. Also, not redirecting
would make search engines think there are multiple pages, slowing down
page-rank accumulation.

Marius Gedminas
--
C++ is a loaded machine gun helpfully pointed at your feet with the safety off.
-- ChaosDiscord on Slashdot
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20091217/2ee72211/attachment-0001.pgp>


More information about the reportlab-users mailing list