[Zope] direct access to zodb question
Jonathan Hobbs
toolkit at magma.ca
Mon Jul 5 17:07:05 EDT 2004
From: "Chris McDonough" <chrism at plope.com>
> Errr... maybe try "from Testing import makerequest; app =
> makerequest.makerequest(app)" after app = Zope.app()..
Sweet! That did the trick!
Where the x did that wee piece of arcane knowledge come from??!!
Thanks very much!
Jonathan
> 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