[Zope] direct access to zodb question

Jonathan Hobbs toolkit at magma.ca
Mon Jul 5 16:39:23 EDT 2004


I am trying to access the zodb directly from a python program (instead of
via an external method), in order to process large volumes of updates
(adding about 900k records to a zcatalog):

So far I have:

#!/apps/zope/bin/python
import os, sys
sys.path.append("/apps/zope/lib/python")
import Zope
app=Zope.app()


Which works fine.  I can see existing objects within a folder by:

for item in app.sw.WebSitesFolder.WebSitesMasterData.objectItems():
        print str(item)


However, when I try to create new objects (zclass instances) using:

REQUEST = app.REQUEST
REQUEST.set('id', '100')
newobj =
app.sw.WebSitesFolder.WebSitesChildData.manage_addProduct['SWV2'].WebSites.c
reateInObjectManager(REQUEST['id'], REQUEST)

I get the following error:

Traceback (most recent call last):
  File "./jhtst.py", line 14, in ?
    app.REQUEST.set('id', '100')
AttributeError: set

I have also discovered that REQUEST.get also generates an error.  Apparently
my REQUEST is not the 'normal' zope REQUEST.  When I "print str(REQUEST)" I
get:

<Special Object Used to Force Acquisition>

Does anyone have any ideas as to how to make this work!!!???

Thanks

Jonathan






More information about the Zope mailing list