Skip to content

new_post: log .meta path only when it exists (fix #3731) #3843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ayudh-M
Copy link

@Ayudh-M Ayudh-M commented Apr 17, 2025

Pull Request Checklist

  • I’ve read the guidelines for contributing.
  • I updated AUTHORS.txt and CHANGES.txt.
  • I ran flake8 nikola tests and pydocstyle … — no new warnings.
  • I built the demo site (nikola init -qd demosite && nikola build) and tested nikola new_post in the scenarios below.

Description — fix #3731

nikola new_post --import printed a misleading line about a “metadata” file even when the post was created in one‑file mode (or when the .meta file did not actually exist).
This tiny patch:

  • performs the duplicate‑title check more explicitly (exists_txt, exists_meta)
  • logs the .meta path only if it really exists
  • keeps the previous behaviour for two‑file posts
  • removes dead, duplicated code and satisfies flake8/pydocstyle

No functional changes beyond quieter, more accurate logging.

Testing

command expected / observed
nikola new_post --title "X" --import foo.rst (new title) post created, no error
repeat the same command The title already exists! + text‑path only
repeat with --twofile same error + text‑ and meta‑paths logged

Everything behaves as described, both with ONE_FILE_POSTS = True and False.


Kind request: this is for a university assignment due 19 April.
The patch is small (±20 lines) and isolated; even a quick “LGTM / needs X” reply would be immensely helpful for my report. Thank you very much for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant