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

Update Image Format.classnames to be Format.classname #10987

Merged

Conversation

lb-
Copy link
Member

@lb- lb- commented Oct 3, 2023

Format.classname is the last of the classnames naming migrations, this will help Wagtail be more predictable for developers and builds on the work already done over the last year.

This usage is not fully 'public'/'documented', but I have included some upgrade considerations and a deprecation path nonetheless.


  • Do the tests still pass?
  • Does the code comply with the style guide?
  • For Python changes: Have you added tests to cover the new/fixed behaviour?
  • For new features: Has the documentation been updated accordingly?

@squash-labs
Copy link

squash-labs bot commented Oct 3, 2023

Manage this branch in Squash

Test this branch here: https://lb-cleanupupdate-classname-pro-g2ktn.squash.io

@@ -115,11 +115,11 @@ The unique key used to identify the format. To unregister this format, call `unr
**`label`**\
The label used in the chooser form when inserting the image into the `RichTextField`.

**`classnames`**\
**`classname`**\
The string to assign to the `class` attribute of the generated `<img>` tag.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These docs are really only for the args, as these are not kwargs the naming here does not matter but I thought it would be good to update nonetheless.

I have intentionally not included a changed in 5.2 note as I thought this would just cause more confusion.

@@ -25,7 +25,7 @@ class SubclassedImageFormat(Format):


register_image_format(
SubclassedImageFormat('subclassed_format', 'Subclassed Format', classnames, filter_spec)
SubclassedImageFormat('subclassed_format', 'Subclassed Format', 'image-classes object-contain', filter_spec)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just updated the example code to be more 'real world', instead of some uncleared variable classname.

@lb- lb- added this to the 5.2 milestone Oct 3, 2023
@lb-
Copy link
Member Author

lb- commented Oct 3, 2023

If it's ok, seeing as this is the last (I think) dev facing usage of classnames, I have added to 5.2 milestone.

Copy link
Contributor

@zerolab zerolab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no qualms with any of the changes. :shipit: 🌟

wagtail/images/formats.py Show resolved Hide resolved
@lb- lb- force-pushed the cleanup/update-classname-property-image-format branch from dd7df4a to 432bee3 Compare October 5, 2023 09:56
- Aligns with the naming convention set from Wagtail 4.2
- Add deprecation warnings if classnames is accessed & unit tests for this
- Update other unit tests to use the naming
@lb- lb- force-pushed the cleanup/update-classname-property-image-format branch from 432bee3 to 02c78f2 Compare October 5, 2023 09:59
@lb- lb- merged commit d6888e0 into wagtail:main Oct 5, 2023
18 of 19 checks passed
@lb- lb- deleted the cleanup/update-classname-property-image-format branch October 5, 2023 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants