On Thursday 26 February 2004 06:50 am, Nikolay Kim wrote:
 > is there any way create server for new protocol without changing ZServer
 > module?

There's clearly a need for some more documentation here, but I'm not sure what 
to write yet, or where it should go.

Contrary to many of the other responses, yes, this shouldn't be difficult at 
all.  You'll need a couple of pieces of Python code:

1.  Your server implementation.  It sounds like you have this already.

2.  A factory object that can accept configuration data and create an instance 
of your server object.

You then need to create a ZConfig component that provides a section type to 
support your server.  The ZConfig documentation discusses this somewhat.  The 
new section type will need to declare that it implements the ZServer.server 
abstract type; it should probably look something like this:

<component>
  <import package="ZServer"/>

  <sectiontype name="myserver"
               implements="ZServer.server"
               datatype="mypackage.server.ServerFactory">

    <!-- configuration data should be described here -->

  </sectiontype>
</component>

You'll need to arrange for the package containing this component is available 
on the Python sys.path before zope.conf is loaded; this is mostly easily done 
by manipulating the PYTHONPATH environment variable.

Your zope.conf file can now include the following to load and use your new 
server:

%import mypackage
<myserver>
  # configuration settings go here
</myserver>

Feel free to ask questions about this; I'm usually more available to respond 
than I have been a couple of days.


  -Fred

-- 
Fred L. Drake, Jr.  <fred at zope.com>
PythonLabs at Zope Corporation


_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to