Re: [Twisted-Python] Switch Protocols mid Connection

2018-09-17 Thread Tristan Seligmann
On Sun, 16 Sep 2018 at 16:02, Randall Smith  wrote:
> and make 16+ calls to transfer a single file.  So I need to switch to a
> more appropriate (not yet determined) protocol for the transfer, and
> then back to AMP.  AMP provides a protocol switch command, which is
> great, but then I'd need to switch back to AMP and I have no idea what
> approach to take here.  It  doesn't help that I don't have a file
> transfer protocol selected.

You might be able to get away with
http://bazaar.launchpad.net/~glyph/%2Bjunk/amphacks/annotate/head%3A/python/amphacks/mediumbox.py

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] How do recommend I run epytext?

2018-08-03 Thread Tristan Seligmann
On Fri, 3 Aug 2018 at 16:25 Barry Scott  wrote:

> The tox checking does not cover the epytext checks it seems.
>
> How do you recommend I have epytext checked for a patch?
>

Twisted uses pydoctor for generating API documentation; I believe tox -e
apidocs is what you want to run it:

https://github.com/twisted/twisted/blob/ee535041258e7ef0b3223d2e12cd9aaa0bc2289f/tox.ini#L124
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] body producer bug in agent?

2017-11-11 Thread Tristan Seligmann
On Sun, 12 Nov 2017 at 09:33 Glyph  wrote:

> I attempted to draw some attention to this with github mentions:
>
> https://github.com/twisted/treq/issues/185#issuecomment-331856235
>
>
> but it looks like that didn't work.
>
> Hopefully by posting it here I can motivate someone to look at it?  I
> think it sounds like a pretty bad bug, but I don't have a ton of time to
> look at it myself :-(.  I believe it's in Twisted itself, not Treq, but I
> could be wrong.
>

A cursory glance suggests that 1) the bug is in Twisted, and 2) the impact
of the bug is limited to an annoying log message. Unfortunately I'm
unlikely to be able to chase this further any time soon, but hopefully
somebody else can.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Is there a nice way to write transport-agnostic protocols and servers/clients?

2017-08-16 Thread Tristan Seligmann
On Wed, 16 Aug 2017 at 15:28 Kevin Conway 
wrote:

> Maybe I misunderstand the issue, but I believe the Endpoints API solves
> for this.
> https://twistedmatrix.com/documents/16.4.1/core/howto/endpoints.html
>
> This abstracts the transport and allows you to focus on only interpreting
> the bytes transmitted over that transport by defining a Protocol and a
> Factory that plug into strports. This should allow you to have the business
> logic defined in only one location while listening/requesting over
> different transports.
>
There is no datagram endpoints API as yet, though (see #4471), only stream
endpoints.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Is there a nice way to write transport-agnostic protocols and servers/clients?

2017-08-16 Thread Tristan Seligmann
On Wed, 16 Aug 2017 at 13:53 Jarosław Fedewicz 
wrote:

> One thing that is also notably missing from the puzzle is that there is no
> support for datagram endpoints.
>

The lack of datagram endpoint abstractions is definitely just a "we haven't
gotten around to it yet"; stream endpoints were the initial focus mainly
because stream protocols are a lot more common than datagram protocols. The
ticket covering datagram endpoints is here, I believe:
https://twistedmatrix.com/trac/ticket/4471 There seems to be some old work
that was never completed, so picking this up again might be a good starting
point if you're keen on contributing in this area.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Weird PyPY twisted.internet.defer.TimeoutError ERROR*12 during full test run

2017-08-04 Thread Tristan Seligmann
On Sat, 5 Aug 2017 at 00:44 Daniel Sutcliffe  wrote:

> For the buildbot:
> https://buildbot.twistedmatrix.com/builders/ubuntu16.04-pypy5/
> they seem to pretty much consistently happen during:
>   twisted.protocols.test.test_tls.TLSMemoryBIOTests.test_hugeWrite_TLSv1_1
> but running in my own environment(s) I also always see the 12
> TimoutError but they can occur in a variety of different tests, I've
> seen them in these as well as the above:
>twisted.news.test.test_news.NewsTests.testArticleRequest
>twisted.names.test.test_server.DNSServerFactoryTests.test_verboseDefault
>
>  
> twisted.positioning.test.test_nmea.BrokenSentenceCallbackTests.test_dontSwallowCallbackException
> and a bunch of others.
>

This kind of timeout usually means that the test is waiting for some event,
and due to an event ordering that wasn't expected, the event never happens;
for example, it might have already happened before you start waiting for
it, or it might not happen at all due to an error.

Sometimes this means that the test is really stuck, but often it means that
an error has occurred but was not handled by the test, so you get an error
(maybe logged, maybe not) but also the test never ends.

Always exactly 12 and always during same test for a single test run.
> I've not been able to reproduce running anything but the full
> testsuite - but they have always occured for me during full run.
>
> Just wondered if anybody with more experience had a clue/idea as to
> why this could happen (why 12), and how I could go about tracking down
> the root cause.
>

Look for missing error handling in the test to see if an error is occurring
that the test does not notice; if you're lucky, these errors may have been
logged (check test.log). If not, you may need to improve the error handling
and / or play around in a debugger.

If the test really is stuck, a common cause of PyPy vs CPython issues is
garbage collection or weakref callbacks happening in an unpredictable
ordering of events. I haven't looked at the tests in question but I would
check for things like __del__ methods (eg. files not being closed
explicitly) or weakref use in the vicinity.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Nevow 0.14.3rc1 released

2017-07-26 Thread Tristan Seligmann
Hi all,

I've uploaded a prerelease of Nevow 0.14.3 to PyPI[1]. This contains a fix
for some Athena client-side timeout behaviour (or more specifically, the
lack of one) and removes use of FilePath.getmtime.

If you are using Athena, please a) let me know! and b) give this prerelease
a try to see if anything breaks. As the de facto Nevow release manager, and
one of its last users, I'd like to avoid going overboard on release
engineering if it isn't necessary, but I'd also like to avoid making life
worse for any other remaining users, so it would be useful to hear from any
of you out there still using Nevow.

[1] https://pypi.python.org/pypi/Nevow/0.14.3rc1
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] WebSockets and QUIC for Twisted

2017-07-05 Thread Tristan Seligmann
On Thu, 6 Jul 2017 at 04:58 Glyph  wrote:

> Why are you interested in QUIC? My understanding was that Google used this
> protocol as an experiment, but HTTP/2 is the successful termination of the
> experiment, and nobody should really be using it.  (For http2 support, `pip
> install twisted[tls,http2]`).
>

You're thinking of SPDY. QUIC is a UDP-based protocol that allows 0-rtt
connection setup (and is also implemented by Chrome / Google services).
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Question regarding patch submission

2017-06-25 Thread Tristan Seligmann
On Mon, 26 Jun 2017 at 05:34 Jason Litzinger 
wrote:

> However, after incorporating review comments in new commits and,
> force-pushing the feature branch, is it expected that the review comments
> may
> be damaged?
>

I think this is expected; this is just an unfortunate shortcoming of GitHub
PR reviews.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] new core contributor

2017-04-22 Thread Tristan Seligmann
On Sat, 22 Apr 2017 at 09:48 Glyph Lefkowitz 
wrote:

> As per our previously documented entirely arbitrary[1] and ad-hoc[2]
> process, I'd like to welcome - should he choose to accept it - Tom Most to
> be a member of the Twisted project.  You've probably seen him around on
> IRC, as 'twm'.  Tom's been reporting nuanced web-related bugs in Twisted
> since at least 2011, if not longer:
> https://twistedmatrix.com/trac/ticket/5434
>

Welcome! :)
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] non-merge commits to trunk & "review" keyword

2017-03-07 Thread Tristan Seligmann
On Tue, 7 Mar 2017 at 09:56 Glyph Lefkowitz <gl...@twistedmatrix.com> wrote:

> On Mar 6, 2017, at 9:02 PM, Tristan Seligmann <mithra...@mithrandi.net>
> wrote:
>
> On Tue, 7 Mar 2017 at 06:38 Glyph Lefkowitz <gl...@twistedmatrix.com>
> wrote:
>
>
> This is definitely bad, forbidden by existing policy, etc.  In fact I
> remember adjusting the settings so that the 'merge' button would always
> create a merge commit; in fact, the configuration is still set that way.
>
>
> Rebase merging was allowed when I checked earlier, so I disabled it (I
> guess I managed to do this before you looked at the configuration).
>
>
> Perhaps I only did this for some other repos, then.  Did I miss your
> announcement of this?  Hint, hint? :)
>

 By the time I got to my email client (which admittedly was several hours
after I made the configuration change), your email had arrived, so my reply
ended up being the "announcement" too. The last time I looked at these
settings, rebasing was not allowed, so I guess somebody else turned it on
(possibly by accident); the GitHub audit logs don't go far back enough for
me to check who did it and when, but that means the change happened over
several months ago.

> I suspect that is what happened here, but note also that these settings
> only control what is possible by pressing the merge button on GitHub; you
> can construct commits locally however you like and push them, as long as
> you get green commit statuses for all the mandatory commit checks.
>
>
> Is this true even for people with just repo:write?
>

I haven't actually tested this scenario, so I could be mistaken; inferring
from other things it shouldn't matter what your permissions are (for a
non-force push).
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] non-merge commits to trunk & "review" keyword

2017-03-06 Thread Tristan Seligmann
On Tue, 7 Mar 2017 at 06:38 Glyph Lefkowitz  wrote:

>
> This is definitely bad, forbidden by existing policy, etc.  In fact I
> remember adjusting the settings so that the 'merge' button would always
> create a merge commit; in fact, the configuration is still set that way.
>

Rebase merging was allowed when I checked earlier, so I disabled it (I
guess I managed to do this before you looked at the configuration). I
suspect that is what happened here, but note also that these settings only
control what is possible by pressing the merge button on GitHub; you can
construct commits locally however you like and push them, as long as you
get green commit statuses for all the mandatory commit checks.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] twistedmatrix.com TLS certificate

