Re: [Zope] manipulating zodb from independent database connection
Thanks Paul and Stefan, I will look into learning ZEO. I wish somebody would write a new book on the latest zope releases. I think Zope is ready for a resurge in interest. Maybe it already is happening. Grok...eggificationREST + AJAX architectures.the growing interest in web services (just what is google doing with zope?). There are lots of reasons to be getting into zope these days. Tim On 4/11/07, Stefan H. Holek <[EMAIL PROTECTED]> wrote: On 11. Apr 2007, at 07:19, Tim Nash wrote: > > I'm using zope 2.5 (matches a book I like) and doing like so: This is a *very* old release (5 years?). > >>> from ZODB import FileStorage, DB storage = FileStorage.FileStorage('Data.fs') db = DB(storage) connection = db.open() root = connection.root() > > Also, can the ZODB be altered this way on a running Zope instance? I > would like to have a script run on cron and insert objects and remove > objects from the ZODB while the zope instance application is running. > I'd like these newly inserted objects to be Zpublishable as well. To access the ZODB from separate processes you have to run ZEO. Stefan -- It doesn't necessarily do it in chronological order, though. --Douglas Adams ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] manipulating zodb from independent database connection
On 11. Apr 2007, at 07:19, Tim Nash wrote: I'm using zope 2.5 (matches a book I like) and doing like so: This is a *very* old release (5 years?). >>> from ZODB import FileStorage, DB storage = FileStorage.FileStorage('Data.fs') db = DB(storage) connection = db.open() root = connection.root() Also, can the ZODB be altered this way on a running Zope instance? I would like to have a script run on cron and insert objects and remove objects from the ZODB while the zope instance application is running. I'd like these newly inserted objects to be Zpublishable as well. To access the ZODB from separate processes you have to run ZEO. Stefan -- It doesn't necessarily do it in chronological order, though. --Douglas Adams ___ Zope maillist - Zope@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 )
Re: [Zope] manipulating zodb from independent database connection
On Tue, Apr 10, 2007 at 10:19:43PM -0700, Tim Nash wrote: > Does anybody have a script available that shows how to insert objects > into the ZODB root['Application'] from a non-zope process outside the > Zope application? Everytime I try to read root['Application'] I get a > page template error. > > I'm using zope 2.5 (matches a book I like) You can do whatever you like, but you're not likely to find many people still running 2.5 on this list... so you might get less useful help than you would like. > and doing like so: > > >>> from ZODB import FileStorage, DB > >>>storage = FileStorage.FileStorage('Data.fs') > >>>db = DB(storage) > >>>connection = db.open() > >>>root = connection.root() > > Also, can the ZODB be altered this way on a running Zope instance? Not with FileStorage. Only one process at a time can open a FileStorage. If you would use ZEO instead, then it would be possible. Your code above would then be modified to use ClientStorage instead of FileStorage. But I don't know exactly what the code would look like in zope 2.5, I haven't run that version in years. I vaguely remember needing a custom_zodb.py file to set up ClientStorage. If you would upgrade to a more recent Zope (2.7 or later), then ZEO is available out of the box just by uncommenting some lines in the example zope.conf. And you would also get a script at bin/zopectl that's perfect for this kind of job. Your own script would be invoked as an argument to zopectl, like: ./bin/zopectl run path/to/my/script ... and you would get the root application automatically set up for you and bound as "app". But you still need to use ZEO. -- Paul Winkler http://www.slinkp.com ___ Zope maillist - Zope@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 )