Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: Users

Zope2 + Twisted

 

 

Zope users RSS feed   Index | Next | Previous | View Threaded


peter at sabaini

Mar 5, 2009, 5:17 AM

Post #1 of 6 (1693 views)
Permalink
Zope2 + Twisted

I'd like to run a Twisted client in Zope 2.10 (for a legacy app).

How do I do that? Simply loading twisted.internet is probably not a good idea
since Twisted would not work well with ZServer threads, right?

One thing I tried was enabling Twisted in zope.conf but that gives me the
following stacktrace (abbr):

...
File "/usr/local/zope/2.10/src/Zope-2.10.7-
final/lib/python/ZConfig/matcher.py", line 188, in constuct
s = st.datatype(s)
File "/usr/local/zope/2.10/src/Zope-2.10.7-
final/lib/python/Zope2/Startup/datatypes.py", line 349, in __init__
raise ImportError("You do not have twisted installed.")
ImportError: You do not have twisted installed.


I've got Twisted on my Pythonpath though.

TIA,
peter.
Attachments: signature.asc (0.19 KB)


David.Bear at asu

Mar 5, 2009, 9:46 AM

Post #2 of 6 (1588 views)
Permalink
Re: Zope2 + Twisted [In reply to]

could this be satisficed by putting an apache proxy in front of both zope
and twisted?

On Thu, Mar 5, 2009 at 6:17 AM, Peter Sabaini <peter [at] sabaini> wrote:

> I'd like to run a Twisted client in Zope 2.10 (for a legacy app).
>
> How do I do that? Simply loading twisted.internet is probably not a good
> idea
> since Twisted would not work well with ZServer threads, right?
>
> One thing I tried was enabling Twisted in zope.conf but that gives me the
> following stacktrace (abbr):
>
> ...
> File "/usr/local/zope/2.10/src/Zope-2.10.7-
> final/lib/python/ZConfig/matcher.py", line 188, in constuct
> s = st.datatype(s)
> File "/usr/local/zope/2.10/src/Zope-2.10.7-
> final/lib/python/Zope2/Startup/datatypes.py", line 349, in __init__
> raise ImportError("You do not have twisted installed.")
> ImportError: You do not have twisted installed.
>
>
> I've got Twisted on my Pythonpath though.
>
> TIA,
> peter.
>
>
> _______________________________________________
> Zope maillist - Zope [at] zope
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>
>


--
David Bear
College of Public Programs at ASU
602-464-0424


peter at sabaini

Mar 5, 2009, 9:59 AM

Post #3 of 6 (1587 views)
Permalink
Re: Zope2 + Twisted [In reply to]

On Thursday 05 March 2009 18:46:33 you wrote:
> could this be satisficed by putting an apache proxy in front of both zope
> and twisted?

No, not really -- I'd like to use a client written on top of Twisted in a Zope
product. So, I'd need the twisted reactor and libraries running in the Python
VM that runs Zope. Which should be no problem except I suspect that I
shouldn't be using the (threaded) ZServer then, because I think that would
mess with twisted (which is not threadsafe for the most part).

I thought if I'd switch to the twisted http server implementation that would
take care of that -- no threaded ZServer, no problem. Except that doesn't seem
to work as advertised, since the zope.app.twisted package is not present, and
the one on PyPI seems to be geared towards Zope3, AFAICT.

Is that so? Is there an alternative zope.app.twisted package for Zope2?

thx,
peter.


