[prev in list] [next in list] [prev in thread] [next in thread] 

List:       zope3-users
Subject:    Re: [Zope3-Users] reST for content editors
From:       "Michael Dudzik" <mdudzikml () gmail ! com>
Date:       2005-11-26 1:13:20
Message-ID: 1132967600.22336.248352376 () webmail ! messagingengine ! com
[Download RAW message or body]

I forgot the important part.

In the template, what was previously

    tal:content="view/description"

is replaced with 

    tal:replace="structure view/renderdescription"


On Fri, 25 Nov 2005 19:07:53 -0600, "Michael Dudzik"
<mdudzikml@gmail.com> said:
> 
> On Fri, 25 Nov 2005 19:04:44 -0600, "Michael Dudzik"
> <mdudzikml@gmail.com> said:
> > On Fri, 25 Nov 2005 17:15:24 -0600, "Brad Allen" <brad@allendev.com>
> > said:
> > > 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:
> > 
> > def renderdescription(self):
> >     # for rest, self.context.descriptiontype would be 'zope.source.rest'
> >     source = zapi.createObject(None,self.context.descriptiontype,
> >     self.context.description)
> >     textview = zapi.getView(source,'',self.request)
> >     html = view.render()
> 
> typo - should be:
>       html = textview.render()
> 
> >     return html
> > 
> > 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))
> >     return renderer.render()
> > 
> > I have no idea why I have an extra 'None' argument in my code, above
> > 
> > See zope/app/preference/browser.py for an example
> 
> _______________________________________________
> Zope3-users mailing list
> Zope3-users@zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic