[Zope] FW: [Zope] and remote databases in other [zopes]

Loren Stafford lstafford@icompression.com
Fri, 24 Sep 1999 11:10:36 -0700


-----Original Message-----
From: Loren Stafford [mailto:lstafford@icompression.com]
Sent: Friday, September 24, 1999 10:32
To: codelarvs@ciudad.com.ar
Subject: RE: [Zope] and remote databases in other [zopes]


Oh-oh. I feel another How-To coming on...

I did something just like this last week with the help of other list
members. It goes like this:

1. You want to use ZClient, which is located in your Zope directory at
../lib/python/ZPublisher/Client.py. Read the comments to get an idea of how
it works. Basically, it acts as a web browser.

2. Because, ZClient is an external Python program, you have to create an
external method to drive it from within DTML. Use the How-To: Using External
Methods at http://www.zope.org/Documentation/How-To/ExternalMethods to help
you add an external Python method similar to this:

from ZPublisher import Client

def web_client(url = 'http://www.yahoo.com/', username = None, password =
None, **kw):
     '''access http servers'''
     if kw:
         return Client.call(url,username,password,kw)[1]
     else:
         return Client.call(url,username,password)[1]

My version of this Python code resides at ../Extensions/WebClient.py and the
external method name is also WebClient.

3. Create one or more DTML methods that call this external method with the
correct parameters to access your NT server. Here's a simple example that
doesn't require any more parameters than the URL of an SQL method on the
database server:

<!--#var standard_html_header-->
<h2><!--#var document_title--></h2>
<dtml-var "webClient('http://nt-server:8080/Marketing/AllCustHave')">
<!--#var standard_html_footer-->

That's all!

-- Loren


> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
> codelarvs@ciudad.com.ar
> Sent: Thursday, September 23, 1999 19:05
> To: zope@zope.org
> Subject: [Zope] and remote databases in other [zopes]
>
>
> Hello! I have the folowing problem:
> I'm using Zope on a SUN Sparc machine running Solaris..
> The site works nice, but I need to access the data, that is
> placed on a Microsoft SQL Server on a Windows NT and i cant change
> that :\
> I've read in the Docs when i was installing that is possible
> to have a zope in each machine.. and use the one in the
> NT like an iterface. For example: Lets say.. If I define a Dtml method
> that gets the data from the SQL in the zope in Windows NT..
> Can I call that method from the Zope in the SUN to retrieve the
> data from
> the Microsoft SQL?. If there's a way to do this (with
> 2 zopes or another way).. could someone please explain me
> how to do it?
>
> Thanks!
>                    Nahuel Greco.
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
>
> (To receive general Zope announcements, see:
> http://www.zope.org/mailman/listinfo/zope-announce
>
> For developer-specific issues, zope-dev@zope.org -
> http://www.zope.org/mailman/listinfo/zope-dev )
>