> On Thu, Mar 5, 2009 at 6:17 AM, Peter Sabaini <peter [at] sabaini> wrote:
> > I'd like to run a Twisted client in Zope 2.10 (for a legacy app).
> >
> > How do I do that? Simply loading twisted.internet is probably not a good
> > idea
> > since Twisted would not work well with ZServer threads, right?
> >
> > One thing I tried was enabling Twisted in zope.conf but that gives me the
> > following stacktrace (abbr):
> >
> > ...
> > File "/usr/local/zope/2.10/src/Zope-2.10.7-
> > final/lib/python/ZConfig/matcher.py", line 188, in constuct
> > s = st.datatype(s)
> > File "/usr/local/zope/2.10/src/Zope-2.10.7-
> > final/lib/python/Zope2/Startup/datatypes.py", line 349, in __init__
> > raise ImportError("You do not have twisted installed.")
> > ImportError: You do not have twisted installed.
> >
> >
> > I've got Twisted on my Pythonpath though.
> >
> > TIA,
> > peter.
> >
> >
> > _______________________________________________
> > Zope maillist - Zope [at] zope
> > http://mail.zope.org/mailman/listinfo/zope
> > ** No cross posts or HTML encoding! **
> > (Related lists -
> > http://mail.zope.org/mailman/listinfo/zope-announce
> > http://mail.zope.org/mailman/listinfo/zope-dev )
Attachments: signature.asc (0.19 KB)


regebro at gmail

Mar 5, 2009, 2:33 PM

Post #4 of 6 (1583 views)
Permalink
Re: Zope2 + Twisted [In reply to]

On Thu, Mar 5, 2009 at 18:59, Peter Sabaini <peter [at] sabaini> wrote:
> So, I'd need the twisted reactor and libraries running in the Python
> VM that runs Zope. Which should be no problem except I suspect that I
> shouldn't be using the (threaded) ZServer then, because I think that would
> mess with twisted (which is not threadsafe for the most part).

Well, then you could probably set the ZServer to only use one thread.
That means you need many ZServers with a load balancer in front
instead.

> I thought if I'd switch to the twisted http server implementation that would
> take care of that -- no threaded ZServer, no problem. Except that doesn't seem
> to work as advertised, since the zope.app.twisted package is not present, and
> the one on PyPI seems to be geared towards Zope3, AFAICT.

I'm pretty sure the Zope2 implementation doesn't use zope.app.twisted.
However, the Zope 2 implementation is again not thread safe, and will
only work with one thread per server, so you don't actually gain
anything in using it. Besides, I don't think anyone actually used it
after I implemented it. Which is why it's still marked as
experimental, and would probably best be removed again.

--
Lennart Regebro: Pythonista, Barista, Notsotrista.
http://regebro.wordpress.com/
+33 661 58 14 64
_______________________________________________
Zope maillist - Zope [at] zope
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


peter at sabaini

Mar 5, 2009, 2:51 PM

Post #5 of 6 (1576 views)
Permalink
Re: Zope2 + Twisted [In reply to]

On Thursday 05 March 2009 23:33:40 you wrote:
> On Thu, Mar 5, 2009 at 18:59, Peter Sabaini <peter [at] sabaini> wrote:
> > So, I'd need the twisted reactor and libraries running in the Python
> > VM that runs Zope. Which should be no problem except I suspect that I
> > shouldn't be using the (threaded) ZServer then, because I think that
> > would mess with twisted (which is not threadsafe for the most part).
>
> Well, then you could probably set the ZServer to only use one thread.
> That means you need many ZServers with a load balancer in front
> instead.
>
> > I thought if I'd switch to the twisted http server implementation that
> > would take care of that -- no threaded ZServer, no problem. Except that
> > doesn't seem to work as advertised, since the zope.app.twisted package is
> > not present, and the one on PyPI seems to be geared towards Zope3,
> > AFAICT.
>
> I'm pretty sure the Zope2 implementation doesn't use zope.app.twisted.

Zope2/Startup/datatypes.py tries to import it

> However, the Zope 2 implementation is again not thread safe, and will
> only work with one thread per server, so you don't actually gain
> anything in using it. Besides, I don't think anyone actually used it
> after I implemented it. Which is why it's still marked as
> experimental, and would probably best be removed again.

Hm, the default zope.conf says twisted should be supported as an HTTP server
replacement -- is that a bug?

Thanks,
peter.
Attachments: signature.asc (0.19 KB)


regebro at gmail

Mar 6, 2009, 2:32 AM

Post #6 of 6 (1588 views)
Permalink
Re: Zope2 + Twisted [In reply to]

On Thu, Mar 5, 2009 at 23:51, Peter Sabaini <peter [at] sabaini> wrote:
> Hm, the default zope.conf says twisted should be supported as an HTTP server
> replacement -- is that a bug?

If it uses the word "supported" that is a bug, yes.

In any case, as mentioned, it does not solve your problem. But setting
zserver-threads to 1 does.

--
Lennart Regebro: Pythonista, Barista, Notsotrista.
http://regebro.wordpress.com/
+33 661 58 14 64
_______________________________________________
Zope maillist - Zope [at] zope
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Zope users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.