1
0
Fork 0
forked from github/pelican

readers: Add debugging logging to read_file

This commit is contained in:
W. Trevor King 2013-01-05 21:27:30 -05:00
commit 4e118eff01

View file

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import logging
import os
import re
try:
@ -35,6 +36,8 @@ from pelican.contents import Page, Category, Tag, Author
from pelican.utils import get_date, pelican_open
logger = logging.getLogger(__name__)
METADATA_PROCESSORS = {
'tags': lambda x, y: [Tag(tag, y) for tag in x.split(',')],
'date': lambda x, y: get_date(x),
@ -343,6 +346,8 @@ def read_file(base_path, path, content_class=Page, fmt=None,
path = os.path.abspath(os.path.join(base_path, path))
source_path = os.path.relpath(path, base_path)
base, ext = os.path.splitext(os.path.basename(path))
logger.debug('read file {} -> {}'.format(
source_path, content_class.__name__))
if not fmt:
fmt = ext[1:]