2017-03-05 Thread Tristan Seligmann
twistedmatrix.com's current certificate is issued by StartCom Certification
Authority; for certificates issued by this CA prior to 2016-09-21, the
domain must be on a Chrome whitelist for it to be accepted. As of Chrome
58.0.3026.3 (canary/dev channel only, currently, but eventually this will
presumably be in a release version) twistedmatrix.com is no longer[1] on
the whitelist, which means that twistedmatrix.com will issue a certificate
error. Can we switch to another CA? (Let's Encrypt, for example; I hear
somebody wrote a Twisted library for using that)

I'm sending this to the general list in case anyone else has been
scratching their head about why they're getting cert warnings.

[1]
https://chromium.googlesource.com/chromium/src/+/6fc397860ccafa55086456a4d1e6d713c418b41f%5E%21/
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] HTTP Agent persistent connections not closed for some HTTPS sites

2017-03-05 Thread Tristan Seligmann
On Sun, 5 Mar 2017 at 15:36 Adi Roiban  wrote:

> I have observed this while running some end to end tests in which the
> pool.closeCachedConnections() deferred was not called, even after a
> generous amount of seconds :)
>

The code to abort an HTTP client connection is here:

https://github.com/twisted/twisted/blob/twisted-17.1.0/src/twisted/web/_newclient.py#L1657

This calls loseConnection which for a TLS connection will try to do a TLS
shutdown under most circumstances (in some cases it can't, and will
abortConnection on the underlying transport instead). If the remote end has
stopped responding to the connection, I think this may end up hanging
forever.

I think this code should either call abortConnection directly, or set a
timer which will abort the connection after a little while if a clean
shutdown from loseConnection has not completed yet. I'
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Test coverage requirements

2017-02-27 Thread Tristan Seligmann
On Mon, 27 Feb 2017 at 21:54 Glyph Lefkowitz 
wrote:

> That said, it has been *improving* and if it keeps improving at the rate
> it has been, I expect that we'd be able to put that coverage blocker back
> in in another 3-4 months.  Perhaps something to talk about at PyCon.
>

I think at least one problem that we're suffering from here is our fault,
rather than Codecov's: the coverage of the test suite is not stable due to
non-determinism in the test suite. That is, the lines executed during a
test run are not the same every time due to things like ordering / timing
races / etc. This means that "changes" to coverage may show up for a
particular PReven though nothing in that PR is actually responsible.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted 17.1 Release Announcement

2017-02-15 Thread Tristan Seligmann
On Wed, 15 Feb 2017 at 15:23 Jean-Paul Calderone 
wrote:

>
> I wonder about the details of how treq's failures went unnoticed.  Is
> development sufficiently inactive that no one looked at CI between the
> breakage and the release?  Wasn't that a period of several months?  Or does
> it have a Twisted trunk@HEAD build that none of the contributors really
> pay attention to?
>

The latter is the case; there are Twisted trunk builds, but they're flagged
as "failures allowed" to avoid disrupting development with transient
breakage. Unfortunately this means that basically nobody ever notices when
they fail. For example, here's a failing build:

https://travis-ci.org/twisted/treq/builds/194691849

I haven't found a good solution to this problem yet in my own projects; I'm
hoping someone else has some ideas?
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Hanging SFTP client operations on server disconnection

2017-02-15 Thread Tristan Seligmann
On Wed, 15 Feb 2017 at 08:56 Glyph Lefkowitz 
wrote:

>
> PS: There is a stray release notes fragment in conch
>
> https://github.com/twisted/twisted/blob/trunk/src/twisted/conch/8791.feature
>
>
> Oops!
>
> Wait; why do you say this is "stray"?
>

It appears to be in the wrong directory (should be in
src/twisted/conch/topfiles/).
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted 17.1 Release Announcement

2017-02-12 Thread Tristan Seligmann
On Sun, 12 Feb 2017 at 03:45 Glyph Lefkowitz 
wrote:

>
> Yeah, this is a lack of test coverage for the 'default' case.  Technically
> it *is* a regression, but it's probably pretty unusual to use the
> default; point being, I don't think we need an emergency release here.
>

The functionality that was removed was previously deprecated, so I don't
think it counts as a regression. However, the fact that most people
wouldn't ever have seen the DeprecationWarning, and…

