[Zope] direct access to zodb question

Chris McDonough chrism at plope.com
Mon Jul 5 16:43:56 EDT 2004


Errr... maybe try "from Testing import makerequest; app =
makerequest.makerequest(app)" after app = Zope.app()..

On Mon, 2004-07-05 at 16:39, Jonathan Hobbs wrote:
> 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
> 
> 
> 
> 
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
> 



More information about the Zope mailing list