I'm having trouble getting reindex_object to work inside an external method. I suspect my syntax is flawed. What I'm doing is instantiating a Catalog-aware ZClass and then attaching properties to it. I know I need to reindex after I've added properties, but it doesn't like it in the external method. (I have been able to reindex with a separate piece of DTML, but that's not ideal!) Thanks in advance--Chris def addFLSNews(newdir, newid, data, credate, workDir): """ """ # Get the actual destination object, using the this() # method, to be sure we get it in the right context.. data=processXMLEntities(data) storyText=getBody(data) # Create the new instance newob=newdir.Control_Panel.Products.FLSNewsStory.FLSNewsStory(storyText) newob._setId(newid) newdir._setObject(newid, newob) newob.title=getTitle(data) varPics=getPics(workDir, data, credate, newid, newdir) varStoryName=getStoryName(data) varByfunc=getByfunc(data) varUser=getUser(data) varAuthor=getAuthor(data) varPicID=getPicID(data) varCategory=getCategory(data) varLocality=getLocality(data) varBasket=getBasket(data) varNwords=getNwords(data) varEditionInfo=getEditionInfo(data) varSummary=getSummary(data) newob.propertysheets.FLSNewsProperties.manage_changeProperties({'PhotosList' :varPics}) newob.propertysheets.FLSNewsProperties.manage_changeProperties({'User':varUs er}) newob.propertysheets.FLSNewsProperties.manage_changeProperties({'Byline':var Author}) newob.propertysheets.FLSNewsProperties.manage_changeProperties({'StoryName': varStoryName}) newob.propertysheets.FLSNewsProperties.manage_changeProperties({'Byfunc':var Byfunc}) newob.propertysheets.FLSNewsProperties.manage_changeProperties({'PicID':varP icID}) newob.propertysheets.FLSNewsProperties.manage_changeProperties({'Category':v arCategory}) newob.propertysheets.FLSNewsProperties.manage_changeProperties({'Locality':v arLocality}) newob.propertysheets.FLSNewsProperties.manage_changeProperties({'Nwords':var Nwords}) newob.propertysheets.FLSNewsProperties.manage_changeProperties({'EditionInfo ':varEditionInfo}) newob.propertysheets.FLSNewsProperties.manage_changeProperties({'Summary':va rSummary}) newob.propertysheets.FLSNewsProperties.manage_changeProperties({'CreateDate' :credate}) newob.propertysheets.FLSNewsProperties.manage_changeProperties({'Basket':var Basket}) newob.reindex_object -- Chris Muldrow, muldrow@mac.com
I suspect first of all since it's a new object, you need to index the object first before you reindex it. So this would be: newob.index_object() Then on subsequent calls, you'll want to do: newob.reindex_object() The CatalogAware API is broken, IMHO. It should always just be "index_object" and "reindex_object" should not exist. ----- Original Message ----- From: "Chris Muldrow" <muldrow@mac.com> To: <zope@zope.org> Sent: Friday, March 30, 2001 10:55 AM Subject: [Zope] Reindex_object problem
I'm having trouble getting reindex_object to work inside an external method. I suspect my syntax is flawed. What I'm doing is instantiating a Catalog-aware ZClass and then attaching properties to it. I know I need to reindex after I've added properties, but it doesn't like it in the external method. (I have been able to reindex with a separate piece of DTML, but that's not ideal!) Thanks in advance--Chris
def addFLSNews(newdir, newid, data, credate, workDir): """ """ # Get the actual destination object, using the this() # method, to be sure we get it in the right context..
data=processXMLEntities(data) storyText=getBody(data)
# Create the new instance
newob=newdir.Control_Panel.Products.FLSNewsStory.FLSNewsStory(storyText) newob._setId(newid)
newdir._setObject(newid, newob)
newob.title=getTitle(data) varPics=getPics(workDir, data, credate, newid, newdir) varStoryName=getStoryName(data) varByfunc=getByfunc(data) varUser=getUser(data) varAuthor=getAuthor(data) varPicID=getPicID(data) varCategory=getCategory(data) varLocality=getLocality(data) varBasket=getBasket(data) varNwords=getNwords(data) varEditionInfo=getEditionInfo(data) varSummary=getSummary(data)
newob.propertysheets.FLSNewsProperties.manage_changeProperties({'PhotosList'
:varPics})
newob.propertysheets.FLSNewsProperties.manage_changeProperties({'User':varUs
er})
newob.propertysheets.FLSNewsProperties.manage_changeProperties({'Byline':var
Author})
newob.propertysheets.FLSNewsProperties.manage_changeProperties({'StoryName':
varStoryName})
newob.propertysheets.FLSNewsProperties.manage_changeProperties({'Byfunc':var
Byfunc})
newob.propertysheets.FLSNewsProperties.manage_changeProperties({'PicID':varP
icID})
newob.propertysheets.FLSNewsProperties.manage_changeProperties({'Category':v
arCategory})
newob.propertysheets.FLSNewsProperties.manage_changeProperties({'Locality':v
arLocality})
newob.propertysheets.FLSNewsProperties.manage_changeProperties({'Nwords':var
Nwords})
newob.propertysheets.FLSNewsProperties.manage_changeProperties({'EditionInfo
':varEditionInfo})
newob.propertysheets.FLSNewsProperties.manage_changeProperties({'Summary':va
rSummary})
newob.propertysheets.FLSNewsProperties.manage_changeProperties({'CreateDate'
:credate})
newob.propertysheets.FLSNewsProperties.manage_changeProperties({'Basket':var
Basket})
newob.reindex_object
-- Chris Muldrow, muldrow@mac.com
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
I actually tried the newob.reindex_object(), too, with no luck. It's automatically indexing the object when I first instantiate it--I can search my catalog and see the object. Do you think I still need to do the index_object() again?
From: "Chris McDonough" <chrism@digicool.com> Date: Fri, 30 Mar 2001 11:48:56 -0500 To: "Chris Muldrow" <muldrow@mac.com>, <zope@zope.org> Subject: Re: [Zope] Reindex_object problem
I suspect first of all since it's a new object, you need to index the object first before you reindex it.
So this would be:
newob.index_object()
Then on subsequent calls, you'll want to do:
newob.reindex_object()
The CatalogAware API is broken, IMHO. It should always just be "index_object" and "reindex_object" should not exist.
----- Original Message ----- From: "Chris Muldrow" <muldrow@mac.com> To: <zope@zope.org> Sent: Friday, March 30, 2001 10:55 AM Subject: [Zope] Reindex_object problem
participants (2)
-
Chris McDonough -
Chris Muldrow