contents: Add rich comparisons to URLWrapper for easy sorting

There have been earlier attempts to sort categories and authors
[1,2,3], but they either sorted based on the object id [3], or only
sorted the main author and categories list.

This patch uses rich comparisons (keyed off URLWrapper.name, but
easily adjustable in subclasses) to make the objects sortable without
specifying a key for each sort.  For example, now

  {% for tag, articles in tags|sort %}

works as expected in a Jinja template.

The functools.total_ordering decorator fills in the missing rich
comparisons [4,5].

[1]: 877d454c8fa979343d4881a00977d9ac8786f178
[2]: 7f36e0ed20745c73886d96d4af303b0d858b8a53
[3]: d0ec18f4dbd623c55bdf4928ee7c363f699ef696
[4]: http://docs.python.org/2/library/functools.html#functools.total_ordering
[5]: http://docs.python.org/3/library/functools.html#functools.total_ordering
docs/themes.rst: Document URLWrapper sorting for use in Jinja templates
test_contents.py: Add URLWrapper comparison tests

The name switch between wrapper_a and wrapper_b ensures that we're not
secretly comparing some other field (e.g. id(object)).
contents: Encode Unicode locales for Python 2 in Page.__init__

Python 2.7 chokes on Unicode locales:

  $ python2.7
  >>> import locale
  >>> locale.setlocale(locale.LC_ALL, u'ja_JP.utf8')
  Traceback (most recent call last):
    ...
  ValueError: too many values to unpack

With the addition of:

  from __future__ import unicode_literals

to tests/test_contents.py in:

  commit bebb94c15be1ae7ff7ec241f6e1de5aa18556654
  Author: W. Trevor King <wking@tremily.us>
  Date:   Tue Jan 15 22:50:58 2013 -0500

    test_contents.py: Add URLWrapper comparison tests

the locale strings in TestPage.test_datetime are interpreted as
Unicode.  Rather than fixing the encoding there, this patch updates
Page to handle Unicode locales automatically.
Merge pull request #662 from wking/rich-urlwrapper-comparisons

contents: Add rich comparisons to URLWrapper for easy sorting