From 61f05672e651f185a6e78dc5827502ba0ff93137 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 4 Jan 2013 13:08:08 -0500 Subject: [PATCH] content: Convert StaticContent.filepath to .filename For reasons that are unclear to me, StaticContent introduces the `filepath` attribute rather than using the existing (and semantically equivalent) Page.filename. This has caused confusion before [1], and it's probably a good idea to merge the two. While I was touching the line, I also updated the string formatting in StaticGenerator.generate_output to use the forward compatible '{}'.format() syntax. [1]: https://github.com/getpelican/pelican/issues/162#issuecomment-3000363 --- pelican/contents.py | 4 ++-- pelican/generators.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pelican/contents.py b/pelican/contents.py index 43333e18..89e0397d 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -305,11 +305,11 @@ class StaticContent(object): settings = copy.deepcopy(_DEFAULT_CONFIG) self.src = src self.url = dst or src - self.filepath = os.path.join(settings['PATH'], src) + self.filename = os.path.join(settings['PATH'], src) self.save_as = os.path.join(settings['OUTPUT_PATH'], self.url) def __str__(self): - return self.filepath + return self.filename def is_valid_content(content, f): diff --git a/pelican/generators.py b/pelican/generators.py index ce102a31..664f666c 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -520,8 +520,8 @@ class StaticGenerator(Generator): # copy all StaticContent files for sc in self.staticfiles: mkdir_p(os.path.dirname(sc.save_as)) - shutil.copy(sc.filepath, sc.save_as) - logger.info('copying %s to %s' % (sc.filepath, sc.save_as)) + shutil.copy(sc.filename, sc.save_as) + logger.info('copying {} to {}'.format(sc.filename, sc.save_as)) class PdfGenerator(Generator):