Skip to content

Commit 8c26e91

Browse files
committed
code styling and suggestions
1 parent bd95219 commit 8c26e91

File tree

4 files changed

+30
-26
lines changed

4 files changed

+30
-26
lines changed

docs/backend/fields.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,22 +148,20 @@ With `plone.autoform` and `plone.supermodel` we can use directives to add inform
148148
By default, fields are included in the form regardless of the user's permissions.
149149
Fields can be protected using the `read_permission` and `write_permission` directives.
150150
The read permission is checked when the field is in display mode, and the write permission is checked when the field is in input mode.
151-
The permission should be given with its Zope 3-style name (i.e. cmf.ManagePortal rather than 'Manage portal').
151+
The permission should be given with its Zope 3-style name (such as `cmf.ManagePortal` instead of `Manage portal`).
152152

153-
In this example, the `secret` field is protected by the
154-
`cmf.ManagePortal` permission as both a read and write permission.
155-
This means that in both display and input modes, the field will
156-
only be included in the form for users who have that permission:
153+
In this example, the `secret` field is protected by the `cmf.ManagePortal` permission as both a read and write permission.
154+
This means that in both display and input modes, the field will only be included in the form for users who have that permission:
157155

158156
```python
159157
from plone.supermodel import model
160158
from plone.autoform import directives as form
161159

162160
class IMySchema(model.Schema):
163-
form.read_permission(secret='cmf.ManagePortal')
164-
form.write_permission(secret='cmf.ManagePortal')
161+
form.read_permission(secret="cmf.ManagePortal")
162+
form.write_permission(secret="cmf.ManagePortal")
165163
secret = schema.TextLine(
166-
title = u'Secret',
164+
title = u"Secret",
167165
)
168166
```
169167

docs/backend/schemas.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,10 @@ Note this won't have behavior fields added to it at this stage, only the fields
224224
With `plone.autoform` and `plone.supermodel` we can use directives to add information to the schema fields.
225225

226226

227-
### Omitting fields
227+
### Omit fields
228228

229229
A field can be omitted entirely from all forms, or from some forms, using the `omitted` and `no_omit` directives.
230-
In this example, the `dummy` field is omitted from all forms, and the `edit_only` field is omitted from all forms except those that provide the IEditForm interface:
230+
In this example, the `dummy` field is omitted from all forms, and the `edit_only` field is omitted from all forms except those that provide the `IEditForm` interface:
231231

232232
```{code-block} python
233233
:emphasize-lines: 7,12,13
@@ -239,15 +239,15 @@ from plone.autoform import directives as form
239239
240240
class IMySchema(model.Schema):
241241
242-
form.omitted('dummy')
242+
form.omitted("dummy")
243243
dummy = schema.Text(
244244
title=u"Dummy"
245245
)
246246
247-
form.omitted('edit_only')
248-
form.no_omit(IEditForm, 'edit_only')
247+
form.omitted("edit_only")
248+
form.no_omit(IEditForm, "edit_only")
249249
edit_only = schema.TextLine(
250-
title = u'Only included on edit forms',
250+
title = u"Only included on edit forms",
251251
)
252252
```
253253

@@ -272,7 +272,7 @@ In supermodel XML, this can be specified as:
272272
`form:omitted` may be either a single boolean value, or a space-separated list of form_interface:boolean pairs.
273273

274274

275-
### Re-ordering fields
275+
### Reorder fields
276276

277277
A field's position in the form can be influenced using the `order_before` and `order_after` directives.
278278
In this example, the `not_last` field is placed before the `summary` field even though it is defined afterward:
@@ -292,15 +292,15 @@ class IMySchema(model.Schema):
292292
readonly=True
293293
)
294294
295-
form.order_before(not_last='summary')
295+
form.order_before(not_last="summary")
296296
not_last = schema.TextLine(
297297
title=u"Not last",
298298
)
299299
```
300300

301-
The value passed to the directive may be either '*' (indicating before or after all fields) or the name of another field.
302-
Use `'.fieldname'` to refer to field in the current schema or a base schema.
303-
Prefix with the schema name (e.g. `'IDublinCore.title'`) to refer to a field in another schema.
301+
The value passed to the directive may be either `*` (indicating before or after all fields) or the name of another field.
302+
Use `.fieldname` to refer to field in the current schema or a base schema.
303+
Prefix with the schema name (e.g. `IDublinCore.title`) to refer to a field in another schema.
304304
Use an unprefixed name to refer to a field in the current or the default schema for the form.
305305

306306
In supermodel XML, the directives are called `form:before` and `form:after`.
@@ -345,7 +345,7 @@ class IMySchema(model.Schema):
345345
)
346346
```
347347

348-
In supermodel XML fieldsets are specified by grouping fields within a `<fieldset>` tag:
348+
In supermodel XML, fieldsets are specified by grouping fields within a `<fieldset>` tag:
349349

350350
```xml
351351
<fieldset name="extra" label="Extra info">

docs/backend/widgets.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ The main widgets are:
6565

6666
(backend-widgets-fields-display-label)=
6767

68-
## Changing a field's display mode
68+
## Change a field's display mode
6969

7070
A field's widget can be displayed in several modes:
7171

@@ -91,8 +91,8 @@ from plone.autoform import directives as form
9191
9292
class IMySchema(model.Schema):
9393
94-
form.mode(secret='hidden')
95-
form.mode(IEditForm, secret='input')
94+
form.mode(secret="hidden")
95+
form.mode(IEditForm, secret="input")
9696
secret = schema.TextLine(
9797
title=u"Secret",
9898
default=u"Secret stuff (except on edit forms)"
@@ -132,7 +132,7 @@ In other words, `form:mode` may be either a single mode, or a space-separated li
132132

133133
(backend-widgets-fields-widget-label)=
134134

135-
## Changing a field's widget
135+
## Change a field's widget
136136

137137
You can change the widget that you use for a field in several ways.
138138
This section describes these methods.

docs/classic-ui/forms.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,15 @@ See the corresponding chapters to learn how to control field and widget presenta
131131

132132
```{seealso}
133133
{ref}`Field permission <backend-fields-schema-label>`
134+
```
135+
```{seealso}
134136
{ref}`Ordering, omitting, grouping <backend-schemas-directives-label>`
135-
{ref}`Changing a field's display mode <backend-widgets-fields-display-label)>`
136-
{ref}`Changing a field's widget <backend-widgets-fields-widget-label)>`
137+
```
138+
```{seealso}
139+
{ref}`Changing a field's display mode <backend-widgets-fields-display-label>`
140+
```
141+
```{seealso}
142+
{ref}`Changing a field's widget <backend-widgets-fields-widget-label>`
137143
```
138144

139145

0 commit comments

Comments
 (0)