1
0
Fork 0
forked from github/pelican

Addressed comments from @avaris in PR getpelican/pelican#1348

This commit is contained in:
Mark Lee 2014-05-27 11:42:37 -07:00
commit b572cbeef1
2 changed files with 7 additions and 2 deletions

View file

@ -473,7 +473,12 @@ def process_translations(content_list, order_by=None):
elif order_by == 'basename':
index.sort(key=lambda x: os.path.basename(x.source_path or ''))
elif order_by != 'slug':
index.sort(key=attrgetter(order_by))
try:
index.sort(key=attrgetter(order_by))
except AttributeError:
error_msg = ('There is no "{}" attribute in the item metadata.'
'Defaulting to slug order.')
logger.warning(error_msg.format(order_by))
return index, translations