Add a registry for configuration forms
Review Request #7827 — Created Dec. 24, 2015 and submitted
Review Board's "account pages", which are Djblets
ConfigPage
s with
dynamically determined forms have been ported to Djblets. The behaviour
for dynamically configuring a form is encapsulated in the
DynamicConfigPageMixin
and theConfigPageRegistry
. Config pages
that are to be dynamic should inherit from theDynamicConfigPageMixin
and are to be managed by a single registry; multiple registries can
manage multiple sets of configuration pages, however.
- Ran unit tests.
- Used this with an upcoming change for Review Board.
Description | From | Last Updated |
---|---|---|
All of our other errors in this form use a capital letter after the ":" (since it's often another exception's … |
chipx86 | |
You can do: CONFIG_PAGE_REGISTRY_DEFAULT_ERRORS = dict({ FORM_ALREADY_REGISTERED: ..., ..., }, **DEFAULT_ERRORS) |
chipx86 | |
It'd be nice if this went into more detail as to where/how you'd use this. |
chipx86 | |
Blank line between these. |
chipx86 | |
Trailing whitespace. |
david | |
Col: 1 W293 blank line contains whitespace |
reviewbot | |
This needs the full class path. |
chipx86 | |
Do we want to guard against registered_forms possibly being page_class.form_classes? |
chipx86 | |
Swap these. |
chipx86 | |
Typo on "djblets" |
chipx86 | |
No blank line. |
chipx86 | |
This should probably go into a little more detail on what the result is. |
chipx86 | |
Can't we just return if self._populated is False? |
chipx86 | |
Seems this would be a lot better as: for item in self._items.copy(): self.unregister(item) |
chipx86 | |
We should probably only call iter once. |
david | |
Maybe a little more detail: """... Objects using this mixin are built to have a dynamic list of forms, which … |
chipx86 | |
Two blank lines. |
chipx86 | |
I'd like to see more here about what this is for and how it's used. |
chipx86 | |
No need for this blank line. |
chipx86 | |
These should go up above the classes. Maybe put a comment above each saying what class they're for. |
chipx86 | |
No need for the blank line. |
chipx86 | |
Maybe write a bit here and with the remove function a to how this should be invoked. I assume callers … |
chipx86 | |
"it" -> "the registry as". |
chipx86 |
-
-
All of our other errors in this form use a capital letter after the ":" (since it's often another exception's error appearing after), so we should be consistent there.
We also generally have the form of
Could not register the form %(item)r: This form is already registered.
Same sort of thing below. -
You can do:
CONFIG_PAGE_REGISTRY_DEFAULT_ERRORS = dict({ FORM_ALREADY_REGISTERED: ..., ..., }, **DEFAULT_ERRORS)
-
-
-
-
-
-
-
-
-
-
-
Tool: Pyflakes Processed Files: djblets/configforms/registry.py djblets/registries/registry.py djblets/configforms/mixins.py djblets/configforms/tests.py Ignored Files: docs/djblets/coderef/index.rst Tool: PEP8 Style Checker Processed Files: djblets/configforms/registry.py djblets/registries/registry.py djblets/configforms/mixins.py djblets/configforms/tests.py Ignored Files: docs/djblets/coderef/index.rst
-
-
Tool: Pyflakes Processed Files: djblets/configforms/registry.py djblets/registries/registry.py djblets/configforms/mixins.py djblets/configforms/tests.py Ignored Files: docs/djblets/coderef/index.rst Tool: PEP8 Style Checker Processed Files: djblets/configforms/registry.py djblets/registries/registry.py djblets/configforms/mixins.py djblets/configforms/tests.py Ignored Files: docs/djblets/coderef/index.rst
-
Tool: Pyflakes Processed Files: djblets/configforms/registry.py djblets/registries/registry.py djblets/configforms/mixins.py djblets/configforms/tests.py Ignored Files: docs/djblets/coderef/index.rst Tool: PEP8 Style Checker Processed Files: djblets/configforms/registry.py djblets/registries/registry.py djblets/configforms/mixins.py djblets/configforms/tests.py Ignored Files: docs/djblets/coderef/index.rst
-
-
Maybe a little more detail:
"""... Objects using this mixin are built to have a dynamic list of forms, which can be controlled by callers. New forms can be registered on them, and existing forms unregistered. Through this, it's possible to extend a configuration page, allowing each form to load, validate, and save without the page hard-coding support for each form. Forms utilizing this mixin are expected to <whatever they're expected to do if using this mixin, such as setting a registry, and what that should be like, and how they should render it, etc.> """
We should always assume in the docs that the user has no idea what this thing is for, why they'd use it, how they'd use it, or any details whatsoever about the implementation.
-
-
-
-
-
-
Maybe write a bit here and with the remove function a to how this should be invoked. I assume callers should only call this through the mixin, and not directly?
-
-
Tool: Pyflakes Processed Files: djblets/configforms/registry.py djblets/registries/registry.py djblets/configforms/mixins.py djblets/configforms/tests.py Ignored Files: docs/djblets/coderef/index.rst Tool: PEP8 Style Checker Processed Files: djblets/configforms/registry.py djblets/registries/registry.py djblets/configforms/mixins.py djblets/configforms/tests.py Ignored Files: docs/djblets/coderef/index.rst