[Zope3-dev] Re: [Zope3-checkins] CVS: Zope3 - z3.py:1.7

Jeremy Hylton jeremy@zope.com (Jeremy Hylton)
Tue, 26 Nov 2002 10:08:20 -0500


>>>>> "MH" == Magnus Heino <magnus.heino@pleon.sigma.se> writes:

  MH> This is my first look at Zope3, so I will ask first, instead of
  MH> trying to fix... and I'm probably all wrong anyway ;)

I doubt it :-).

  >> Modified Files: z3.py Log Message: Explicitly use ThreadedAsync.
  >>
  >> We need ThreadedAsync to make ZEO work with Zope.  It seems
  >> better to be explicit about where the code is running, so import
  >> ThreadedAsync instead of pretending to go through asyncore.
  >>
  >>
  >> === Zope3/z3.py 1.6 => 1.7 ===
  >> --- Zope3/z3.py:1.6 Mon Nov 18 15:20:11 2002
  >> +++ Zope3/z3.py Mon Nov 25 12:07:32 2002
  >> @@ -17,7 +17,8 @@ $Id$ """
  >>
  >> -import os, sys, asyncore +import os, sys +import ThreadedAsync

  MH> This import or ThreadedAsync won't work, since lib/python path
  MH> is setup later on in the run method. I moved the import to the
  MH> row before its actually used.

  MH> I guess you have a copy of it in site-packages or something...

I did, then I remember to delete it -- but the only thing I did after
deleting it was run the unit tests :-(.  start scripts seem to be my
Achilles heel.

It sounds sensible to do the path hackery first.

  >>
  >> basepath = filter(None, sys.path)
  >>
  >> @@ -57,7 +58,7 @@ XMLConfig(os.path.join(dir, 'zserver.zcml'))()
  >>
  >> try:
  >> - asyncore.loop()
  >> + ThreadedAsync.loop()

  MH> Isn't :

  MH> import asyncore import ThreadedAsync asyncore.loop()

  MH> the way to do it? ThreadedAsync doesnt have a loop method. All
  MH> it does is that it changes asyncore.loop.

I changed ThreadedAsync so that it exports its loop function, too.  I
think it's clearer to call the method via ThreadedAsync than to
magically use it via update of asyncore.

Jeremy