[Zope] FW: [Zope] Newbie: How-To: Using ZClient to Access Another webserver

Loren Stafford lstafford@icompression.com
Tue, 9 Nov 1999 09:16:36 -0800


I can't see anything wrong, so I'll guess that the problem is something I
can't see:

1. In Python, indentation has syntactic value. Is the "d" of "def" in column
1 of the line? It should be.

2. Are there any "special" characters at the end of the prior line? If you
are on Unix, open the file with vi and look for stuff like "^M". If you see
any, delete them.

A couple of other points:

1. "Exact copy paste" may not be exact because of system and application
differences in the handling of tabs and line endings.

2. You need to learn a little Python if you are going to use Zope. It's
never too early to start.

-- HTH
-- Loren


> -----Original Message-----
> From: Maarten Slaets [mailto:maarten.slaets@kpnqwest.com]
> Sent: Tuesday, November 09, 1999 05:33
> To: Loren Stafford
> Subject: Re: [Zope] Newbie: How-To: Using ZClient to Access Another
> webserver
>
>
> yup, that is the problem:
>
> <error>
> # python WebClient.py
>   File "WebClient.py", line 3
>     def web_client(url = 'http://www.yahoo.com/', username =
> None, password
> = None, **kw):
>     ^
> SyntaxError: invalid syntax
> </error>
>
> and the source:
> <source>
> 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]
> </source>
>
> what is wrong?
>
> maarten.
>
> Loren Stafford wrote:
> >
> > To try to isolate the problem, why don't you try to execute the script
> > directly with Python. E.g.:
> >
> >     python WebClient.py
> >
> > If there is a syntax error in the script, Python should point directly
> > to
> > the error.
> >
> > -- Loren
> >
> > > -----Original Message-----
> > > From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
> > > Maarten Slaets
> > > Sent: Monday, November 08, 1999 02:38
> > > To: zope@zope.org
> > > Subject: [Zope] Newbie: How-To: Using ZClient to Access Another
> > > webserver
> > >
> > >
> > > hi zopers,
> > >
> > > This howto (Using ZClient to Access Another webserver) by
> > > lstaffor explains
> > > how to connect to another webserver (for instance). i did exactly as
> > > explained on:
> > > http://www.zope.org/Members/lstaffor/ZClientMethod
> > > but when i try to add the external method in the web management
> > > interface i
> > > get this traceback:
> > >
> > > <traceback>
> > > Traceback (innermost last):
> > >   File
> > > /usr/local/Zope-2.0.1-src/lib/python/ZPublisher/Publish.py, line 214,
> > > in publish_module
> > >   File
> > > /usr/local/Zope-2.0.1-src/lib/python/ZPublisher/Publish.py, line 179,
> > > in publish
> > >   File /usr/local/Zope-2.0.1-src/lib/python/Zope/__init__.py, line
> > 201, in
> > > zpublisher_exception_hook
> > >   File
> > > /usr/local/Zope-2.0.1-src/lib/python/ZPublisher/Publish.py, line 165,
> > > in publish
> > >   File /usr/local/Zope-2.0.1-src/lib/python/ZPublisher/mapply.py,
> > > line 160,
> > > in mapply
> > >     (Object: manage_addExternalMethod)
> > >   File
> > > /usr/local/Zope-2.0.1-src/lib/python/ZPublisher/Publish.py, line 102,
> > > in call_object
> > >     (Object: manage_addExternalMethod)
> > >   File
> > > /usr/local/Zope-2.0.1-src/lib/python/Products/ExternalMethod/Exter
> > > nalMethod.py,
> > > line 126, in manage_addExternalMethod
> > >   File
> > > /usr/local/Zope-2.0.1-src/lib/python/Products/ExternalMethod/Exter
> > > nalMethod.py,
> > > line 166, in __init__
> > >     (Object: webClient)
> > >   File
> > > /usr/local/Zope-2.0.1-src/lib/python/Products/ExternalMethod/Exter
> > > nalMethod.py,
> > > line 185, in manage_edit
> > >     (Object: webClient)
> > >   File
> > > /usr/local/Zope-2.0.1-src/lib/python/Products/ExternalMethod/Exter
> > > nalMethod.py,
> > > line 194, in getFunction
> > >     (Object: webClient)
> > >   File /usr/local/Zope-2.0.1-src/lib/python/App/Extensions.py,
> > > line 204, in
> > > getObject
> > >     (Info: ('/usr/local/Zope-2.0.1-src/Extensions/WebClient.py',
> > > 'WebClient'))
> > > SyntaxError: (see above
> > > </traceback>
> > >
> > > 1/ Is there something wrong with the source given on the website?
> > > (i did an
> > > exact copy paste, because i don't know pyhton yet. 'yet' because i
> > will
> > > learn it, but now i have to finish this project rapidly otherwise my
> > boss
> > > will finish me:-)
> > > 2/ Does anyone have the WebClient.py source of lstaffor?
> > >