z3c.form widgetTemplate manual override example make no sense
Nobody has claimed this yet.
- Dominant language
- Makefile
- Stars
- 106
- Forks
- 190
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 1
Description
If you look at https://github.com/plone/documentation/blob/cf62b0a919c639592e7b59c781148e8ac2d0ca0f/develop/plone/forms/z3c.form.rst there's a manual override example for not using z3c:widgetTemplate.
This the code:
class HeaderFileWidget(NamedFileWidget):
""" Subclass widget a use a custom template """
display_template = ViewPageTemplateFile("header_file_display.pt")
def render(self):
"""See z3c.form.interfaces.IWidget."""
if self.mode == DISPLAY_MODE:
# Enforce template and do not query it from the widget template factory
template = self.display_template
return NamedFileWidget.render(self)
The example is not working as template is a local var not assigned to anything. Maybe it's self.template?
Also (minor) some import at the top are deprecated/not working anymore:
- from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
+ from zope.browserpage.viewpagetemplatefile import ViewPageTemplateFile
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open develop/plone/forms/z3c.form.rst and inspect the manual widgetTemplate override example and its imports. Check the example against the current z3c.form API, correct the non-working template reference and deprecated ViewPageTemplateFile import, and verify that the documentation example is valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100