RE: [Zope] reading zope.config file for ClientStorage

2005-10-11 Thread Mika, David P (Research)
OK, the opts object really did have everything loaded.  On careful inspection 
the opts.configroot has an attribute "databases" with a list of 
Zope.Startup.datatypes.ZopeDatabase instances.  I can do what I originally set 
out to do which was to open a ZEO.ClientStorage configured from the 
zope-with-zeo.conf file (the ZEO.ClientStorage is now wrapped in a ZEOClient 
object):

from Zope.Startup import options, handlers
opts = options.ZopeOptions()
opts.configfile='c:\Zope-Instance-Test\etc\zope-with-zeo.conf'
opts.load_schema()
opts.load_configfile()
for db in opts.configroot.databases:
 if is instance(db.config.storage, ZODB.config.ZEOClient):
  db.config.storage.open()

>What does your zope-with-zeo.conf file look like?

My zope-with-zeo.conf file is pretty standard except for a designation to use a 
zeoclient.  I've also included a username and password as my zeo server is 
using digest authentication:

 
   mount-point /
   
 server localhost:8090
 storage 1
 name zeostorage
 var $INSTANCE/var
 username metalfor
 password my_zeo_cleartext_password
   
 


Thanks much!
Dave Mika
___
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] reading zope.config file for ClientStorage

2005-10-10 Thread Mika, David P (Research)
I've taken a look at stepper and dug into the zope source again.  It looks like 
both are relying on a startup script akin to zopectl to marshal everything 
correctly.  I would rather not be using a startup script (besides I couldn't 
sort it out); this is what I have so far:

from Zope.Startup import options, handlers
opts = options.ZopeOptions()
opts.configfile='c:\Zope-Instance-Test\etc\zope-with-zeo.conf'
opts.load_schema()
opts.load_configfile()

unfortunately in the resulting options object, I'm not getting the stuff I need 
from the conf file, namely the ZODB storage stuff needed for ClientStorage.

The schema file that is being used by ZopeOptions is 
Zope/Startup/zopeschema.xml.  This only has a skeleton zodb_db section.  It 
looks like the meat & potatoes are in ZODB/component.xml, but I don't see how 
that is actually pulled in.

Any more ideas?
Dave


-Original Message-
From: Chris Withers [mailto:[EMAIL PROTECTED]
Sent: Monday, October 10, 2005 8:57 AM
To: Mika, David P (Research)
Cc: zope@zope.org
Subject: Re: [Zope] reading zope.config file for ClientStorage


Mika, David P (Research) wrote:
> To initialize ZEO clients with ClientStorage I need info such as host, port, 
> etc.  All the needed stuff is tucked away nicely in the zope.config file and 
> I would like to be using the zope machinery access it.  I know that what I 
> need is in there somewhere, but when I try to follow how it happens in say 
> the Zope startup, I get lost in all the dependencies and my head starts 
> swirling. 
>
> I would like to be able to use something like is in ZODB/config.py:
>
>   class ZEOClient(BaseConfig):
>
>   def open(self):
>   from ZEO.ClientStorage import ClientStorage
>   # config.server is a multikey of socket-address values
>   # where the value is a socket family, address tuple.
>   L = [server.address for server in self.config.server]
>   return ClientStorage(
>   L,
>   storage=self.config.storage,
>   cache_size=self.config.cache_size,
>   name=self.config.name,
>   client=self.config.client,
>   var=self.config.var,
>   min_disconnect_poll=self.config.min_disconnect_poll,
>   max_disconnect_poll=self.config.max_disconnect_poll,
>   wait=self.config.wait,
>   read_only=self.config.read_only,
>   read_only_fallback=self.config.read_only_fallback,
>   username=self.config.username,
>   password=self.config.password,
>   realm=self.config.realm)
>
> here BaseConfig has that bit of magic that has self.config.
>
> I guess I need to know how to instantiate this class.  Any ideas?

Have a look at the run.py file in Stepper:

http://www.simplistix.co.uk/software/zope/stepper

It shows you how to parse zope.conf without having to start Zope up...

You may wish to wait for Stepper 1.3.0, though, which shows you how to
do this for both Zope 2.7 and Zope 2.8...

cheers,

Chris

--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
___
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 )


[Zope] reading zope.config file for ClientStorage

2005-10-07 Thread Mika, David P (Research)
To initialize ZEO clients with ClientStorage I need info such as host, port, 
etc.  All the needed stuff is tucked away nicely in the zope.config file and I 
would like to be using the zope machinery access it.  I know that what I need 
is in there somewhere, but when I try to follow how it happens in say the Zope 
startup, I get lost in all the dependencies and my head starts swirling.  

