[Zope] how to catalog an object, overiding its allowedRolesAndUsers Keyword index
Jean Baltus
jean.baltus@africamuseum.be
Mon, 28 Jul 2003 10:29:03 +0200
This is a multi-part message in MIME format.
------=_NextPart_000_000F_01C354F3.111F5CC0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Hi all,
I'm adding some items to the Catalog from an external script. The
problem is that when I do that, the allowedRolesAndUsers index of the
items is set to 'Manager' which prevents users to find them with the
search interface of CMF. Do you know how to set that index when I
catalog my items.
Here is the idea of the cataloguing script:
class Catalogabled:
pass
def catalog(self):
catalogTool = getToolByName(self, 'portal_catalog')
urlTool = getToolByName(self, 'portal_url')
db = open('somefile', 'r')
for line in db.readlines():
li = line.split('|')
newObject = Catalogabled()
newObject.id = someGeneratedId
newObject.Title = li[4]
newObject.Description = li[16]
newObject.Type = 'someType'
newObject.meta_type = 'someType'
newObject.portal_type = 'someType'
newObject.SearchableText = li[4]
newObject.Creator = 'toto5'
newObject.getIcon = 'document_icon.gif'
newObject.review_state = 'published'
catalogTool.catalog_object(newObject, '%s/catalogs_view?id=%s' %(
urlTool.getPortalPath(), newObject.id))
How can I override the ['Manager'] allowedRolesAndUsers index that is
set automatically ?
Thanks in advance,
-- Jean
------=_NextPart_000_000F_01C354F3.111F5CC0
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 10 (filtered)">
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
span.EmailStyle17
{font-family:Arial;
color:windowtext;}
@page Section1
{size:595.3pt 841.9pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=3DFR-BE link=3Dblue vlink=3Dpurple>
<div class=3DSection1>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'>Hi all,</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'>I’m adding some items to the Catalog =
from an
external script. The problem is that when I do that, the =
allowedRolesAndUsers index
of the items is set to ‘Manager’ which prevents users to =
find them with
the search interface of CMF. Do you know how to set that index when I =
catalog my
items.</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'>Here is the idea of the cataloguing =
script:</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'>class Catalogabled:</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> pass</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'>def catalog(self):</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> catalogTool =3D =
getToolByName(self,
'portal_catalog')</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> urlTool =3D =
getToolByName(self, 'portal_url')</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> db =3D =
open(‘somefile’,
'r')</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> for line in =
db.readlines():</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> li =3D =
line.split('|')</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> newObject =3D =
Catalogabled()</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> newObject.id =
=3D someGeneratedId</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> newObject.Title =
=3D li[4]</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> =
newObject.Description
=3D li[16]</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> newObject.Type =
=3D 'someType’</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> =
newObject.meta_type =3D 'someType’</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> =
newObject.portal_type
=3D 'someType’</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> =
newObject.SearchableText
=3D li[4]</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> =
newObject.Creator =3D
'toto5'</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> =
newObject.getIcon =3D 'document_icon.gif'</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> =
newObject.review_state
=3D 'published'</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> =
catalogTool.catalog_object(newObject,
'%s/catalogs_view?id=3D%s' %( urlTool.getPortalPath(), =
newObject.id))</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'>How can I override the [‘Manager’] =
allowedRolesAndUsers
index that is set automatically ?</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'>Thanks in advance,</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'>-- Jean</span></font></p>
<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
lang=3DEN-GB
style=3D'font-size:12.0pt'> </span></font></p>
</div>
</body>
</html>
------=_NextPart_000_000F_01C354F3.111F5CC0--