Skip to content

Commit 8dab05d

Browse files
Apply all suggestions from Steve's code review
Co-authored-by: Steve Piercy <[email protected]>
1 parent 6e7bf58 commit 8dab05d

File tree

1 file changed

+30
-27
lines changed

1 file changed

+30
-27
lines changed

docs/backend/upgrading/version-specific-migration/upgrade-to-60.md

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,9 @@ These are the needed changes:
337337
</property>
338338
```
339339

340-
- Search for any left-overs of `collective.dexteritytextindexer` in your code and replace it.
340+
- Search for any leftovers of `collective.dexteritytextindexer` in your code and replace it.
341341

342-
The inline upgrade to Plone will replace the two versions of the old behavior with the new one in all content types.
342+
The in-place upgrade to Plone will replace the two versions of the old behavior with the new one in all content types.
343343

344344
```{seealso}
345345
[plone/Products.CMFPlone issue #2780](https://github.com/plone/Products.CMFPlone/issues/2780)
@@ -353,17 +353,17 @@ The inline upgrade to Plone will replace the two versions of the old behavior wi
353353
Within the Plone code base there are circular dependencies.
354354
Package A uses package B and package B uses package A.
355355
Specifically, `Products.CMFPlone` is the main package of Plone where everything comes together.
356-
It depends on a lot of Plone packages.
356+
`Products.CMFPlone` depends on a lot of Plone packages.
357357
But these packages often import code from `Products.CMFPlone`.
358-
This is done in such a way that it works, but it creates an unclear situation and makes it hard to debug errors when there is an error in this implicit dependency chain.
358+
This is done in such a way that it works, but it creates an unclear situation and makes it hard to debug errors when they occur in this implicit dependency chain.
359359

360360
The solution in Plone 6.0 was to create a package called `plone.base`.
361361
Some often used code from `Products.CMFPlone` and other packages was moved here.
362362
Backwards compatibility imports were kept in place, so this should not cause any breakage in add-ons.
363363
You *will* get warnings in your logs, unless you have silenced them.
364364
For example when your code has `from Products.CMFPlone.utils import base_hasattr` you will see:
365365

366-
```
366+
```console
367367
DeprecationWarning: base_hasattr is deprecated.
368368
Import from plone.base.utils instead (will be removed in Plone 7)
369369
```
@@ -394,9 +394,9 @@ except ImportError:
394394

395395
## Support for modern image scales
396396

397-
In Plone 5.2 these image scales were available, with scale name, width and height:
397+
In Plone 5.2 the following image scales were available, with scale name, width, and height:
398398

399-
```
399+
```text
400400
large 768:768
401401
preview 400:400
402402
mini 200:200
@@ -408,7 +408,7 @@ listing 16:16
408408

409409
Plone 6.0 changes them:
410410

411-
```
411+
```text
412412
huge 1600:65536
413413
great 1200:65536
414414
larger 1000:65536
@@ -423,14 +423,14 @@ listing 16:16
423423
```
424424

425425
- The biggest scale now has a width of 1600 instead of 768.
426-
- The 'large' scale was made slightly bigger: from 768 to 800.
427-
- All scales above 'mini' have a height of 65536.
426+
- The `large` scale was made slightly bigger: from 768 to 800.
427+
- All scales above `mini` have a height of 65536.
428428
This does not mean you get an extremely high image.
429429
It means only the width is taken into account when resizing the image.
430430
This is a better fit for most modern themes.
431431

432432
```{note}
433-
The standard Plone upgrade only adds the completely new scales: huge, great, larger, teaser.
433+
The standard Plone upgrade only adds the completely new scales: `huge`, `great`, `larger`, and `teaser`.
434434
It leaves the other scales untouched.
435435
This is to avoid strange differences between old and new images.
436436
For example, old images would otherwise have a large scale with width 768, where for new images this would be width 800.
@@ -443,29 +443,29 @@ For example, old images would otherwise have a large scale with width 768, where
443443

444444
(v60-pre-scaling-label)=
445445

446-
## Image pre scaling
446+
## Image pre-scaling
447447

448-
In Plone 6, we have made a split between generating a url for an image scale and actually scaling the image.
448+
In Plone 6, we have made a split between generating a URL for an image scale and actually scaling the image.
449449
Why would you want this?
450450

451-
As an add-on author you create a template and you want to show an uploaded image with the preview scale.
451+
As an add-on author, you create a template and you want to show an uploaded image with the preview scale.
452452
The code would be like this:
453453

454-
```
454+
```xml
455455
<img tal:define="images context/@@images"
456456
tal:replace="structure python:images.tag('image', scale='preview')" />
457457
```
458458

459459
In Plone 5 this creates a scale of the image, using the Pillow imaging library.
460460
In Plone 6, the scaled image is not yet created at this point.
461-
The scaled image is only created when (if) the browser actually requests the image.
461+
The scaled image is only created when the browser actually requests the image.
462462

463463
This is good, because for various reasons, the browser may never actually ask for this scaled image.
464464
For example, the browser may be on a mobile phone with the images turned off to prevent using costly band width.
465465
Also, when the tag contains source sets for HiDPI or picture variants, the browser may see five possible images and only choose to download one of them.
466466

467-
In Plone 6, when generating a tag for in this case the preview scale, a unique url is generated, and information for this scale is pre-registered.
468-
Only when the browser requests the scaled image at this url, does Plone generate the scale.
467+
In Plone 6, when generating a tag for, as in this case, the `preview` scale, a unique URL is generated, and information for this scale is pre-registered.
468+
Only when the browser requests the scaled image at this URL, does Plone generate the scale.
469469
This avoids generating image scales that never get used.
470470

471471
This performance improvement makes two other image improvements possible.
@@ -491,7 +491,7 @@ Alternatively, you can explicitly use the new `pre` argument, but this will fail
491491

492492
```{note}
493493
There now is an image test page that shows several scales of an image, in various modes.
494-
In your browser to to an image and add `/@@images-test` to the end of the url.
494+
In your browser, go to an image, and add `/@@images-test` to the end of the URL.
495495
```
496496

497497
```{seealso}
@@ -522,23 +522,26 @@ But if you want to use the responsive image support, you should use the `picture
522522

523523
## Store image scale info in catalog metadata
524524

525-
When you add or edit an image, Plone 6 pre-registers all scales and stores info about them in the portal catalog.
526-
The catalog brain of an image then has all the needed information about each scale, especially the unique url and the width and height.
527-
This is used on lists of images to be able show a scale in a tag without waking up the image objects from the database.
528-
In other words: this speeds up pages that contain lots of images.
525+
When you add or edit an image, Plone 6 pre-registers all scales and stores information about them in the portal catalog.
526+
The catalog brain of an image then has all the needed information about each scale, especially the unique URL, width, and height.
527+
This is used on lists of images to be able to show a scale in a tag without waking up the image objects from the database.
528+
In other words, this speeds up pages that contain lots of images.
529529

530-
Add-on authors do not have to change anything: this happens automatically.
530+
Add-on authors do not have to change anything, as this happens automatically.
531531
If you have a very special use case, you can influence this with some new adapters.
532532

533533
```{note}
534-
When upgrading your Plone Site to Plone 6.0, the inline migration finds all images in your site.
534+
When upgrading your Plone Site to Plone 6.0, the in-place migration finds all images in your site.
535535
It then adds the scale information to the catalog.
536536
This may take a long time.
537537
You can disable this with an environment variable:
538-
`export UPDATE_CATALOG_FOR_IMAGE_SCALES=0`
539-
In that case, you are advised to add the `image_scales` column manually to the catalog later.
538+
539+
```shell
540+
export UPDATE_CATALOG_FOR_IMAGE_SCALES=0
540541
```
541542

543+
In that case, you are advised to add the `image_scales` column manually to the catalog later.
544+
542545
```{seealso}
543546
[plone/plone.app.upgrade PR 292](https://github.com/plone/plone.app.upgrade/pull/292)
544547
```

0 commit comments

Comments
 (0)