I would like to be able to use something like is in ZODB/config.py:

class ZEOClient(BaseConfig):

def open(self):
from ZEO.ClientStorage import ClientStorage
# config.server is a multikey of socket-address values
# where the value is a socket family, address tuple.
L = [server.address for server in self.config.server]
return ClientStorage(
L,
storage=self.config.storage,
cache_size=self.config.cache_size,
name=self.config.name,
client=self.config.client,
var=self.config.var,
min_disconnect_poll=self.config.min_disconnect_poll,
max_disconnect_poll=self.config.max_disconnect_poll,
wait=self.config.wait,
read_only=self.config.read_only,
read_only_fallback=self.config.read_only_fallback,
username=self.config.username,
password=self.config.password,
realm=self.config.realm)

here BaseConfig has that bit of magic that has self.config.

I guess I need to know how to instantiate this class.  Any ideas?

David P. Mika
___
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] ZEO client authentication

2005-10-04 Thread Mika, David P (Research)
Thanks!  Works great.

I found that you can generate the encrypted password with 
Lib/python/ZEO/zeopasswd.py

I wish there was a better solution than having the cleartext password in the 
zope.conf file
Dave

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Sascha
Ottolski
Sent: Monday, October 03, 2005 11:40 AM
To: zope@zope.org
Subject: Re: [Zope] ZEO client authentication


Am Montag, 3. Oktober 2005 14:44 schrieb Mika, David P (Research):
> I see that ZEO supports a simple digest authenitcation of clients and that
> this is set in the zeo's config file with the keys:
> authentication-protocol, authentication-database and authentication-realm.
>
> Further, I can see that a client can connect using e.g. ZEO.ClientStorage
> with arguments for a userid & password (set in the ZEO authentication
> database).  However, how does one configure Zope (as a client to the ZEO
> server) to use this authentication?  I see nothing in the Zope config file.
>  Somehow Zope must be able to pass a valid userid and password in the
> authentication database to ZEO.
>
> Dave

Hi Dave,

this might help, although it's not written by me so I'm not 100% sure that 
I've picked up everything:

small patch to lib/python/ZODB:

--- config.py(revision 37730)
+++ config.py(working copy)
@@ -150,7 +150,10 @@
 max_disconnect_poll=self.config.max_disconnect_poll,
 wait=self.config.wait,
 read_only=self.config.read_only,
-read_only_fallback=self.config.read_only_fallback)
+read_only_fallback=self.config.read_only_fallback,
+username=self.config.username,
+password=self.config.password,
+realm=self.config.realm)

 class BDBStorage(BaseConfig):

Index: component.xml
===
--- component.xml(revision 37730)
+++ component.xml(working copy)
@@ -132,6 +132,16 @@
 read_only_fallback should be true.
   
 
+
+  
+The authentication username of the server.
+  
+
+
+  
+The authentication password of the server.
+  
+
 
   
 The authentication realm of the server.  Some authentication


something like this in your zeo.conf  section:


  ...
  authentication-protocol digest
  authentication-database $INSTANCE/etc/auth.db
  authentication-realm your_realm
  ...


obviously, a username/password in $INSTANCE/etc/auth.db (ZEO instance, that 
is):

$ cat /mnt/zope/ZEOHome/etc/auth.db
realm your_realm
your_username: your_crypted_password

and something like this in your zope.conf:


  mount-point /
  cache-size 1
  
server localhost:1234
username your_username
password your_cleartext_password
...
...
  


now, I'm not sure how to create the encrypted password, I guess zpasswd.py 
will help.


Good luck,

Sascha

-- 
Gallileus - the power of knowledge

Gallileus GmbH   http://www.gallileus.info/

Pintschstraße 16  fon +49-(0)30-41 93 43 43
10249 Berlin  fax +49-(0)30-41 93 43 45
Germany
___
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 )
___
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 )


[Zope] ZEO client authentication

2005-10-03 Thread Mika, David P (Research)
I see that ZEO supports a simple digest authenitcation of clients and that this 
is set in the zeo's config file with the keys: authentication-protocol, 
authentication-database and authentication-realm.

Further, I can see that a client can connect using e.g. ZEO.ClientStorage with 
arguments for a userid & password (set in the ZEO authentication database).  
However, how does one configure Zope (as a client to the ZEO server) to use 
this authentication?  I see nothing in the Zope config file.  Somehow Zope must 
be able to pass a valid userid and password in the authentication database to 
ZEO.

Dave
___
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 )