Skip to content
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

Deprecate the Record.contents property #1114

Merged
merged 2 commits into from Mar 8, 2023

Conversation

dairiki
Copy link
Contributor

@dairiki dairiki commented Mar 3, 2023

This PR issues DeprecationWarnings if the Record.contents (or Attachment.contents) property is accessed. It also deprecates the use of the FileContents class.

The Page.contents and Attachment.contents properties return FileContents instances. These purport to provide a way to read the contents of the source files for the (metadata) of pages and attachments, as well as various checksums, etc. Since the initial comment in the current repo, none of the above have ever been used in Lektor's code.

When alts are in use, the properties are broken. When alts are in use, the metadata for each record comes from (potentially) multiple .lr files. Since there is no single file whose contents should be returned, it's not at all clear what the semantics of the .contents property should be in this case. See #1026 for more on this.

Issue(s) Resolved

Declares #1026 a "won't fix".

Related Issues / Links

This PR depends on (and is stacked on) PR #1113.

See #1026

Discussion/Alternatives

Just delete these instead of deprecating first?

@dairiki dairiki added this to the 3.4 milestone Mar 8, 2023
@dairiki dairiki force-pushed the refactor.deprecate-record-contents branch from 0dbb318 to ccc9823 Compare March 8, 2023 23:00
@dairiki dairiki merged commit fcf9813 into lektor:master Mar 8, 2023
@dairiki dairiki deleted the refactor.deprecate-record-contents branch March 8, 2023 23:11
dairiki added a commit to dairiki/lektor that referenced this pull request Sep 11, 2023
* feat: add name and stacklevel parameters to deprecated decorator

* refactor: deprecate Record.contents and FileContents
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.

None yet

1 participant