forked from github/pelican
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
This commit is contained in:
parent
08a5ea6fdf
commit
61f05672e6
2 changed files with 4 additions and 4 deletions
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue