Re: [Zope3-Users] Access to persistent Zope tables/classes in ZODB

2006-10-28 Thread Jim Fulton

Rob J Goedman wrote:

Thanks Jim,

I had gotten to the following point (although you have now shown
me a better way to get there, I was using FileStorage):

ZODB.DB.DB object at 0x137e910
{'Application': zope.app.folder.folder.Folder object at 0x1377d70, 
'zope.app.generations': persistent.dict.PersistentDict object at 
0x1377db0}

zope.app.folder.folder.Folder object at 0x1377d70
OOBTreeItems object at 0x1386228

print f1[0].keys()[1]
Rob's buddies
print f1[0].values()[1]
buddydemo.buddy.BuddyFolder object at 0x1377f30
print f1[0].values()[1].__getitem__
bound method BuddyFolder.__getitem__ of 
buddydemo.buddy.BuddyFolder object at 0x1377f30


I don't know what to make of the above without any context.
That's fine, because I don't really have time to study any specifics.

This is where I get stuck. Been going over the sources to figure out how 
to iterate over these.


Understand that this has nothing to do with ZODB.  Whatever
application objects you use provide whatever api they do
indepenent of ZODB.


...

I did notice since I did this, bin/runzope acts differently (on this 
Zope/ZODB?).


Differently than what? In any case, I suggested that you use zopectl.
runzope is an internal implementation detail of zopectl.


 I created a new instance in 121

and transferred all applications and the new instance works fine:

Robs-Laptop:~/Projects/Zope/Zope3/One2One rob$ cd ../121/
Robs-Laptop:~/Projects/Zope/Zope3/121 rob$ runzope
--
2006-10-27T14:45:57 INFO root -- HTTP:localhost:9090 Server started.
Hostname: localhost
Port: 9090
--
2006-10-27T14:45:57 INFO root Startup time: 9.072 sec real, 8.710 sec CPU
^C

But the old instance in One2One now just seem to test:

Robs-Laptop:~/Projects/Zope/Zope3/121 rob$ cd ../One2One/
Robs-Laptop:~/Projects/Zope/Zope3/One2One rob$ runzope
--
2006-10-27T14:47:56 WARNING root Developer mode is enabled: this is a 
security risk and should NOT be enabled on production servers. Developer 
mode can be turned off in etc/zope.conf

Total: 0 tests, 0 failures, 0 errors
Robs-Laptop:~/Projects/Zope/Zope3/One2One rob$

Any idea what causes this?


No, I have no context to begin to understand it. I don't know what
121 and One2One are.

Jim

--
Jim Fulton   mailto:[EMAIL PROTECTED]   Python Powered!
CTO  (540) 361-1714http://www.python.org
Zope Corporation http://www.zope.com   http://www.zope.org
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Access to persistent Zope tables/classes in ZODB

2006-10-27 Thread Jim Fulton

Rob J Goedman wrote:
I'm wondering if there is an easy way to get to persistent objects 
created in Zope and stored in ZODB

from a python program outside Zope.


Yup.

As an example, I would like to 
iterate over created 'buddies' in buddydemo.


The easiest way is to use zopectl, which takes care of opening the
database(s) and loading the Zope configuration for you.

Interactively, use zopectl debug.  This will give
you an interactive interpreter with an app variable set to
the top-level folder.

Use zopectl run your_script to run a script with the
same app variable set and ready for use.

Of course you can use the lower-level ZODB APIs to open the database
yourself.

Note that you'll want to use ZEO if you want to open the database while the
web application is running.

Jim


--
Jim Fulton   mailto:[EMAIL PROTECTED]   Python Powered!
CTO  (540) 361-1714http://www.python.org
Zope Corporation http://www.zope.com   http://www.zope.org
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Access to persistent Zope tables/classes in ZODB

2006-10-27 Thread Rob J Goedman

Thanks Jim,

I had gotten to the following point (although you have now shown
me a better way to get there, I was using FileStorage):

ZODB.DB.DB object at 0x137e910
{'Application': zope.app.folder.folder.Folder object at 0x1377d70,  
'zope.app.generations': persistent.dict.PersistentDict object at  
0x1377db0}

zope.app.folder.folder.Folder object at 0x1377d70
OOBTreeItems object at 0x1386228

print f1[0].keys()[1]
Rob's buddies
print f1[0].values()[1]
buddydemo.buddy.BuddyFolder object at 0x1377f30
print f1[0].values()[1].__getitem__
	bound method BuddyFolder.__getitem__ of  
buddydemo.buddy.BuddyFolder object at 0x1377f30


This is where I get stuck. Been going over the sources to figure out  
how to iterate over these.


You're 2nd point, about using ZEO, is also very valid (I need to just  
read my 'buddies'  and send the
data down to a bunch of embedded Linux based controllers but the ZODB  
will be locked).


I did notice since I did this, bin/runzope acts differently (on this  
Zope/ZODB?). I created a new instance in 121

and transferred all applications and the new instance works fine:

Robs-Laptop:~/Projects/Zope/Zope3/One2One rob$ cd ../121/
Robs-Laptop:~/Projects/Zope/Zope3/121 rob$ runzope
--
2006-10-27T14:45:57 INFO root -- HTTP:localhost:9090 Server started.
Hostname: localhost
Port: 9090
--
2006-10-27T14:45:57 INFO root Startup time: 9.072 sec real, 8.710 sec  
CPU

^C

But the old instance in One2One now just seem to test:

Robs-Laptop:~/Projects/Zope/Zope3/121 rob$ cd ../One2One/
Robs-Laptop:~/Projects/Zope/Zope3/One2One rob$ runzope
--
2006-10-27T14:47:56 WARNING root Developer mode is enabled: this is a  
security risk and should NOT be enabled on production servers.  
Developer mode can be turned off in etc/zope.conf

Total: 0 tests, 0 failures, 0 errors
Robs-Laptop:~/Projects/Zope/Zope3/One2One rob$

Any idea what causes this?

Anyway, thanks again for your quick response!

Rob


On Oct 27, 2006, at 4:41 AM, Jim Fulton wrote:


Rob J Goedman wrote:
I'm wondering if there is an easy way to get to persistent objects  
created in Zope and stored in ZODB

from a python program outside Zope.


Yup.

As an example, I would like to iterate over created 'buddies' in  
buddydemo.


The easiest way is to use zopectl, which takes care of opening the
database(s) and loading the Zope configuration for you.

Interactively, use zopectl debug.  This will give
you an interactive interpreter with an app variable set to
the top-level folder.

Use zopectl run your_script to run a script with the
same app variable set and ready for use.

Of course you can use the lower-level ZODB APIs to open the database
yourself.

Note that you'll want to use ZEO if you want to open the database  
while the

web application is running.

Jim


--
Jim Fulton   mailto:[EMAIL PROTECTED]   Python Powered!
CTO  (540) 361-1714http://www.python.org
Zope Corporation http://www.zope.com   http://www.zope.org


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Access to persistent Zope tables/classes in ZODB

2006-10-26 Thread Rob J Goedman

Hi,

I'm wondering if there is an easy way to get to persistent objects  
created in Zope and stored in ZODB
from a python program outside Zope. As an example, I would like to  
iterate over created 'buddies' in buddydemo.


Thanks,
Rob
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users