add 'renderText' method
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3131 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
91968a3655
commit
468f0a461a
1 changed files with 11 additions and 0 deletions
|
@ -26,6 +26,7 @@ import re
|
|||
|
||||
from zope import component
|
||||
from zope.cachedescriptors.property import Lazy
|
||||
from zope.proxy import removeAllProxies
|
||||
from zope.traversing.browser import absoluteURL
|
||||
|
||||
from loops.browser.common import BaseView
|
||||
|
@ -76,6 +77,16 @@ class ConceptView(object):
|
|||
for p in packages:
|
||||
requirements.add(p)
|
||||
|
||||
def renderText(self, text, contentType):
|
||||
typeKey = util.renderingFactories.get(contentType, None)
|
||||
if typeKey is None:
|
||||
if contentType == u'text/html':
|
||||
return util.toUnicode(text)
|
||||
return u'<pre>%s</pre>' % util.html_quote(util.toUnicode(text))
|
||||
source = component.createObject(typeKey, text)
|
||||
view = component.getMultiAdapter((removeAllProxies(source), self.request))
|
||||
return view.render()
|
||||
|
||||
|
||||
pattern = re.compile(r'[ /\?\+%]')
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue