Skip to content

Commit 9d904ec

Browse files
committed
Linkcheck
1 parent 280de29 commit 9d904ec

File tree

3 files changed

+72
-79
lines changed

3 files changed

+72
-79
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,8 @@ You can try the following to have an upgrade without downtime.
483483

484484
- You can try to leverage the ZRS replication protocol, where the secondary server has the converted data.
485485
It would probably be a trivial change to ZRS to get this to work.
486-
- There is a [ZRS equivalent for Relstorage](https://www.newtdb.org/en/latest/topics/following.html).
487-
486+
- There is a [ZRS equivalent for Relstorage](https://web.archive.org/web/20181014191206/https://www.newtdb.org/en/latest/topics/following.html).
487+
Its repository is at https://github.com/newtdb/db.
488488

489489
## Further reading
490490

docs/classic-ui/layers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ The changes to add-on layers are applied only when add-ons are installed or unin
173173
```
174174

175175
```{seealso}
176-
https://pypi.python.org/project/plone.browserlayer
176+
https://pypi.org/project/plone.browserlayer/
177177
```
178178

179179

docs/classic-ui/views.md

Lines changed: 69 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
22
myst:
33
html_meta:
4-
"description": "Rendering HTML pages in Plone using the Zope view pattern"
4+
"description": "Rendering HTML pages in Plone using the Zope view pattern."
55
"property=og:description": "Rendering HTML pages in Plone using the Zope view pattern."
6-
"property=og:title": "Views"
6+
"property=og:title": "Views in Plone 6"
77
"keywords": "views, browser view, templates, plonecli, acquisition, permissions, content, slots, Zope, Plone"
88
---
99

1010
(classic-ui-views-label)=
1111

1212
# Views
1313

14-
`Views` are the basic elements of modern Python web frameworks.
15-
A view runs code to setup Python variables for a rendering template.
14+
Views are the basic elements of modern Python web frameworks.
15+
A {term}`view` runs code to set up Python variables for a rendering template.
1616
The output is not limited to HTML pages and snippets, but may contain {term}`JSON`, file download payloads, or other data formats.
1717

1818
Views are usually a combination of:
@@ -32,13 +32,13 @@ Views are usually a combination of:
3232
}
3333
```
3434

35-
Templates should kept simple.
35+
Templates should be kept simple.
3636
Logic should be kept in a separate Python file.
3737
This enhances readability and makes components more reusable.
3838
You can override the Python logic, the template file, or both.
3939

40-
When you are working with Plone, the most common view type is `BrowserView` from the package [Products.Five](https://github.com/zopefoundation/Zope/blob/master/src/Products/Five/doc/manual.txt).
41-
Other view types include `DefaultView` from [plone.dexterity](https://github.com/plone/plone.dexterity/blob/master/plone/dexterity/browser/view.py) and `CollectionView` from [plone.app.contenttypes](https://github.com/plone/plone.app.contenttypes/blob/master/plone/app/contenttypes/browser/collection.py).
40+
When you work with Plone, the most common view type is `BrowserView` from the package [`Products.Five`](https://github.com/zopefoundation/Zope/blob/master/src/Products/Five/doc/manual.txt).
41+
Other view types include `DefaultView` from [`plone.dexterity`](https://github.com/plone/plone.dexterity/blob/master/plone/dexterity/browser/view.py) and `CollectionView` from [`plone.app.contenttypes`](https://github.com/plone/plone.app.contenttypes/blob/master/plone/app/contenttypes/browser/collection.py).
4242

4343
Each `BrowserView` class is a Python callable.
4444
The `BrowserView.__call__()` method acts as an entry point to executing the view code.
@@ -155,7 +155,7 @@ See below for comments about what the code does.
155155

156156
`name`
157157
: The name by which the view is exposed to traversal and `getMultiAdapter()` look-ups.
158-
If your view's name is `myview`, then you can render it in the browser by calling http://yourhost/site/page/@@myview.
158+
If your view's name is `myview`, then you can render it in the browser by calling `http://yourhost/site/page/@@myview`.
159159

160160
`permission`
161161
: This is the permission needed to access the view.
@@ -173,12 +173,7 @@ You need to declare the `browser` namespace in your `configure.zcml` to use `bro
173173
```
174174

175175
The view in question is registered against a {ref}`layer <classic-ui-layers-label>`.
176-
It will be available after restart, after running the {ref}`GenericSetup profile <backend-config-registry-generic-setup-label>`.
177-
178-
179-
```{todo}
180-
Fix the preceding link to "Add/remove in Site setup".
181-
```
176+
It will be available after restart, after running the {ref}`GenericSetup profile <backend-configuration-registry-generic-setup-label>`.
182177

183178

184179
(classic-ui-page-template-label)=
@@ -240,70 +235,75 @@ http://localhost:8080/Plone/news/@@my-view
240235

241236
### Template slots
242237

243-
In the generated template above, we have a fill-slot attribute, which will fill the slot with the name `content-core`, which is defined in Plone's [main_template](https://github.com/plone/Products.CMFPlone/blob/master/Products/CMFPlone/browser/templates/main_template.pt).
238+
In the generated template above, we have a `fill-slot` attribute, which will fill the slot with the name `content-core`, which is defined in Plone's [main_template](https://github.com/plone/Products.CMFPlone/blob/master/Products/CMFPlone/browser/templates/main_template.pt).
244239
The following list shows the available options for `<metal fill-slot="">` in your template.
245240

246241
```{note}
247242
Please note that our template above inherits from `<html metal:use-macro="context/main_template/macros/master">`.
248243
```
249244

250-
#### Metadata in HEAD
245+
#### Metadata in `head`
251246

252-
- `top_slot`
253-
: Used to set parameters on the request, for example to deactivate the left and right columns or caching.
254-
```
255-
<metal:block
256-
fill-slot="top_slot"
257-
tal:define="dummy python:request.set('disable_border',1);
258-
disable_column_one python:request.set('disable_plone.leftcolumn',1);
259-
disable_column_two python:request.set('disable_plone.rightcolumn',1);" />
260-
```
261-
- `head_slot`
262-
: Used to define HTML headers like link tags for RSS and CSS.
263-
- `style_slot`
264-
: Used to define style tags to load CSS files.
265-
- `javascript_head_slot`
266-
: Used to define script tags to load JavaScript in the header.
247+
`top_slot`
248+
: Used to set parameters on the request, for example to deactivate the left and right columns or caching.
249+
250+
```xml
251+
<metal:block
252+
fill-slot="top_slot"
253+
tal:define="dummy python:request.set('disable_border',1);
254+
disable_column_one python:request.set('disable_plone.leftcolumn',1);
255+
disable_column_two python:request.set('disable_plone.rightcolumn',1);" />
256+
```
257+
258+
`head_slot`
259+
: Used to define HTML `head` elements, such as `link` tags for RSS and CSS.
260+
261+
`style_slot`
262+
: Used to define `style` tags to load CSS files.
263+
264+
`javascript_head_slot`
265+
: Used to define `script` tags to load JavaScript in the HTML `head` tag.
267266

268267
```{note}
269-
Keep in mind that even though you can include CSS and JavaScript this way, most of the time you want to register it in the {rev}`Resource Registry <classic-ui-static-resources-label>`.
268+
Keep in mind that even though you can include CSS and JavaScript this way, most of the time you should register it in the {ref}`resource registry <classic-ui-static-resources-label>`.
270269
```
271270

272271
#### Global status message
273272

274-
- `global_statusmessage`
275-
: Used to fill in global status messages.
273+
`global_statusmessage`
274+
: Used to fill in global status messages.
276275

277276
#### Content slots
278277

279-
- `content`
280-
: The content area, including the title, description, content-core and viewlets around them.
278+
`content`
279+
: The content area, including the title, description, content-core and viewlets around them.
281280

282-
- `body`
283-
: A slot inside the content macro.
281+
`body`
282+
: A slot inside the content macro.
284283

285-
- `main`
286-
: Overrides the `main` slot in the main template.
287-
You must render `title` and `description` yourself.
284+
`main`
285+
: Overrides the `main` slot in the main template.
286+
You must render `title` and `description` yourself.
288287

289-
- `content-title`
290-
: `title` and `description` prerendered for Plone version 4.x or greater.
288+
`content-title`
289+
: `title` and `description` prerendered for Plone version 4.x or greater.
291290

292-
- `content-description`
291+
`content-description`
292+
: Content description for your view.
293293

294-
- `content-core`
295-
: content body specific to your view for Plone version 4.x or greater.
294+
`content-core`
295+
: Content body specific to your view for Plone version 4.x or greater.
296296

297297

298-
#### Asides / Portlets
298+
#### Asides and portlets
299299

300-
- `column_one_slot`
300+
- `column_one_slot`
301301

302-
- `portlets_one_slot`
302+
- `portlets_one_slot`
303303

304-
- `column_two_slot`
304+
- `column_two_slot`
305305

306-
- `portlets_two_slot`
306+
- `portlets_two_slot`
307307

308308

309309
(classic-ui-relationship-between-views-and-templates-label)=
@@ -413,7 +413,7 @@ And then in the template call:
413413
The Python constructor method of the view, `__init__()`, is special.
414414
You should almost never try to put your code there. Instead, use the `_call__()` method or further helper methods called from it.
415415

416-
The `__init__()` method of the view might not have an {ref}`acquisition chain <backend-traversing-label>` available, meaning that it does not know the parent or hierarchy where the view is.
416+
The `__init__()` method of the view might not have an {ref}`acquisition chain <backend-traversing-label>` available, meaning that it does not know where is its parent or hierarchy.
417417
This also means that you don't have user information and permissions for the view.
418418

419419
This information is set after the constructor has been run.
@@ -477,9 +477,9 @@ gsm.unregisterAdapter(factory=TestingRedirectHandler,
477477

478478
## Customizing views
479479

480-
To customize existing Plone core or add-on views you have different options.
480+
To customize existing Plone core or add-on views, you have different options.
481481

482-
- Usually you can simply override the related page template file (`.pt`).
482+
- Usually you can override the related page template file (`.pt`).
483483
- Sometimes you also need to change the related Python view class code.
484484
In this case, you override the Python class by using your own add-on which installs a view class replacement using an add-on specific {term}`browser layer`.
485485

@@ -488,7 +488,7 @@ To customize existing Plone core or add-on views you have different options.
488488

489489
### Overriding view template
490490

491-
The recommended approach to customize `.pt` files for Plone is to use a little helper called [z3c.jbot](https://pypi.python.org/project/z3c.jbot).
491+
The recommended approach to customize `.pt` files for Plone is to use a little helper called [`z3c.jbot`](https://pypi.org/project/z3c.jbot/).
492492

493493
If you need to override templates in core Plone or in an existing add-on, you can do the following:
494494

@@ -508,7 +508,7 @@ If you need to override templates in core Plone or in an existing add-on, you ca
508508

509509
2. Locate the template you need to override in the Plone source tree.
510510
You can do this by searching in all the installed packages for `.pt` files.
511-
If you are using buildout with the `collective.recipe.omelette` recipe, a good folder to search in is `./parts/omelette`.
511+
If you use buildout with the `collective.recipe.omelette` recipe, a good folder to search in is `./parts/omelette`.
512512

513513
The following is an example UNIX `find` command to find `.pt` files.
514514
You can also use Windows Explorer file search or similar tools:
@@ -561,7 +561,7 @@ If you need to override templates in core Plone or in an existing add-on, you ca
561561
After the file is in place, changes to the file are instantly picked up.
562562
The template code is re-read on every HTTP request.
563563

564-
If you want to override an already overridden template, read [How can I override an already overriden template by jbot?](https://stackoverflow.com/questions/16209392/2214933)
564+
If you want to override an already overridden template, read [How can I override an already overriden template by jbot?](https://stackoverflow.com/questions/16209392/how-can-i-override-an-already-overriden-template-by-jbot).
565565

566566

567567
(classic-ui-overriding-a-view-class-label)=
@@ -884,7 +884,7 @@ You can also do direct view look-ups and method calls in your template by using
884884
885885
(classic-ui-use-a-skin-based-template-in-a-five-view-label)=
886886
887-
### Use a skin-based template in a Five view
887+
### Use a skin-based template in a `Five` view
888888
889889
Use `aq_acquire(object, template_name)`.
890890
@@ -953,12 +953,12 @@ views = [ view.factory for view in views if IBlocksView.implementedBy(view.facto
953953
954954
### Default view of a content item
955955
956-
Objects have views for default, view, edit, and so on.
956+
Objects have views for `default`, `view`, `edit`, and so on.
957957
958958
The distinction between the `default` and `view` views are that, for files, the default can be `download`.
959959
960-
- The default view is configured in {ref}`backend-content-types-label`.
961-
- The default view is rendered when a content item is called.
960+
- The `default` view is configured in {ref}`backend-content-types-label`.
961+
- The `default` view is rendered when a content item is called.
962962
Even though they are objects, they have the `__call__()` Python method defined.
963963
964964
If you need to explicitly get a content item's view for page rendering, you can do it as follows:
@@ -985,16 +985,12 @@ Specifically:
985985
986986
(classic-ui-allowing-the-contentmenu-on-non-default-views-label)=
987987
988-
### Allowing the `contentmenu` on non-default views
988+
### Allow the `contentmenu` on non-default views
989989
990-
In general, the {guilabel}`contentmenu` (where the actions, display views, factory types,
991-
workflow, and other select menus are located) is not shown on non-default views.
990+
In general, the {guilabel}`contentmenu` (where the actions, display views, factory types, workflow, and other select menus are located) is not shown on non-default views.
992991
There are some exceptions, though.
993992
994-
If you want to display the {guilabel}`contentmenu` in such non-default views, you have to
995-
mark them with the `IViewView` interface from `plone.app.layout`, either by letting
996-
the class provide `IViewView` by declaring it with `zope.component.implements` or
997-
by configuring it via ZCML as follows:
993+
If you want to display the {guilabel}`contentmenu` in such non-default views, you have to mark them with the `IViewView` interface from `plone.app.layout`, either by letting the class provide `IViewView` by declaring it with `zope.component.implements` or by configuring it via ZCML as follows:
998994
999995
```xml
1000996
<class class="dotted.path.to.browser.view.class">
@@ -1005,15 +1001,14 @@ by configuring it via ZCML as follows:
10051001
10061002
(classic-ui-zope-viewpagetemplatefile-vs-five-viewpagetemplatefile-label)=
10071003
1008-
## Zope `ViewPageTemplateFile` vs. Five `ViewPageTemplateFile`
1004+
## Zope `ViewPageTemplateFile` versus `Five` `ViewPageTemplateFile`
10091005
10101006
```{warning}
10111007
There are two different classes that share the same name `ViewPageTemplateFile`.
10121008
```
10131009
10141010
- Zope [`BrowserView` source code](https://github.com/zopefoundation/zope.publisher/blob/dea3d4757390d04f6a5b53e696f08d0cab5f6023/src/zope/publisher/browser.py#L958).
1015-
- [`Five` version](https://github.com/zopefoundation/Zope/blob/d1814d0a6bddb615629b552de10e9aa5ad30a6da/src/Products/Five/browser/__init__.py#L20) with .
1016-
[`Products.Five`](https://github.com/zopefoundation/Zope/blob/master/src/Products/Five/doc/manual.txt) is a way to access some Zope 3 technologies from the Zope codebase, which is used by Plone.
1011+
- [`Five` version](https://github.com/zopefoundation/Zope/blob/d1814d0a6bddb615629b552de10e9aa5ad30a6da/src/Products/Five/browser/__init__.py#L20) with [`Products.Five`](https://github.com/zopefoundation/Zope/blob/master/src/Products/Five/doc/manual.txt) is a way to access some Zope 3 technologies from the Zope codebase, which is used by Plone.
10171012
10181013
Compare the differences in code.
10191014
@@ -1033,15 +1028,14 @@ The difference is that the `Five` version supports:
10331028
- The `provider:` TAL expression.
10341029
- Other Plone-specific TAL expression functions, such as `test()`.
10351030
- Usually, Plone code needs the `Five` version of `ViewPageTemplateFile`.
1036-
- Some subsystems, notably the `z3c.form` package, expect the Zope 3 (not Five) version of `ViewPageTemplateFile` instances.
1031+
- Some subsystems, notably the `z3c.form` package, expect the Zope 3 (not `Five`) version of `ViewPageTemplateFile` instances.
10371032
10381033
10391034
(classic-ui-views-and-automatic-member-variable-acquisition-wrapping-label)=
10401035
10411036
### Views and automatic member variable acquisition wrapping
10421037
1043-
View class instances will automatically assign themselves as a parent for all member
1044-
variables.
1038+
View class instances will automatically assign themselves as a parent for all member variables.
10451039
This is because `Five` package based views inherit from `Acquisition.Implicit` base class.
10461040
10471041
For example, say you have a content item `Basket` with an `absolute_url()` of:
@@ -1070,5 +1064,4 @@ self.obj = self.context.reference_catalog.lookupObject(value)
10701064
return self.obj.absolute_url() # Acquistion chain messed up, getPhysicalPath() fails
10711065
```
10721066
1073-
One workaround to avoid this mess is to use `aq_inner` when accessing `self.obj` values, as described in [Dealing with view implicit acquisition problems in Plone](https://stackoverflow.com/questions/11755348/2214933).
1074-
1067+
One workaround to avoid this mess is to use `aq_inner` when accessing `self.obj` values, as described in [Dealing with view implicit acquisition problems in Plone](https://stackoverflow.com/questions/11753940/dealing-with-view-implicit-acquisition-problems-in-plone/11755348#11755348).

0 commit comments

Comments
 (0)