30013fbb58636444064877ab0d6f35c2dfc0eccd
3 def replaceXMLEntities(text
) :
4 for c
, ent
in (('<', '<'), ('>', '>'), ('&', '&')) :
5 text
= text
.replace(c
, ent
)
8 from string
import maketrans
9 rmBadAttrChars
= maketrans('<&"', ' ')
11 filter = filter.split(',')
14 context
.REQUEST
.RESPONSE
.setHeader('content-type', 'text/xml; charset=utf-8')
16 for ob
in context
.listNearestFolderContents(contentFilter
={'portal_type':filter}) :
17 icon
= context
.restrictedTraverse(ob
.getIcon())
19 if not getattr(ob
, 'isPortalContent', False) :
20 state
= ob
.listNearestFolderContents(contentFilter
={'portal_type':filter}) and "-1" or "0"
21 row
= '<row id="%(id)s" url="%(url)s" icon="%(icon)s" height="%(height)d" width="%(width)d" state="%(state)s" description="%(description)s">%(title)s</row>' % {
23 'url' : ob
.absolute_url(),
24 'title' : ' '+replaceXMLEntities(ob
.title_or_id()),
25 'description' : ob
.Description().translate(rmBadAttrChars
),
26 'icon' : icon
.absolute_url(),
27 'height' : icon
.height
,