There's also a huge problem here with documentation, where `-d´ is a TCP
> port but `-p´ is a strport, and it's hard for end-users to get from the
> command line to the relevant documentation that explains what strports are
> available.
>

…the documentation issue does make things more awkward than they needed to
be.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted 17.1 Release Announcement

2017-02-11 Thread Tristan Seligmann
On Sat, 11 Feb 2017 at 12:04 Amber Hawkie Brown 
wrote:

> - Lots of deprecated code removals, to make a sleeker, less confusing
> Twisted.
>

Something perhaps not obvious from the release notes:

String endpoint descriptions, as used by twist/twistd among other things,
for listening on tcp ports now require the "tcp:": that is, "80" is no
longer accepted, you need to use "tcp:80".

This functionality has been deprecated for a while, but as it is unlikely
that many people run twist/twistd with DeprecationWarnings enabled, most
people relying on this behaviour have unfortunately probably never seen the
warning.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] understanding twisted, better error handling

2017-01-10 Thread Tristan Seligmann
On Wed, 11 Jan 2017 at 02:26 steven meiers  wrote:

> True, but since python 2.x is still shipped with debian testing for
> example there will be some people running into this issue.
> Just to make twisted more approachable this could he handled.
>

The b'GET' syntax for byte strings works on Python 2.7 (you get a str) as
well as Python 3, so I would suggest we use it everywhere in the
documentation / examples to make it easier on programmers using both Python
2 and 3.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] treq POST abborting with: err: ('Could not adapt', '{"....", "..."} )

2017-01-08 Thread Tristan Seligmann
On Sun, 8 Jan 2017 at 01:57 Glyph Lefkowitz  wrote:

>
> I see you your standards pedantry, and raise you!
>
> MIME defines content-type to always have a charset:
>
> *https://tools.ietf.org/html/rfc1521#section-4
> *
>

RFC 1521 is obsoleted by RFC 2045 which has more nuanced semantics:
https://tools.ietf.org/html/rfc2045#section-5

But actually, HTTP is not MIME; so we should be looking here instead:
https://tools.ietf.org/html/rfc7231#section-3.1.1.1
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] treq POST abborting with: err: ('Could not adapt', '{"....", "..."} )

2017-01-06 Thread Tristan Seligmann
On Sat, 7 Jan 2017 at 03:23 Glyph Lefkowitz  wrote:

>
> Maybe we should support unicode for the body as well.  We can set the
> charset in the mime-type and everything so that it will be properly
> intelligible by the server, which doesn't happen if the user manually
> encodes like this.
>

Oh, forgot to comment on this point; in the specific case of JSON, it isn't
necessary to specify UTF-8 in Content-Type[1], but for HTML or XML it's a
pretty good idea. However, I'm not sure if it's possible to modify
Content-Type in a generic fashion to make this sort of thing work; for
example, "Content-Type: application/octet-stream; charset=UTF-8" is
nonsense. I'll defer to some HTTP experts here ;)

[1] https://tools.ietf.org/html/rfc7159#section-8.1
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] treq POST abborting with: err: ('Could not adapt', '{"....", "..."} )

2017-01-06 Thread Tristan Seligmann
On Sat, 7 Jan 2017 at 03:23 Glyph Lefkowitz  wrote:

>
> Even if we do this though - is there any way to convince json.dumps to
> behave consistently between 2/3 for the purposes of examples?
>

As far as I know, the only way to handle this is with an if PY3 or if
isinstance(…). I don't know of a way to make json.dumps on Python 2
consistently return unicode, and I don't know of a way to make json.dumps
on Python 3 return bytes.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] treq POST abborting with: err: ('Could not adapt', '{"....", "..."} )

2017-01-06 Thread Tristan Seligmann
On Fri, 6 Jan 2017 at 21:21 steven meiers  wrote:

> glyph (without seeing the the code or backtrace) suggested that:
> "I think the issue might be that it doesn't support bytes() on py3,
> it's registered against str() or something"
>

Actually, the problem is the reverse of this; only bytes is supported, but
you're passing str (unicode) in.


> somepage = yield treq.post(target_url, json.dumps({hmac: key,
> "username": username, 'pw':'', 'gender':'m', '':''}),
>

json.dumps returns str (ie. unicode) on py3; throwing in a .encode('utf-8')
here is probably what you want.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] AWS Auth v4 for Twisted?

2016-12-29 Thread Tristan Seligmann
On Fri, 30 Dec 2016 at 02:30 Steve Morin  wrote:

> Mark,
>   Did you get confirmation from your work?
>

It seems like he did; see https://github.com/twisted/txaws/pull/16 for more
details.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted 16.6.0rc1 Release Candidate Announcement

2016-11-22 Thread Tristan Seligmann
On Wed, 23 Nov 2016 at 01:14 Tristan Seligmann <mithra...@mithrandi.net>
wrote:

> On Tue, 22 Nov 2016 at 23:37 Glyph Lefkowitz <gl...@twistedmatrix.com>
> wrote:
>
>
> This is the part that I'm worried about.  It kinda seems like we're moving
> toward "native string" being the type used in IRCClient, and *that* is
> capital-W Wrong.  Native strings are for Python-native types only, i.e.
> docstrings and method names.
>
>
> Unless I'm misunderstanding, we're not "moving towards" it, we have *already
> arrived*: IRCClient deals in str (bytes) on Python 2, and str (unicode)
> on Python 3. Even if we want a unicode API, having it only exist on Python
> 3 seems incredibly confusing from a user standpoint, and would appear to
> require some absurd contortions to write client code that behaves
> approximately the same on both Python 2 and 3.
>

For example, as far as I can tell, the only way to write code to join a
channel named #tëst (UTF-8 encoded) is:

channel = u'#tëst'
if PY3:
channel = channel.encode('utf-8')
client.join(channel)

On Python 3, client.join(b'#t\xc3\xab') will try to send JOIN b'#t\xc3\xab',
which is garbage, whereas on Python 2, client.join(u'#t\xebst') will
produce a UnicodeEncodeError.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted 16.6.0rc1 Release Candidate Announcement

2016-11-22 Thread Tristan Seligmann
On Wed, 23 Nov 2016 at 01:26 Tristan Seligmann <mithra...@mithrandi.net>
wrote:

> if PY3:
>

Argh, the above should be if PY2 of course.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted 16.6.0rc1 Release Candidate Announcement

2016-11-22 Thread Tristan Seligmann
On Tue, 22 Nov 2016 at 23:37 Glyph Lefkowitz 
wrote:

>
> This is the part that I'm worried about.  It kinda seems like we're moving
> toward "native string" being the type used in IRCClient, and *that* is
> capital-W Wrong.  Native strings are for Python-native types only, i.e.
> docstrings and method names.
>

Unless I'm misunderstanding, we're not "moving towards" it, we have *already
arrived*: IRCClient deals in str (bytes) on Python 2, and str (unicode) on
Python 3. Even if we want a unicode API, having it only exist on Python 3
seems incredibly confusing from a user standpoint, and would appear to
require some absurd contortions to write client code that behaves
approximately the same on both Python 2 and 3.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted 16.4.0 Prerelease 1 Announcement

2016-08-15 Thread Tristan Seligmann
On Sat, 13 Aug 2016 at 08:19 Amber "Hawkie" Brown 
wrote:

> In a rare Twisted release double feature right after 16.3.1, I bring you
> the first prerelease of Twisted 16.4.0.
>

FWIW my $DAYJOB test suite passes against 16.4.0rc1.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted 16.3.1 Prerelease 1 Announcement

2016-08-15 Thread Tristan Seligmann
On Wed, 10 Aug 2016 at 14:48 Amber "Hawkie" Brown 
wrote:

> I've just uploaded the first prerelease of Twisted 16.3.1, a security &
> critical bug fix release of the 16.3 series. It contains:
>

FWIW my $DAYJOB test suite passes against 16.3.1rc1.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] RFC: IPv6 multicast join/ticket 6597

2016-08-04 Thread Tristan Seligmann
On Thu, 4 Aug 2016 at 18:04 Jason Litzinger  wrote:

> I did try specifying the loopback index, however, I received a
> "Network Unreachable" error.  I didn't have time to dig into whether
> it was possible to do what I wanted with the loopback interface last
> night.
>

By default, the "multicast" flag is not enabled for the loopback interface
on Linux. Does running "ip link set dev lo multicast on" help here?
(Although requiring this would then be rather problematic for testing, as
doing this in containerized environments and restricted environments like
Travis is presumably impossible)
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] New users cannot subscribe to mailing list

2016-07-15 Thread Tristan Seligmann
On Fri, 15 Jul 2016 at 20:06 Craig Rodrigues  wrote:

> Is anyone working on fixing this?
>

I believe this email explains things:
http://twistedmatrix.com/pipermail/twisted-python/2016-March/030233.html
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted 16.3.0 Prerelease 2 Announcement

2016-07-12 Thread Tristan Seligmann
On Tue, 12 Jul 2016 at 09:43 Cory Benfield  wrote:

> For that reason, you should adjust your code to use
> OpenSSLCertificateOptions or, even better, use the TLS endpoint directly.
>
> The exported name of this class is actually just "CertificateOptions",
fwiw.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Coverage exceptions

2016-07-03 Thread Tristan Seligmann
The tests directories can simply be excluded in coverage.py (or codecov), I
don't think there's any need to do something more complicated than that.

While I agree that 100% test coverage is an ideal worth aspiring to, I
think getting there from the current state is going to be a large amount of
work that yields very little benefit at this point in time; I would say
that there are more important things to spend that effort on.

On Sun, 3 Jul 2016 at 10:09 Adi Roiban  wrote:

> Hi,
>
> What decision should be made based on the feedback sent so far?
>
> Should we disabled the codecov coverage enforcement for 100% coverage for
> a patch as it also blocks missing coverage in a test?
>
> If we want to enforce only implementation code, then we need to update the
> tests to send separate reports for implementation and testing... and this
> is not done yet.
>
> Disabling/Enabling codecov.io merge protection is done here
> https://github.com/twisted-infra/braid/issues/213
>
> 
>
> I would argue that testing code should have the same quality standards as
> the implementation code and hence also go for 100% coverage.
>
> It will help detect code which is never executed and which later might get
> out of sync or might break. This include mocked code which is out of sync
> or tests which are skipped on all builders and which will get out of sync
> and fail (ex our apidoc builder tests).
>
> It will also simplify the reporting infrastructure ... and we are
> already short-handed so a simple infrastructure should help move things
> forward much faster.
>
> --
> Adi
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] two minor things

2016-06-22 Thread Tristan Seligmann
On Wed, 22 Jun 2016 at 10:05 Glyph  wrote:

>
> If we are going to change this, I would really appreciate it if someone in
> favor of the change would write a script to re-name the literally thousands
> of outstanding branches to the new convention, so we don't have a random
> mix.  Luckily git makes this considerably more light weight, since it just
> changes the name of the pointer and doesn't create new revisions :-).
>

I think most of the "outstanding branches" are actually merged, and need to
be deleted. So maybe a script to do that first...? (Sorry, I'm not likely
to get around to this any time soon)
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted Challenge Coins!

2016-06-15 Thread Tristan Seligmann
I'll take 5 coins. I'm in South Africa, but I have a US forwarding address
(in Florida) that can be used to simplify logistics.

On Wed, 15 Jun 2016 at 03:46 Ashwini Oruganti 
wrote:

> Hello!
>
> We are planning to get us some challenge coins, which is exciting! You
> should also be excited with us because this means:
>
> - we can now give it out to contributors at sprints and meetups.
> - challenge coins are awesome.
>
> Each coin costs about $6, and the minimum order is 100 coins. Glyph thinks
> everyone should have some to give out as tokens of appreciation to other
> contributors, and glyph's thoughts are usually worth following.
>
> So, if you are a Twisted contributor and would like to own a challenge
> coin, please respond to this email. Also, do mention how many coins you
> would like, and where you are located so that we can send you your coin(s).
>
>
> -ashfall
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] overview: new review queue venue

2016-05-22 Thread Tristan Seligmann
Note that even without the bot, I believe you can just create a new PR for
the same branch, so it's not *too* bad, but definitely a little clunky.

On Mon, 23 May 2016 at 06:59 Amber "Hawkie" Brown 
wrote:

> Mark has been working on a bot which would reopen it with a comment:
> https://github.com/markrwilliams/txghbot
>
> - Amber
>
> > On 23 May 2016, at 12:56, Craig Rodrigues 
> wrote:
> >
> > I submitted this PR, which is now closed:
> https://github.com/twisted/twisted/pull/62
> >
> > I don't want to re-open that PR, but I am using that as an example
> > As an example, if I wanted to re-open that, how would I go about doing
> it?
> >
> > I am not an administrator of the Twisted GitHub project, so on that web
> link,
> > there is no option for me to re-open the PR.
> >
> > Are you suggesting that I would need to
> >-> create a new branch in my repo with new commits
> >-> create a new pull request
> >
> > ?
> >
> > --
> > Craig
> >
> > On Sun, May 22, 2016 at 9:39 PM, meejah  wrote:
> >
> > closing a PR with a nice note explaining, "please re-open when X is
> > fixed/changed" scares away a potential contributer I have my doubts as
> > to whether they would fix X if you *didn't* close it...)
> >
> > ___
> > Twisted-Python mailing list
> > Twisted-Python@twistedmatrix.com
> > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] overview: new review queue venue

2016-05-22 Thread Tristan Seligmann
On Sun, 22 May 2016 at 10:12 Ralph Meijer  wrote:

> On May 22, 2016 9:36:28 AM GMT+02:00, Glyph 
> wrote:
> >[..]
> >(Please nobody try to do the clever thing where you configure buildbot
> >to automatically pull all PRs, that would effectively negate any
> >security protections...)
> >
> >I've been assuming that in the worst-case scenario, we'd do what
> >Cryptography does and have a bot that polls for special comments and
> >then triggers buildbot in exactly this way.  Perhaps I should have made
> >that assumption explicit, I thought it was ticketed somewhere in Braid
> >already.
>
> The Jenkins plugin for GitHub PR triggers has this feature, too. However,
> it also has a feature to whitelist users and GitHub teams so that
> PRs/commits can trigger automatically for them. Maybe that's a thing for
> us, too?
>

I don't think we need a whitelist, we can just automatically build branches
that are pushed to the twisted/twisted repository. If you can push a branch
there, you can also push a change directly to trunk, so you can already
execute arbitrary code on the buildbots.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] [ALL OK] [INFRASTRUCTURE OUTAGE] Moving from SVN to Git

2016-05-10 Thread Tristan Seligmann
On Tue, 10 May 2016 at 20:38 Paweł Miech  wrote:

> Hello Amber,
>
> > we've moved to https://github.com/twisted/twisted as our
> "authoritative" mirror.
>
> are there any consequences of this for Twisted users and/or casual
> contributors?  I used github source for a while not knowing it was not
> "authortiative" mirror, it always seemed fresh and updated.
>

The git mirror has been updated from the Subversion repository on commit
for quite a while, so it was up to date, it just wasn't the correct place
for committers to push changes to; this is what has changed now.

I just got done editing a bunch of the wiki pages about the development
process, primarily https://twistedmatrix.com/trac/wiki/TwistedDevelopment —
so hopefully it should be clearer how to proceed now.


> I remember some discussion on mailing list about moving issue tracking to
> github, is today's migration part of this process? Are there plans to
> accept pull requests on github?
>

The main remaining problem with pull requests is that a committer has to
push a branch to the main repository in order to run builds on the
buildbots; this is due to issues around executing arbitrary code on the
buildbots. Thus a PR-based workflow for non-committers currently doesn't
make much sense.

Issue tracking remains on Trac, at least for the forseeable future
(implementing our workflow with GitHub issues is quite challenging).
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] [ANN] txacme 0.9.0, zero-configuration HTTPS for your Twisted app!

2016-04-09 Thread Tristan Seligmann
txacme[0][1] provides a TLS endpoint to automatically issue (and renew)
certificates via the Let's Encrypt CA, allowing you to effortlessly turn on
HTTPS for your application. A brief demonstration can be seen here:
https://asciinema.org/a/41758

In support of this, txacme also includes a client implementation of
the draft-ietf-acme-acme-01[2] specification, and a service for
automatically checking and reissuing expired certificates. If the default
zero-configuration endpoint doesn't do what you want, then go wild with
these.

If you have any interest at all in txacme, please take a look at the
currently provided API, and ask questions and/or file issues on GitHub
should there be any aspects of your potential use case that are not covered
by the API as it stands; I would like to use the 0.9.x period to get a
solid API nailed down for the 1.0 release.

[0] https://pypi.python.org/pypi/txacme

[1] https://github.com/mithrandi/txacme

[2] https://tools.ietf.org/html/draft-ietf-acme-acme-01 — support
for draft-ietf-acme-acme-02 will probably be forthcoming once Let's Encrypt
actually supports this server-side.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] where can I find twisted.application.internet.ClientService?

2016-03-26 Thread Tristan Seligmann
On Sun, 27 Mar 2016 at 04:17 Gelin Yan  wrote:

>
>
> https://twistedmatrix.com/documents/16.0.0/api/twisted.application.internet.ClientService.html
>

Unfortunately ClientService did not make it in time for 16.0.0, but it will
be in the upcoming 16.1.0 release :)
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Intended semantics of IReactorTime.seconds

2016-03-26 Thread Tristan Seligmann
Currently, as far as I can tell, all implementations of
`IReactorTime.seconds()` (excluding twisted.internet.task.Clock, obviously)
are just `time.time()`; IOW, the return value is the number of seconds
since the beginning of the UNIX epoch in UTC. Are these the intended
semantics? The interface docstring doesn't really make this clear at all.

There's some commented out code which suggests the implementation used to
be `time.clock()` on win32, which would not satisfy these semantics.

(The background for this question is that I'm writing some code which takes
an IReactorTime provider for testing purposes, and I'm wondering if I need
a separate provider of `datetime.now()` functionality or not)
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] A little present for emacs / flycheck users

2016-02-09 Thread Tristan Seligmann
The 'python-mode-hook is just a function, so you can put whatever code you
want in there. I'm not sure exactly what the best mechanism to control this
would be, though; maybe a directory variable?

On Tue, 9 Feb 2016 at 15:17 Jonathan Lange <j...@mumak.net> wrote:

> Thanks! https://launchpad.net/twisted-emacs is the best I could find re
> PRs.
>
> Do you have a way to make this conditional? There's precisely one Python
> project where I care about using the twistedchecker linter :)
>
>
> On Tue, 9 Feb 2016 at 07:12 Tristan Seligmann <mithra...@mithrandi.net>
> wrote:
>
>> You may find this to be of use:
>>
>> https://gist.github.com/mithrandi/15fca4367e878b6b88cd
>>
>> Is there somewhere I should be submitting this as a PR or something? (I
>> guess I could release the checker as an emacs package, it's somewhat
>> specific though)
>>
> ___
>> Twisted-Python mailing list
>> Twisted-Python@twistedmatrix.com
>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>>
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] A little present for emacs / flycheck users

2016-02-08 Thread Tristan Seligmann
You may find this to be of use:

https://gist.github.com/mithrandi/15fca4367e878b6b88cd

Is there somewhere I should be submitting this as a PR or something? (I
guess I could release the checker as an emacs package, it's somewhat
specific though)
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Suggested plan for GitHub migration

2015-11-30 Thread Tristan Seligmann
On Mon, 30 Nov 2015 at 16:50 Amber "Hawkie" Brown 
wrote:

> The migration will have a handful of policy changes that we will have to
> resolve -- such as ensuring that all merges have a topfile -- which aren't
> possible under a GitHub based system.


You could make master/trunk/whatever a protected branch, and have a
required status check for this, but that would require some external CI
thing that actually performs the status check.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] HTTP/2 and Twisted

2015-11-13 Thread Tristan Seligmann
On Thu, 12 Nov 2015 at 12:46 Cory Benfield  wrote:

> However, this may not work: in particular, some of the other classes in
> twisted.web may know altogether too much about HTTP/1.X: in particular, if
> they have the nerve to write directly to a transport we’ve got a real
> problem with this approach, as HTTP/2 does not allow naked writes on its
> sockets (all data is framed).
>

I'd like to point out a few things on this topic:

1) The Twisted project has already experimentally demonstrated the
imprudence of an approach that massively breaks backwards compatibility
with old APIs (even if it does this in concordance with the compatibility
policy, by adding a bunch of new things): see the defunct twisted.web2
project.

Realistically, if you say "hey people, twisted.web now has HTTP/2 support,
all you have to do is port all of your code and all of your libraries over
to these new APIs!", the response isn't going to be "great, I'll get right
on that!". It'll be "oh well, I guess I'll just throw an nginx reverse
proxy in front of my app to get HTTP/2 working" or "oh well, never mind
then".

A successful approach to introducing HTTP/2 into twisted.web needs to allow
for hooking up existing resources to an HTTP/2 (or actually, presumably
multiprotocol) server.

2) Having said that, it's not necessary for the HTTP/2 server to be
completely compatible with the current HTTP/1.x server in twisted.web. For
some things, this is just flat out impossible (I believe there are things
that HTTP/1.x allows, but HTTP/2 doesn't allow), and for other things it
just doesn't make sense (stealing the transport and writing stuff to it
yourself). However, we only need to support the common set of things that
people use in order to be usefully compatible; if you just have some
resources that aren't doing anything particularly crazy (like hijacking the
transport and writing directly to it, rather than via the request object),
you should be able to hook them up and have them work.

For anything that we *can't* support, it's okay for the HTTP/2 server to
just raise an exception or whatever; for anything that we can reasonably
support, but don't actually want to, it's okay to emit a deprecation
warning, and later an exception.

3) Having said *that*, there is widespread agreement that the existing APIs
(IResource, IRequest, etc.) have numerous deficiencies that should be
addressed. For example, the current interfaces don't allow for streaming
request handling, which obstructs implementing 100-continue support (among
other things).

We *do* need newer interfaces which hopefully improve on the new ones; I
don't really feel like I'm in a position to sketch out what these
interfaces should look like, but they should definitely take into account
the constraints of the HTTP/2 protocol, as well as the needs of application
code.

PS: I've used the pronoun "we" multiple times in this email for the sake of
rhetorical convenience, but please don't let this dissuade anyone from
voicing disagreement with any of the claims I've made should they appear
incorrect.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] An error occurred with twisted 15.2.1 python 3.4.3 on windows

2015-07-28 Thread Tristan Seligmann
On Mon, 27 Jul 2015 at 13:18 Gelin Yan dynami...@gmail.com wrote:

   Is it a bug?


Yes; see https://twistedmatrix.com/trac/ticket/7626 for more details.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] broken buildbots

2015-06-06 Thread Tristan Seligmann
On Sun, 7 Jun 2015 at 03:43 Glyph gl...@twistedmatrix.com wrote:


 On Jun 6, 2015, at 6:40 PM, Glyph gl...@twistedmatrix.com wrote:

 https://buildbot.twistedmatrix.com/buildslaves/hawkowl-debian7-py34 -
 which is apparently maintained by Your Name Here 
 admin@youraddress.invalid - is presently failing all its builds because
 it is running out of memory.  Can someone with access to this box, whoever 
 admin@youraddress.invalid is, please free up some RAM?

 -glyph


 Oh, I spoke too soon.  All the ENOMEMs are coming out of os.fork, which I
 guess means somehow process spawning got disabled?  I am wondering if the
 buildslave has lingering subprocesses hanging out and blowing its cgroup
 quota inside its docker container (these are running inside docker, right?)


ENOMEM on fork() can just mean that overcommit is disabled and there is
insufficient virtual memory available to temporarily accomodate 2x the
process's memory size, even though there is enough memory available to
accomodate 1x.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Multiple plugins in twistd

2015-05-21 Thread Tristan Seligmann
On 21 May 2015 at 04:31, Moshe Zadka zadka.mo...@gmail.com wrote:
 [2a] Since the docstrings do refer to the parent attribute, and since I
 would be surprised if services just implemented the interface without
 inheriting from Service, I wonder if people object *too* much if I fix
 it by documenting the parent attribute as part of the interface?

For what it's worth (not sure if a single anecdote is helpful), almost
none of my IService implementations inherit from Service (mainly
because multiple inheritance is awkward, and they already want to
inherit from axiom.item.Item). However, I'm pretty sure they all have
the parent attribute.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] INCOMPATIBLE CHANGE: Removing PAM support from Twisted

2015-05-10 Thread Tristan Seligmann
On 11 May 2015 at 06:35, Glyph gl...@twistedmatrix.com wrote:
 I'm very much in favor of an outright removal in this case, so consider me 
 signed off.  Given the gnarly security implications of this thing I would 
 take the unusual step of continuing to approve of removal even if we have a 
 real-life user who might be impacted.

 That said, lack of actual PAM support (and more generally, 
 platform-integrated user authentication mechanisms) is a sore spot and we 
 should add something less terrible when we can.

What glyph said :)
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Fwd: Adding callbacks using loop variables

2015-05-06 Thread Tristan Seligmann
On 6 May 2015 at 10:26, Saoili sao...@gmail.com wrote:
 Eg. code BEFORE
 for loop_var in a_dict['loop_vars']:
 d = self.returns_a_deferred(loop_var[x])
 d.addCallback(
 lambda ret_val: self.do_another_thing(
 other_param, loop_var.copy(), ret_val
 )
 )
 _dlist.append(d)
 return defer.DeferredList(_dlist)

 Eg. code AFTER
 def other_func(ret_val, other_param, loop_var):
 return self.do_other_thing(
 other_param, loop_var, ret_val
 )

 for loop_var in a_dict['loop_vars']:
 d = self.returns_a_deferred(loop_var[x])
 d.addCallback(other_func, other_param, loop_var)
 _dlist.append(d)
 return defer.DeferredList(_dlist)

There's another common trick for dealing with this, that relies on the
fact that default argument values are evaluated when the lambda
expression itself (not the body of the lambda!) is initially
evaluated; basically, just add an extra parameter with a default value
of the loop variable. For example:

 for loop_var in a_dict['loop_vars']:
 d = self.returns_a_deferred(loop_var[x])
 d.addCallback(
 lambda ret_val, loop_var=loop_var: self.do_another_thing(
 other_param, loop_var.copy(), ret_val
 )
 )
 _dlist.append(d)
 return defer.DeferredList(_dlist)

However, separating the code out into a separate function may serve to
make the code clearer.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] [ANN] clj-amp 0.9.0

2015-04-01 Thread Tristan Seligmann
I am pleased to announce the release of clj-amp 0.9.0[1][2], a Clojure
implementation of the AMP[3] protocol (a reference implementation of
which is found in Twisted). While slightly off-topic for this list,
this project may be of interest to anyone with AMP services they would
like to interoperate with from Clojure code. Also, this is the closest
thing to an AMP mailing list that exists (at least as far as I'm
aware).

Despite this being the first release, clj-amp is essentially feature
complete. The 0.9.0 version number reflects my reluctance to designate
this 1.0.0 for the following reasons:

 * Lack of users and real-world testing: the project was just released.

 * API instability: while I do not have any immediate plans to break
API compatibility, I would like to reserve the right to make API
changes based on initial feedback from users (assuming anyone uses
it...) in order to correct any glaring issues with the API that may be
discovered.

 * Minimal test coverage and documentation: I would still like to
expand the test coverage to include more specimens of AMP encodings,
as well as expand the documentation.

Any feedback on the API as well as the documentation would be greatly
appreciated.

[1] https://github.com/mithrandi/clj-amp

[2] https://clojars.org/clj-amp

[3] http://amp-protocol.net/
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Unhandled Error in python 3 test suite

2015-03-23 Thread Tristan Seligmann
On 23 March 2015 at 16:25, HawkOwl hawk...@atleastfornow.net wrote:
 It's not really a bug -- it's just that the stderr isn't being captured like 
 real Trial does. Twisted will reraise errors so they show up in logs, but 
 will actually handle them (I think, anyway). The traceback formatting just 
 says it's an unhandled error. That is, it was handled by Twisted, but it was 
 unhandled by user code, and generated an errback or such.

Note that Unhandled error in Deferred is the default log message for
log.err, and a lot (most?) of the code that logs a failure calls
log.err without passing a different message.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] __nonzero__ for Deferred

2015-03-18 Thread Tristan Seligmann
On 19 March 2015 at 00:03, Glyph Lefkowitz gl...@twistedmatrix.com wrote:
 I'd like to deprecate and remove __nonzero__ on Deferreds.

By remove do you mean add an implementation that raises an
exception? (It seems like this must be what you meant, I just wanted
to be clear since this is a slightly subtle issue)

I'm not sure offhand if I have any code that would be affected by
this, but I don't think I would have a problem considering any such
code incorrect. The most likely case I can think of is where I've
lazily written something like if d instead of if d is not None.

That is to say, +1.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Specifying ciphers in ssl.optionsForClientTLS

2015-02-17 Thread Tristan Seligmann
On 17 February 2015 at 04:19, Jason J. W. Williams
jasonjwwilli...@gmail.com wrote:
 Some browsers won’t — Firefox refuses to use RC4 :)

 I saw that on Firefox's wiki, but in reality Firefox 35 still does
 allow RC4: http://www.screencast.com/t/AuMRylAV

IIUC, Firefox 36 will only allow RC4 as a fallback (but not disable it
completely), and I think there is talk about disabling RC4 completely
for TLS 1.1/1.2.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] ANN: Axiom 0.7.3

2015-02-07 Thread Tristan Seligmann
I'm pleased to announce the release of Axiom 0.7.3. Axiom is an
in-process object-relational database for Python, built on SQLite.

This release is a bug fix release to correct another important issue;
anyone using Axiom on PyPy should upgrade as soon as possible to avoid
potential data loss in their application. For more information on this
bug, see the Github issue[1].

The release is available from PyPi as usual[2], signed with my personal key[3].

[1] https://github.com/twisted/axiom/issues/37
[2] https://pypi.python.org/packages/source/A/Axiom/Axiom-0.7.3.tar.gz
[3] https://pypi.python.org/packages/source/A/Axiom/Axiom-0.7.3.tar.gz.asc
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Retiring buildslaves

2015-02-02 Thread Tristan Seligmann
Hi buildbot infrastructure maintainers,

I am intending to retire my buildslaves (bot-idnar-debian and
bot-idnar-debian64) upon release of jessie (Debian 8.0). The proximate
cause for this is planned changes for the machines currently hosting
the slaves; but given the current situation of Twisted's buildslave
infrastructure, I don't think they're providing much value at this
point, so restoring them after my infrastructure changes doesn't seem
worth it.

I took a look at the buildmaster configuration, however I couldn't
really figure out how to unentangle them since they're currently only
being used for somewhat esoteric builders. Can someone else figure
this out for me? ;)
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] 15.0 Prerelease Reports

2015-01-16 Thread Tristan Seligmann
On 16 January 2015 at 05:42, HawkOwl hawk...@atleastfornow.net wrote:
 Does anyone have some “15.0 worked fine/had an issue/set my codebase on fire 
 via sheer brilliance” reports for me? :) If you want to try them out, you can 
 get the tarballs at http://twistedmatrix.com/Releases/pre/15.0.0pre1/ !

Ran 1116 tests in 26.381s

PASSED (skips=2, expectedFailures=1, successes=1113)

:)

(We actually deploy Twisted directly from SVN, so I don't usually test
prereleases, but it was easy enough to check)
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Axiom 0.7.2

2015-01-08 Thread Tristan Seligmann
I'm pleased to announce the release of Axiom 0.7.2. Axiom is an
in-process object-relational database for Python, built on SQLite.

This release is a bug fix release to correct an important issue;
anyone using Axiom 0.7.0 or 0.7.1 on PyPy (versions prior to 0.7.0 did
not support PyPy) should upgrade as soon as possible to avoid
potential data loss in their application. For more information on this
bug, see the Github issue[1].

The release is available from PyPi as usual[2], signed with my personal key[3].:

[1] https://github.com/twisted/axiom/issues/29
[2] https://pypi.python.org/packages/source/A/Axiom/Axiom-0.7.2.tar.gz
[3] https://pypi.python.org/packages/source/A/Axiom/Axiom-0.7.2.tar.gz.asc
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Importing/Exporting Putty and SSH.com keys

2014-11-30 Thread Tristan Seligmann
On 30 November 2014 at 18:52, Glyph gl...@twistedmatrix.com wrote:
 PuTTY does not seem to me to be very friendly to automation.

OT: for automation, you probably want Plink not PuTTY.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] natty64-py2.7maint twistedchecker builders

2014-09-20 Thread Tristan Seligmann
On 18 September 2014 07:16, Glyph gl...@twistedmatrix.com wrote:
 On Sep 17, 2014, at 8:41 AM, Tristan Seligmann mithra...@mithrandi.net 
 wrote:
 Speaking of EOL, squeeze is effectively EOL now too (unless you count
 the squeeze-lts effort, which is very limited in scope); as such, I
 would like to upgrade or retire my buildslaves (bot-idnar-debian{,64})
 which are still running squeeze. I think newer version of Debian are
 already covered by other buildslaves; so are these still needed at
 all?

 Not as far as I know.  I think you can feel free to deprovision them 
 (although I think you need to submit a PR for the buildmaster's config to 
 remove them from the buildmaster and supported list)

Is the buildmaster's config in a publically accessible repo? If so,
where? (If not, how do I get access?)
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] natty64-py2.7maint twistedchecker builders

2014-09-17 Thread Tristan Seligmann
On 17 September 2014 02:14, Glyph Lefkowitz gl...@twistedmatrix.com wrote:
 For what it's worth, the EOL on Natty was almost 2 years ago now:

 https://wiki.ubuntu.com/Releases

Speaking of EOL, squeeze is effectively EOL now too (unless you count
the squeeze-lts effort, which is very limited in scope); as such, I
would like to upgrade or retire my buildslaves (bot-idnar-debian{,64})
which are still running squeeze. I think newer version of Debian are
already covered by other buildslaves; so are these still needed at
all?
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Who's doing the merges for reviewed and blessed pull requests at twisted/nevow?

2014-08-12 Thread Tristan Seligmann
On 12 August 2014 03:45, Werner Thie wer...@thieprojects.ch wrote:
 Mahalo for enlightening me, Werner

I'm one of the people with write (commit?) access to Nevow. I just
approved and merged your pull request; sorry for taking so long to get
back to this.

I'm not exactly sure where GitHub shows who has write access to a
repository, maybe somebody else knows.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] tor hidden service endpoint parser returns a deferred

2014-05-02 Thread Tristan Seligmann
On 2 May 2014 15:59, David Stainton dstainton...@gmail.com wrote:
 This will work fine for the txsocksx tor client endpoint parser I
 wrote... However the txtorcon Tor Hidden Service endpoint setup
 requires a deferred to fire once the tor process is started... This
 means that the endpoint parser needs to return a deferred. But this
 breaks the interface!... meaning that foolscap or any other api using
 this onion endpoint parser will have to special case the situation
 where serverFromString returns a deferred.

I think you're approaching this from the wrong angle; instead of
starting the tor process during parsing of the endpoint, I think it
would make more sense to start the tor process when the endpoint is
started.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Manhole but no SSH

2014-04-15 Thread Tristan Seligmann
On 16 April 2014 00:09, Nicholas nicho...@alienretro.com wrote:
 Hello, everyone.

 Is it possible to implement the Manhole but without using SSH (or telnet,
 for that matter) ?

 Say I start a service and I want to be thrown straight in a console, much
 like Manhole does with SSH, but without having to actually listen on a port
 and having to connect to it with an user and password.

This sounds a lot like `python -m twisted.conch.stdio`; I'm not sure
how easily reusable that code is, but hopefully it shouldn't be too
hard to use from an existing application!
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Buildslave outage

2013-10-23 Thread Tristan Seligmann
Hi all,

Sorry for the short notice. My buildslaves (bot-idnar-debian{,64})
will be down for the next 8 hours or so, due to the host systems being
moved to another datacentre.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Python 3: bytes vs. str in twisted.python.filepath

2013-07-14 Thread Tristan Seligmann
On Sun, Jul 14, 2013 at 4:00 AM, Harry Bock bock.har...@gmail.com wrote:

 (b) Misunderstandings at the application level about the underlying
 filesystem's path encoding is not the problem of the Twisted API.  Correct
 me if I'm wrong, but that's the responsibility of the system administrator
 or individual user (at least on UNIX) to set the LANG environment variable,
 or for the application to call setlocale(3) to explicitly override it.


There is no way to enforce a particular setting of the LANG environment
variable globally; multiple users could use filenames encoded in different
encodings (in fact even a single user could do this), and files could be
transferred from other systems using different encodings. While a
reasonable person might insist on the use of UTF-8 everywhere, there is no
way to guarantee that UNIX filenames are all in the same encoding, or are
even in any particular encoding at all (they might be binary non-text
garbage), and the inability to deal with filenames like this would be
somewhat of a serious defect.

On Windows, the reverse situation obtains, of course.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Release questions

2013-04-03 Thread Tristan Seligmann
On Wed, Apr 3, 2013 at 11:58 PM, Laurens Van Houtven _...@lvh.cc wrote:

 Is the accidental corruption thing a real risk? I thought that was the
 point of, say, TCP checksums :) Perhaps I'm just mistaken as to how often
 his happens in the wild...


TCP checksums don't protect you against corruption occurring on the server
or client, only corruption by intermediary routers (and if they recalculate
the checksum, not even that). In practice, the most common form of
accidental corruption I've encountered is truncation; many HTTP user agents
don't report any kind of error when fewer bytes are received from the
server (due to prematurely terminated HTTP connection, bad proxy server,
etc.) than expected.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] eated traceback when decorate method already decorated by inlineCallbacks

2013-03-15 Thread Tristan Seligmann
On Thu, Mar 14, 2013 at 4:20 PM,  exar...@twistedmatrix.com wrote:
 except:
 Failure.printTraceback()

I think this was supposed to be:

except:
Failure().printTraceback()

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Tristan Seligmann
On Sat, Mar 2, 2013 at 3:46 PM, Phil Mayers p.may...@imperial.ac.uk wrote:
 AMP would be somewhat more attractive (to me) if it were possible to run
 with the IDL just on the server (i.e. callee); this would achieve the
 goal of protocol-level sanity checking, without the cost of having to
 distribute the IDL to the clients. Presumably it would be possible to
 implement this now - have an AMP discovery command that dynamically
 builds the client-side IDLs. But there's no incentive for me to do that.

I don't really understand how this is any easier with PB than with
AMP, though. With AMP, you just need the same command definitions on
both sides. With PB, you need the exact same Python code versions for
every class you are sending over the wire; if achieving this is not a
problem, then why is it problematic to get the same AMP command
definitions on both sides?

 You don't need to do a TCP handshake for every request in any of those
 protocols either. Long-lived TCP/HTTP sessions are quite common, though
 not universal.

You don't quite have to do a TCP handshake for every request you want
to send over an HTTP channel, but there are still some problems.
Connection keep-alive means you can send another request after you
have received a response, without reconnecting; pipelining means you
can send another request right away, but you still won't get the
response until after you receive the first response. In addition,
there are various error handling situations where you are basically
forced to close the connection and open a new one. By contrast, an AMP
connection can have any number of AMP request/response exchanges in
flight at one time, in either direction; the closest thing to this in
HTTP-land is SPDY's connection multiplexing, but that's still
asymmetric (client makes requests to the server, server cannot make
requests to the client, so you need to do some kind of long polling /
inversion of control to simulate this).
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Tristan Seligmann
On Sat, Mar 2, 2013 at 6:36 PM, Phil Mayers p.may...@imperial.ac.uk wrote:
 On 03/02/2013 03:24 PM, Tristan Seligmann wrote:

 I don't really understand how this is any easier with PB than with
 AMP, though. With AMP, you just need the same command definitions on
 both sides. With PB, you need the exact same Python code versions for
 every class you are sending over the wire;

 I don't use PB like that. I only ever send simple data structures made
 of builtin types (int, str, list, dict).

Interesting; I guess that's obvious in retrospect but I hadn't thought
of using PB like that, and I suppose it's not possible to use AMP like
that.

 You don't quite have to do a TCP handshake for every request you want
 to send over an HTTP channel, but there are still some problems.

 You're not telling me anything I don't already know.

 My point is that, for the use-cases *I* have, those limitations have not
 proven to be a problem, so the effort of deploying a protocol which avoids
 those limitations is not warranted.

Sure, I didn't mean to imply otherwise, just wanted to clarify for the
purposes of the discussion. It sounds like your analysis is sound for
the use cases you're concerned with, I don't have any objection to
that.
--
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] How to dispatch message to different servers

2013-03-02 Thread Tristan Seligmann
On Sat, Mar 2, 2013 at 10:34 PM, Laurens Van Houtven _...@lvh.cc wrote:
 Could you help me write an AMP implementation in Javascript? It's easy,
 right? ;-)

It can't be harder than writing a PB implementation in JavaScript ;)
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted client memory leak

2013-01-22 Thread Tristan Seligmann
On Tue, Jan 22, 2013 at 3:06 PM, Diego Woitasen di...@woitasen.com.ar wrote:
 I reproduce the problem with a modification of Echo client example
 from Twisted documentation:

Adding __del__ methods causes the object to become uncollectable if it
forms part of a reference cycle. Thus it is almost always a bad idea
to add __del__ methods when attempting to debug a space leak, as the
most likely outcome is that you introduce a _new_, _different_ leak to
the one you are trying to debug.
--
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Layer 2 and Twitsted

2013-01-15 Thread Tristan Seligmann
On 15 Jan 2013 7:41 PM, outcast james.voip+twis...@gmail.com wrote:

 Greetings,

 Has anyone done any work around using twisted for layer 2 traffic?

Layer 2 traffic would be the domain of twisted.pair; I'm not aware of
anyone using this in a real project, though, and I'd wager it needs some
extra work before it'll be useful for most purposes.
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] a question about monotonic clock

2012-10-29 Thread Tristan Seligmann
On Mon, Oct 29, 2012 at 10:33 AM, Phil Mayers p.may...@imperial.ac.uk wrote:
 On 10/28/2012 10:16 PM, Tristan Seligmann wrote:
 On Mon, Oct 29, 2012 at 12:05 AM, Phil Mayers p.may...@imperial.ac.uk 
 wrote:
 Sadly, this is not the case. As has already been pointed out, virtual
 machine clocks can undergo stepping in normal oepration. A specfic
 example: if a VMWare installation performs live migration of a host. We
 often see:

 ntpd[1793]: time reset +0.263757 s

 ...when this happens. This can occur several times a day, as we're
 running vCenter-controlled auto-migration - a very common setup. This is
 forward stepping of course, so is relatively harmless (backward is a pain).

My original reply was perhaps a bit... exclusionary. But I think the
point I was trying to make is still valid; if your VM is suspended for
250ms due to a migration (or CPU throttling, or ...) then it is
impossible to maintain a consistent stream of time events because
there isn't any code executing at all. Whether the clock stalls, or is
jumped forward 250ms, you still have an unavoidable problem as far as
time-keeping is concerned.

 Who knows what newer implementations like chrony or openntpd do!

 If they're doing something silly, then maybe you shouldn't use them.

I didn't intend it that way, but I can see how what I said could be
read in a hostile / defensive tone. Perhaps this would be a better
phrasing:

If chrony or openntpd are doing something sensible, then there
shouldn't be any serious issues with using them; if they're doing
something that seriously destabilizes the system clock, then you
probably shouldn't be using them, at least not if you want reliable
timekeeping. I'm not familiar enough with either of them to know which
case applies, so I didn't intend to come across as bashing chrony
and/or openntpd.

 Maybe Twisted doesn't need a monotonic clock is the right reply, but
 it would be wrong to base that on the assumpton that ntpd doesn't step
 - that's all I was trying to say.

I don't think anyone in this thread is arguing *against* implementing
this functionality; I think the point was just that this functionality
is only of critical importance under a limited range of circumstances,
as opposed to being something of urgent need for every Twisted-using
program that needs to schedule timed events.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] a question about monotonic clock

2012-10-28 Thread Tristan Seligmann
On Sun, Oct 28, 2012 at 5:22 PM, Christopher Armstrong
ra...@twistedmatrix.com wrote:
 I think that for *certain* uncommon types of applications, even the very
 minor skewing of ntp can cause problems, but I wonder if gelin yan has

I'm having trouble imagining such an application. In particular, if
the application is sensitive to such minor fluctuations in the time
source, I don't see how it could operate on commodity hardware at all;
such fluctuations are present regardless of whether ntp is slewing the
clock or not. You would need to use a separate hardware time source
that is more reliable, at which point ntp is essentially out of the
picture.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] a question about monotonic clock

2012-10-28 Thread Tristan Seligmann
On Mon, Oct 29, 2012 at 12:05 AM, Phil Mayers p.may...@imperial.ac.uk wrote:
 This depends on how you're running ntpd. If you have -x on the command
 line, yes - ntpd will not step.

 If not, there are circumstances it will step - clock diffs in excess of
 128ms iirc?

If an offset of 128ms occurs at any time other than initial ntpd
startup (which will presumably occur at system startup), that means
you've either experienced a significant period of time without
connectivity to time servers[1], you have a hardware / kernel issue
that should be resolved, or some other software on the system is
messing with the clock. Aside from network issues, the other
possibilities are all serious issues that should be corrected, not
tolerated as a normal situation.

 Who knows what newer implementations like chrony or openntpd do!

If they're doing something silly, then maybe you shouldn't use them.

[1] Well, haha, just kidding; if this happens, then ntpd will remove
the servers as being unreachable, and terminate once they have all
been removed, thus resulting in the need to restart ntpd...
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] implementing NAMES in IRC

2012-09-11 Thread Tristan Seligmann
On Tue, Sep 11, 2012 at 6:05 AM, Glyph gl...@twistedmatrix.com wrote:
 Such a bug may already exist - if you wouldn't mind, would you search for
 it, and if you can't find it, file a new one?

I don't know if there's an existing bug or not, but implementing a
names() method is problematic. The natural API would be something like
names('#foo') - Deferred firing with a list of names in the channel.
The difficulty in implementing this comes from the fact that there are
two possible results from issuing a NAMES command on IRC: a serious of
zero or more RPL_NAMREPLY messages followed by an RPL_ENDOFNAMES
message, *or* any error message the IRC server feels like. There are a
number of partial workarounds for this, involving various combinations
of queues, timeouts, and unreliable detection of responses, but none
of them seem particularly satisfactory to me.

(On the other hand, a method that just sends NAMES #foo without any
response handling would be pretty straightforward to implement, maybe
that's what you meant?)
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] implementing NAMES in IRC

2012-09-11 Thread Tristan Seligmann
On Tue, Sep 11, 2012 at 3:43 PM,  exar...@twistedmatrix.com wrote:
 This is the excuse that is always given for not implementing a new
 feature on `IRCClient`.  However, here's another equivalent way of
 stating the objection:

   IRC is a terrible protocol and it is very difficult to implement a
   method like `names` reliably, due to the various vague and obscure
   corner cases presented.  Therefore, instead of Twisted tackling this
   problem and providing a single (perhaps imperfect) implementation,
   every single IRC application developer should instead rediscover this
   sad reality for themselves and then implement their own uniquely buggy
   version of this functionality.

Actually, my recommendation would be to avoid trying to implement
functionality of this nature in any application at all. The only way
to reliably use the NAMES command is the way
twisted.words.im.ircsupport and real IRC clients do: handle
RPL_NAMREPLY / RPL_ENDOFNAMES without regard to any NAMES command you
may or may not have issued, and then issue a NAMES command at certain
points without any regard for a response that may or may not be sent
to you by the IRC server. Having said that, I guess IRCClient could
handle the parsing of RPL_NAMREPLY / RPL_ENDOFNAMES messages into a
single list of names, which could then be delivered as a single event.

My main concern with most of the more complex implementation
strategies is that they impose a non-zero cost on users of IRCClient,
as well as encouraging the implementation of unreliable features; at
the very least, I think anti-IRC code like this should be an extra
layer on top of the basic IRC protocol implementation.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] implementing NAMES in IRC

2012-09-11 Thread Tristan Seligmann
On Tue, Sep 11, 2012 at 6:46 PM, Glyph gl...@twistedmatrix.com wrote:
 So... you're recommending exactly what twisted.words.im already does? :)

Well, yeah: The only way to reliably use the NAMES command is the way
twisted.words.im.ircsupport [already does] :)

 Keep in mind that we can assume to have control over outgoing traffic on our 
 own IRC connection.  If you've already issued one .names(), then another 
 outgoing one doesn't have to send an additional command and try to do weird 
 Deferred-stacking stuff.  It just has to delay sending the actual NAMES 
 request until the previous one has come back, or perhaps just fire both 
 Deferreds with a single response.

On the other hand, if you're writing code that doesn't need to match
requests and responses, you should be able to issue another NAMES
command before the previous one has completed (and bear in mind, if
you want to queue NAMES requests independently of other requests, the
only ways for it to complete will be 1. RPL_ENDOFNAMES and 2.
timeout). That's why I would prefer this not to be baked into the
lowest level of the IRC client API. My earlier responses were probably
worded too harshly; people *are* going to attempt to implement things
like this, no matter how much of a bad idea it might be, so going
LALALALA WE WON'T LET YOU won't improve things. On the other hand, the
compromises needed to do things this way probably shouldn't penalize
people who are doing it the right way (insofar as anything about IRC
can be said to be right).
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] twisted server config: command line, environment or Axiom?

2012-08-08 Thread Tristan Seligmann
On Wed, Aug 8, 2012 at 3:58 PM, Laurens Van Houtven _...@lvh.cc wrote:
 (3) has the downside that it conflates user data with configuration data. I'm 
 not sure that's a good thing or not. It sounds very similar to axiomatic, 
 which I've heard of, seen, but never played with.

As exarkun mentions in his reply, you don't have to store the
configuration and user data in the same Axiom store. If you're
interested, the way axiomatic start works is that it locates all
IService powerups on the store you pass it (which would be the site
store, in Mantissa), and attaches those to the application. I think
most of the interesting IService implementations are in Mantissa, not
Axiom, but axiomatic itself does not depend on Mantissa and of course
there's no reason you can't write your own IService powerups.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Buildslave upgrades

2012-02-28 Thread Tristan Seligmann
I'd like to upgrade bot-idnar-debian64 from Debian lenny (5.0) to
squeeze (6.0). I think this host was previously kept back to test
Python 2.4 support on Debian, but it looks like the only thing it's
doing now is building pyopenssl, and I don't think that particularly
needs to be tested on lenny. I'll probably wait a week or two, and if
nobody objects, go ahead with the upgrade the next time I remember
about the host.

I'm also looking into upgrading the buildbot version on both of my
slaves (bot-idnar-*) to 0.8.5.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] accurate periodic call

2012-02-21 Thread Tristan Seligmann
On Tue, Feb 21, 2012 at 1:05 PM, Phil Mayers p.may...@imperial.ac.uk wrote:
 I realise this is tricky to solve, but I'll note it's not impossible for
 really REALLY big clock skews to happen. For example: recently we had a
 server kernel panic and need a cold reboot. The machine booted and read
 it's time from the CMOS clock, which was way WAY out. A minute or two
 after the machine had booted, NTP slewed the clock back by months...

This is kind of a nitpick, but I think it's a fairly important one:
slewing the clock refers to a process where the clock frequency is
adjusted to make it run faster or slower in order to catch up or lose
a few seconds, without any discontinuities in the clock. This is a
relatively slow process, so slewing the clock by months would take
millennia; instead, beyond a certain threshold (I think a few
seconds?), ntp will always step the clock, not slew it, which is when
applications start running into difficulty as stepping introduces a
discontinuity in the clock.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] xmlrpc function return message to client asynchronously

2012-01-19 Thread Tristan Seligmann
On Thu, Jan 19, 2012 at 6:41 PM, Hanusz L. han...@aegtranzcom.com wrote:

 I'd like to create a xmlrpc function get_message with the following 
 characteristic :
  - If the server doesn't have any message to send the client, the server will 
 answer with a timeout after 60s (and the client can retry)
  - If the server has a message to send to the client, the answer is sent 
 directly

 To do that, can I do the following:
 - create a deferred in the xmlrpc function with a calllater of 60s and keep a 
 reference to this deferred in the factory
  * If the server has no message to send, the deferred will be called by the 
 reactor and answer a timeout
  * If the server has a message to send, it will call the deferred in his own 
 code (with a parameter ?) before the reactor and answer the message.

The object returned by callLater() provides the IDelayedCall[1]
interface. If you keep a reference to this object as well as the
deferred, then you can cancel the call when you return a response by
calling the .cancel() method.

[1] 
http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.IDelayedCall.html
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] telnet works, why wont this client/protocol test?

2012-01-12 Thread Tristan Seligmann
On Thu, Jan 12, 2012 at 8:57 PM, Augusto Mecking Caringi
augustocari...@gmail.com wrote:
 Right.

 But there is an interesting fact:

 nc and openssl s_client, two utilities that I use every day to
 connect to diferent types of servers send only LF as default...

nc and openssl s_client read bytes from stdin and send them on
exactly as-is; it's your terminal that is sending LF. The reason
openssl provides an option to translate LF to CRLF is that this is
often useful when testing line-oriented network protocols
interactively, but this just underscores the point; if you want to
communicate with a network server that expects CRLF, you should send
CRLF from your client, not expect every server out there to accept LF
as an alternative line ending.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Twisted plugins vs Python packaging

2011-09-21 Thread Tristan Seligmann
I just kicked off a discussion (hopefully, anyway; it may turn out to
be a flamewar...) on distutils-sig[1] about $SUBJECT, continued from a
pip bug report I filed[2]. If you're interested in making Twisted play
better with the current crop of Python packaging systems and tools,
please follow along and/or chime in.

[1] http://mail.python.org/pipermail/distutils-sig/2011-September/018031.html

[2] https://github.com/pypa/pip/issues/355
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] [Divmod-users] [ANN] Pyflakes 0.5.0

2011-09-05 Thread Tristan Seligmann
On Mon, Sep 5, 2011 at 2:30 PM, Jonathan Lange j...@mumak.net wrote:
 Ahh, I see. The projects haven't been split into separate repositories (yet?).

Apparently this is difficult to do while still preserving history. I
wasn't involved in the actual svn - bzr conversion, so I can't really
elaborate on the reasons for that.

 That's going to cause a little bit of confusion, given that projects
 like https://launchpad.net/pyflakes exist. Perhaps a good idea for
 now is to seize pyflakes  any projects like it, move all of their
 bugs to https://launchpad.net/divmod.org and update any text to point
 to that project.

As I understand it, the idea is to keep the multiple projects in order
to differentiate bugs instead of having them all lumped together. If
you think there's a better way of doing that, perhaps you could expand
on that, and JP / Glyph can weigh in with the original reasoning on
the way it is currently.

 The branch is lp:~jml/pyflakes/duplicate-class-defs, linked from
 https://code.launchpad.net/pyflakes/+activereviews.

 There was a ticket for it in the divmod tracker with review
 conversation, but I've lost track of it. Sorry.

The divmod tracker has also lost track of it, due to the Trac DB
corruption, so that sorta sucks :/

The branch is constructed in a way that (I believe) can't be merged
into the combined trunk, so I guess the first step is to rebuild it
on top of the divmod.org repo, and then put it up for merge on
Launchpad. I'll see what I can do about that, even if I can't promise
you a review.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] [ANN] Pyflakes 0.5.0

2011-09-03 Thread Tristan Seligmann
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

It is my unexpected pleasure to announce the release of Pyflakes
0.5.0, the first release in several years, and available now from
PyPI[1].

Highlights of this release include the use of the built-in AST instead
of the compiler module, and support for various new syntax constructs
in Python 2.7. Note that development of Pyflakes (as well as the other
divmod.org projects) has moved to Launchpad[2] since the last release.

[1] 
http://pypi.python.org/packages/source/p/pyflakes/pyflakes-0.5.0.tar.gz#md5=568dab27c42e5822787aa8a603898672

[2] https://launchpad.net/pyflakes
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.18 (GNU/Linux)

iQIcBAEBCgAGBQJOYmL+AAoJEFjA+xzeO3YAme4P/AxLuy0WJN2zG97my1oEwky9
VT79BwnxOqR4NB7I1dRKE3PG4Llgl6frAa0SouM12Dr0QZj9Ug3qHAmmf+TZFrF6
OIQcBUGkZW7EanBhCbjmfqo+0atJ8toAcj9uyF7Db/0A7gCDw160JIMnmTmxu8z6
3r5xRLNSnxs4jj6OSViv9oHNs2r2lpU/RObkGXy6EHxMgezYqw84FbA61fxquK4p
+J1n++vzfiasqgcQFFU3R67T0P2gWUe0C6pv/D+CurSCOdgQJv4LeRtNeYgKhw/W
rN0/3cERXGyRMa4JYDbFyP2G8lrpOuWo2F+jFtEGAxgziK8EqCK58ZSeqMBsodJ9
slAZobSQkrUj6GfpNKdW5mjYRqymBmUhPFc+sUI2poGb3zvMnWmUa2tiSfwl9uxO
9Di82XXAztKba8++cGJQCbuONiLRPgW5kArz5dRz3jFVdAZYL7xUvah4uznwfazc
CA8Q0tiXXoL7X1sT6heNu4VRtnJfEh5LojFdizA4nJEpNssZrPFkSZMv+eSR4Sow
8u2n4f07od6EBzHMhEyqFN7goaniW05VL+EvMdC5px+brnyKOIoLSAGWptBL5EYL
aaAb2zRrebyr/u5vGa+sKEXcoW2TEsc9qO8p/nNSetcoIcNfDwnd3cdyJPU+lYbn
Wctc68Y+xNWChiuTYa3e
=kKgi
-END PGP SIGNATURE-

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] RPC design questions

2011-08-22 Thread Tristan Seligmann
On Mon, Aug 22, 2011 at 11:09 PM, Tobias Oberstein
tobias.oberst...@tavendo.de wrote:
 self.call(procedure, arg)
 self.call(square, 6).addCallback(self.call, sqrt).addCallback(self.show)

The easiest way to do this is probably:

from functools import partial
self.call(square, 6).addCallback(partial(self.call,
sqrt)).addCallback(self.show)
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Moving Twisted off Trac and SVN to somewhere nicer

2011-07-01 Thread Tristan Seligmann
On Fri, Jul 1, 2011 at 12:29 PM, Laurens Van Houtven _...@lvh.cc wrote:
 Although I've hated git for a long while (and I still don't like it very
 much), I firmly believe Github is the right thing for Twisted. My incredibly
 unscientific poll amongst people who like Twisted but aren't devs is that
 they all love or at least like Github, and a surprising number has a
 distaste for Launchpad (unfamiliarity with Bazaar, perceived
 developer-unfriendly UI, slowness).

I'm not sure I understand what you mean by aren't devs. Do you mean
aren't Twisted developers? I don't see why someone who isn't a
developer would particularly care what development tools Twisted uses.

 Unless someone is going to go all NO GITHUB IS TERRIBLE AND YOU ARE A BAD
 PERSON FOR EVEN SUGGESTING IT on me, maybe we can talk about planning the
 transition? :)

My personal preference would definitely be Launchpad+bzr 
Bitbucket+hg  Github+git. There are also a fair number of
Twisted-related projects already on Launchpad.

On the other hand, I'm not sure this is a constructive way to approach
this issue.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Moving Twisted off Trac and SVN to somewhere nicer

2011-07-01 Thread Tristan Seligmann
On Fri, Jul 1, 2011 at 12:57 PM, Laurens Van Houtven _...@lvh.cc wrote:
 Is the reason you would prefer bitbucket over github related to bitbucket
 and github, or git and hg?

The latter. Launchpad+bzr is at the top of my list because of
Launchpad; Bitbucket+hg ranks over Github+git because of hg. (Or
because of git, depending on how you look at it...)
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] jQuery.Deferred - why did they have to go and change the interface?

2011-06-28 Thread Tristan Seligmann
On Mon, Jun 27, 2011 at 11:53 PM, Richard Wall m-li...@the-moon.net wrote:
 I'm in the process of switching some of my Javascript code from
 MochiKit.Async.Deferred to the recently introduced jQuery.Deferred.

 Does anyone else hate the confusing new method names they've chosen?
 Why couldn't they just stick with the tried and tested
 interface...aargh...it really pisses me off!

At least they didn't change the API while keeping the names the same,
like MochiKit did :/
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] a problem about iocp and callInThread

2011-05-15 Thread Tristan Seligmann
On Sun, May 15, 2011 at 6:10 PM, Dfgqq Dfgqq dynami...@gmail.com wrote:
            reactor.callLater(self.wait, reactor.callInThread, self.Execute)

I believe this should be:

reactor.callFromThread(reactor.callLater, self.wait,
reactor.callInThread, self.Execute)

Execute is not being called in the reactor thread, so the only Twisted
API you are allowed to use is reactor.callFromThread, which schedules
a callable to run in the reactor thread and wakes up the reactor if
necessary. Calling other APIs from a non-reactor thread can result in
various misbehaviours such as delays in event processing, as you are
observing.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Understanding deferred and error handling

2011-04-20 Thread Tristan Seligmann
On Wed, Apr 20, 2011 at 12:15 PM, Jason Rennie jren...@gmail.com wrote:

     def log_error(failure):

         log.err(failure.printTraceback())
         return failure
     d.addErrback(log_error)
     d.addBoth(_stop)

 Use d.addCallbacks(_stop, log_error) instead of addBoth/addErrback.  Also,
 you probably want log.err(failure.getTraceback()) instead of
 log.err(failure.printTraceback()).  printTraceback does not return a
 meaningful value IIUC.

Actually, you just want:

log.err(failure)

I don't think there's anything particularly wrong with using
addErrback / addBoth in that way, either. If there is an error, you
want to log it; and then regardless of whether there was an error or
not, and whether the attempt to log the error failed, you want to stop
the reactor; this is exactly what the addErrback/addBoth code achieves
in this case. The equivalent synchronous code looks something like:

try:
remote_call()
except:
logTheError()
finally:
reactor.stop()

The reason you don't get a traceback in this case is that there isn't
one; the exception is created directly as a result of parsing the
response from the HTTP server, instead of being thrown in code lower
down the stack and caught higher up. Unfortunately this situation is
quite common in asynchronous code; there is no direct equivalent of a
stack trace for asynchronous code, so often you have a Failure that
carries no indication of where the operation that failed was
initiated, although turning on Deferred debugging (see
Deferred.setDebugging) can sometimes be helpful in these situations.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] WaitForMultipleObjects socket limitation

2011-04-09 Thread Tristan Seligmann
On Sat, Apr 9, 2011 at 3:43 AM, Pavel Pergamenshchik pperg...@gmail.com wrote:
 Also, how much do we care that win32er can be used without a compiler,
 but iocpreactor needs one to build the API wrapper?

I suspect it's not terribly important, since Windows users can just
use the binary distributions where somebody else has done all the hard
work of compiling.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] WaitForMultipleObjects socket limitation

2011-04-08 Thread Tristan Seligmann
On Fri, Apr 8, 2011 at 4:52 AM, Kevin Horn kevin.h...@gmail.com wrote:
 Note that you can wait on more than 64 objects at a time, just not using a
 single WaitForMultipleObjects call.  The MSDN page Glyph pointed out has a
 little more info.

The proposed solutions, however, seem rather unsatisfactory. If you're
going to start spawning new threads to monitor everything, you might
as well just do IOCP in another thread, or even in the main thread (at
least as far as I know).
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Persisted protocol?

2011-04-06 Thread Tristan Seligmann
On Wed, Apr 6, 2011 at 1:32 PM, Laurens Van Houtven _...@lvh.cc wrote:
 On Wed, Apr 6, 2011 at 1:27 PM, Tim Allen screwt...@froup.com wrote:
 The difference between Pickle and SQLite is that a SQLite database has
 probably had some thought put into its schema, and is much less likely
 to accidentally scoop up random other objects by reference. Also, if
 your database *does* pick up some unwanted state, you have the option of
 tinkering with the database manually; something that's much more
 difficult to do with pickles.

 Right -- I'm giving plugins to the bot a SQLite database, it's up to them if
 they use it. All state serialization is explicit. I'm hoping it's going to
 be more sensible as a result.

For what it's worth, you might find this interesting:

https://launchpad.net/eridanus

It's an IRC bot implemented on Mantissa, which uses Axiom databases
(SQLite under the hood) in order to store and persist service
configuration as well as user data.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Weekly Bug Summary

2011-01-23 Thread Tristan Seligmann
On Sun, Jan 23, 2011 at 7:36 AM, Tom Davis t...@recursivedream.com wrote:

 Mean open ticket age: 1032 days

 Mean time between ticket creation and ticket resolution: 238 days

 Mean time spent in review: 83 days


 Wow. Adding reduce these by at least one order of magnitude to my todo 
 list. Gotta have goals!

I think the median times are a lot more relevant (and also a lot less
horrible-looking).
--
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] help with Deferreds

2010-08-26 Thread Tristan Seligmann
On Thu, Aug 26, 2010 at 11:47 AM, Sergey Magafurov smagafu...@naumen.ru wrote:
 How to rewrite this regular function with Deferred-style?

 Conditions:
 1. 'cache.open' and 'item.read' become deffered
 2. 'item.obsolete()' and 'renew(data)' are not deferred

I would probably write it something like this:

def getCachedResult(cache, key):
def _gotResult(item):
try:
if item.obsolete():
return None
d = item.read()
d.addCallback(lambda data: renew(data))
except:
item.release()
raise
d.addBoth(lambda ign: item.release())
return d

def _ebNotFound(f):
f.trap(NotFound)
return None

return cache.open(key).addCallbacks(_gotResult, _ebNotFound)

Note: code is untested
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] help with Deferreds

2010-08-26 Thread Tristan Seligmann
On Thu, Aug 26, 2010 at 12:23 PM, Sergey Magafurov smagafu...@naumen.ru wrote:
 I ask this question because I am confusing with this ugly slice of code:

 try:
     ...
 except:
     item.release()
     raise

If you don't like that construct, perhaps this one is nicer:

from twisted.internet.defer import maybeDeferred

def getCachedResult(cache, key):
   def _readItem(item):
   if item.obsolete():
   return None
   return item.read()

   def _gotResult(item):
   def _release(ign):
   item.release()
   return item

   d = maybeDeferred(_readItem, item)
   d.addBoth(_release)
   d.addCallback(renew)
   return d

   def _ebNotFound(f):
   f.trap(NotFound)
   return None

   return cache.open(key).addCallbacks(_gotResult, _ebNotFound)

-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


  1   2   >