[Zope-dev] Re: port number for HTTPServer

Tres Seaver tseaver at palladion.com
Mon Jul 17 10:06:20 EDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Miles Waller wrote:
> Hi,
> 
> I am trying to find out the port number for the HTTP service running in
> a zope instance.  I tried using socket_map as used in the Control_Panel
> interface to report on running network services, but abandoned this
> because I need to get the same information when running in a debug
> instance as through the web.

I don't know what you mean by "debug isntance":  is that from within the
process started by 'zopectl debug'?  from a script run via 'zopectl run'?

> My next approach uses App.config.getConfiguration().servers to get the
> information fromn zope.conf directly.  But a few things seem not quite
> right:
> 
>  - getConfiguration().servers gives me different lists through the debug
> prompt and through the web.  why is this?
> 
>  - what is the most robust way to determine which of the listed servers
> is the HTTPServer?

Use 'isinstance HTTPServer'.

>  - is it ever possible that the servers list would contain more than one
> HTTPServer?

Yes.  There will be one instance per '<http-server>' directive in your
zope.conf file.

> The reason for doing this is so that zope can call out to an external
> program, and give it a notification url that the external program can
> call back on.  Unfortunately I can't change this method of integration.
> 
> Thanks for your help!

Rather than guess, I would make the "callback URL" an explicit
configuration item.  You could set an environment variable with the
information you need, or add a custom stanza to zope.conf, e.g.::

    <product-config your_product_name>
       callback_url http://zope.example.com:1234/path/to/callback_method
    </product-config>

You would then use this value via
'getConfiguration().product_config["your_product_name"]["callback_url"]'.

See the bottom of $ZOPE_HOME/skel/etc/zope.conf.in for more information.


Tres.
- --
===================================================================
Tres Seaver          +1 202-558-7113          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEu5lc+gerLs4ltQ4RAjqnAKCFGGYyMaBEuog5xQwUenhz4E51GwCeJJ9j
MgZe+4ryWKSW/rnL5+Z4iv0=
=3k5M
-----END PGP SIGNATURE-----



More information about the Zope-Dev mailing list