I'm using Nevow 0.9.31. Have been struggling with catching the
onbeforeunload event for a couple of days. From the JS code in
Athena/__init__.js, it looks like the events 'onkeypress' and
'onbeforeunload' are handled pretty automatically; and by adding alerts to
their methods, I can verify that both are caught fine on Firefox.
However, on Internet Explorer - v 6.0.2800 on W2000, and 7.0.6000 on Vista
- neither of these 2 events is trapped.
Does anybody know whether this is a known problem with Athena on IE?
(A further observation - the Athena test files TestInit.js and TestWidget.js
both appear to have tests for onbeforeunload. Now, when I do 'nit
--port=9876 nevow' and press "Run Tests" in the browser, these files do not
seem to run. I don't understand too much of the interactive unit tests yet,
but I get a feeling that file livetest_athena.py would need to have a line
like "jsClass = u'Nevow.Test.." for these 2 files to be found and executed,
and it doesn't.)
Getting an answer to this would really save some time. If not, I'll go on
digging throught the sources - it's been educational so far :-)
Trying to have the server know at once when a client goes away.
Seemed like function bindEvents of Nevow.Athena.PageWidget would do the
Checking with alert's in bindEvents() (ok), and function onbeforeunload;
however, the latter doesn't seem to get called??
Please, what am I missing here?
hi, excuse my noobness, I have a few basic questions about twisted, or
probably about web servers in general.
what is the advantage of using a single-threaded server?
i figured it makes it more scalable because there's too much overhead to
have a thread for each user when you have many simultaneous users. but a
friend i'm talking to now says that using i/o blocking threads is perfectly
scalable for a large number of simultaneous users.
if that's true i can only see a disadvantage in using a single-threaded
server -- having to use deferreds and stuff to make things asynchronous
i also don't understand how you're supposed to use deferreds
the twisted doc says deferreds won't *make* your code asynchronous. so
let's say you have to do an sql query that takes 10 seconds, deferreds would
be useless for making that not block unless you have a way of making that
sql query non-blocking already? how is that done? do you run a separate
thread of your own for each sql query? one thread for all sql queries?
also I wonder in an typical twisted app, just how slow should an operation
be before you use a deferred? what if a user enters a username and password
and i have to look that up in the database. do i use a deferred? just how
bad should the query be before using a deferred?
(reading the twisted docs is like reading a brick wall for me, it would be
nice if someone could just explain things to me in simple terms.)
I just upgraded from an April 2007 SVN version of twisted web2 to 8.0,
and I started getting some errors from my client streams. The errors
don't really seem to be errors though, as they only indicate that the
connection was closed properly, which it is supposed to be.
I'm not sure if this "error" is something I should be handling myself,
or if there is some defect in web2 since maybe it should handle this
I traced the change that is causing this to changeset 21366:
where I think the relevant change is the new call to stream.finish()
added to the _error() function. Perhaps _error() or stream.finish()
should be handling ConnectionDone errors?
I'm still a little new to Twisted, so I was wondering if some kind soul
might be willing to help make sure I'm looking at things correctly.
First, I think I understand the difference between protocol factories
and protocols, but I could use a little reassurance. My current
understanding is that the protocol factory holds the state that is
common to all connections, whereas the protocol holds the state that is
specific to a particular connection. Is that an accurate understanding?
If that is correct, then what is the difference between a protocol
factory and a protocol for a client (like HTTPClient) where only one
connection is involved? I'm a bit confused about why HTTPClientFactory
isn't a trivial class. According to my current understanding, all of
the logic would be in HTTPClient.
I was also confused about why HTTPClientFactory would set
`self.protocol.followRedirect = followRedirect` in its __init__ method.
Since `self.protocol` is the HTTPPageGetter class, it appears that the
client factory is setting the followRedirect attribute for all
connections (associated with all HTTPClientFactories). I was surprised
that HTTPClientFactory wouldn't set `self.followRedirect =
followRedirect`, in which case HTTPClient would look at
If someone could help clear up these questions for me, I feel like I
would understand Twisted a lot better.
PGP Fingerprint: 8A17 B57C 6879 1863 DE55 8012 AB4D 6098 8826 6868
On Wed, Apr 9, 2008 at 10:03 AM, Phil Christensen <phil(a)bubblehouse.org> wrote:
> I'd really love it if someone could help me with my web1 port of web2's
> WSGI module. It's completely functional, and no longer has any dependencies
> on web2, but it needs unit tests.
> I started working on imitating the test for the web2 version
> (twisted/web2/test/test_wsgi.py), but it's been idling in my workspace for
> some time, so I thought I'd just put a feeler out for anyone willing to give
> it a try, or even (gasp!) write some tests. ;-)
I think a few tickets fall into this category. They have patches that
fix code, but for one reason or another they lack tests.
Could we, as a policy, add a 'patch' tag to such tickets when we see them?
On Apr 8, 2008, at 5:01 PM, glyph(a)divmod.com wrote:
> On 01:29 pm, wthie(a)thiengineering.ch wrote:
>> A big 'thank you' (drawing my hat and bowing)!
> No problem! We should have done this a long time ago.
> The biggest thanks, of course, would be simply to submit patches
> for twisted.web and help us migrate web2's "greatest hits" back
> into the twisted.web server :).
Since we're, you know, talking about it...
I'd really love it if someone could help me with my web1 port of
web2's WSGI module. It's completely functional, and no longer has any
dependencies on web2, but it needs unit tests.
I started working on imitating the test for the web2 version (twisted/
web2/test/test_wsgi.py), but it's been idling in my workspace for
some time, so I thought I'd just put a feeler out for anyone willing
to give it a try, or even (gasp!) write some tests. ;-)
I am using this in a production site, so I have great faith in it at
least not having any show-stopper issues, but I just haven't gotten a
chance to finish the tests.
On 09:07 pm, clemesha(a)gmail.com wrote:
>Would it be possible for someone to give a high level over-view
>of the current state of the web/web2 code in Twisted?
I don't have time to do a full overview of what's good, what's bad, and
what's ugly in every module in web, web2, and nevow, but we did make
some decisions about where things are going in the *future* at PyCon.
I should have done this already, but I just did a brief overview of the
write-up on the wiki: http://twistedmatrix.com/trac/wiki/TwistedWebPlan
Wiki editors, please add links in the appropriate places.
Users, what do you think? If you would like clarifications and edits to
this plan, please ask. More developers than just me should know what's
going on and I hope we can all keep expanding that page to give the best
picture of what's going on ...