Skip to content

Commit 6360997

Browse files
committedMay 9, 2015
advertise upgrade_metadata (cc @ralsina)
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
1 parent 5e832c2 commit 6360997

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
 

Diff for: ‎nikola/post.py

+6
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
__all__ = ['Post']
7070

7171
TEASER_REGEXP = re.compile('<!--\s*TEASER_END(:(.+))?\s*-->', re.IGNORECASE)
72+
_UPGRADE_METADATA_ADVERTISED = False
7273

7374

7475
class Post(object):
@@ -875,6 +876,7 @@ def _get_metadata_from_file(meta_data):
875876

876877
def get_metadata_from_meta_file(path, config=None, lang=None):
877878
"""Takes a post path, and gets data from a matching .meta file."""
879+
global _UPGRADE_METADATA_ADVERTISED
878880
meta_path = os.path.splitext(path)[0] + '.meta'
879881
if lang and config:
880882
meta_path = get_translation_candidate(config, meta_path, lang)
@@ -897,6 +899,10 @@ def get_metadata_from_meta_file(path, config=None, lang=None):
897899
# a 1-file post.
898900
return get_metadata_from_file(path, config, lang), newstylemeta
899901
else:
902+
if not _UPGRADE_METADATA_ADVERTISED:
903+
LOGGER.warn("Some posts on your site have old-style metadata. You should upgrade them to the new format, with support for extra fields.")
904+
LOGGER.warn("Install the 'upgrade_metadata' plugin (with 'nikola plugin -i upgrade_metadata') and run 'nikola upgrade_metadata'.")
905+
_UPGRADE_METADATA_ADVERTISED = True
900906
while len(meta_data) < 7:
901907
meta_data.append("")
902908
(title, slug, date, tags, link, description, _type) = [

0 commit comments

Comments
 (0)
Please sign in to comment.