merge with master

This commit is contained in:
Alexis Metaireau 2012-05-06 02:43:13 +02:00
commit 8a842c0de7
2 changed files with 11 additions and 3 deletions

View file

@ -303,10 +303,12 @@ class ArticlesGenerator(Generator):
# order the categories per name # order the categories per name
self.categories = list(self.categories.items()) self.categories = list(self.categories.items())
self.categories.sort(reverse=self.settings['REVERSE_CATEGORY_ORDER']) self.categories.sort(
key=lambda item: item[0].name,
reverse=self.settings['REVERSE_CATEGORY_ORDER'])
self.authors = list(self.authors.items()) self.authors = list(self.authors.items())
self.authors.sort() self.authors.sort(key=lambda item: item[0].name)
self._update_context(('articles', 'dates', 'tags', 'categories', self._update_context(('articles', 'dates', 'tags', 'categories',
'tag_cloud', 'authors')) 'tag_cloud', 'authors'))

View file

@ -3,7 +3,6 @@
from mock import MagicMock from mock import MagicMock
import os import os
import re import re
import subprocess
from pelican.generators import ArticlesGenerator, LessCSSGenerator from pelican.generators import ArticlesGenerator, LessCSSGenerator
from pelican.settings import _DEFAULT_CONFIG from pelican.settings import _DEFAULT_CONFIG
@ -11,6 +10,7 @@ from .support import unittest, temporary_folder, skipIfNoExecutable
CUR_DIR = os.path.dirname(__file__) CUR_DIR = os.path.dirname(__file__)
class TestArticlesGenerator(unittest.TestCase): class TestArticlesGenerator(unittest.TestCase):
def test_generate_feeds(self): def test_generate_feeds(self):
@ -48,6 +48,12 @@ class TestArticlesGenerator(unittest.TestCase):
elif relfilepath == "article_without_category.rst": elif relfilepath == "article_without_category.rst":
self.assertEquals(article.category.name, 'Default') self.assertEquals(article.category.name, 'Default')
categories = [cat.name for cat, _ in generator.categories]
# assert that the categories are ordered as expected
self.assertEquals(
categories, ['Default', 'TestCategory', 'Yeah', 'test',
'yeah'])
class TestLessCSSGenerator(unittest.TestCase): class TestLessCSSGenerator(unittest.TestCase):