[Zope3-Users] reST for content editors
mdudzikml at gmail.com
Fri Nov 25 20:04:44 EST 2005
On Fri, 25 Nov 2005 17:15:24 -0600, "Brad Allen" <brad at allendev.com>
> I'd prefer to allow content editors on my site to avoid having to
> type HTML, and have heard that reST might be a good, wiki-like
> choice. However, it's not clear to me how to get that working with
> ZPT content insertions. Would I need to build a new content class for
> this, or is there some easier way?
When a similar issue came up for me, all I did was add an additional
type field to the content object then created a "render" method in the
view, something like this for a 'description' field:
# for rest, self.context.descriptiontype would be 'zope.source.rest'
source = zapi.createObject(None,self.context.descriptiontype,
textview = zapi.getView(source,'',self.request)
html = view.render()
And then just used "view/renderdescription" in my templates.
On grepping the zope codebase quickly, it looks like the more "modern"
way to do this would be to use getMultiAdapter like:
source = zapi.createObject(type,text)
renderer = zapi.getMultiAdapter((source, self.request))
I have no idea why I have an extra 'None' argument in my code, above
See zope/app/preference/browser.py for an example
More information about the Zope3-users