Re: [Twisted-Python] Release again in June?
On May 3, 2010, at 12:25 PM, Jonathan Lange wrote: >>> I am still keen to do this. >>> >>> Does anyone have any thoughts, objections or recommendations? >> >> This sounds great. > I also think this sounds great. Thanks for stepping forward again, Jonathan. I would like to volunteer to be assistant release manager for this release so that I can hopefully get out a 10.2 in a timely manner as well. ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
[Twisted-Python] EuroPython 2k10: planned sprint days?
Hey, Can anyone tell me which sprint days (if any) Twisted is organizing something on? If nothing is planned yet, does anyone have any preferences? Thanks, Laurens ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
[Twisted-Python] IRCClient: Handle lines that are too long for the server
So, there's a todo item in IRCClient, to handle lines that are longer than the RFC maximum length (510 characters including the sender, recipient and command, plus `\n` and `\r`). I had thought to have a method sitting between the IRCClient.sendLine() and the method which actually calls out to the transport to put the data on the wire. The default method would simply pass the message through, sending it on to the server as is, to be inevitably truncated at the other end. The documentation could contain examples of possible implementations, such as one which splits the message up into multiple messages and sends them on, and one which truncates the message. For example, IRCClient could contain the method: def longLineHandler(self, message): return message This would necessitate adding a check to IRCClient to see what is returned by longLineHandler(). I would suggest that it would accept a single `str` or a list of `str`s as valid input, and anything else will either make the sendLine() method do nothing and just silently return, or will raise an exception. If it returns silently, it would allow the user-defined longLineHandler() to implement splitting a message up into multiple messages by either returning a list of `str`s, or by calling self.sendLine() themselves and then returning None to have the original sendLine() return silently. For example, if the user overrode longLineHandler() and made it split the message into multiple messages, in peudocode it could go like this call self.sendLine call self.longLineHandler with parameter 'message' is message longer than 510 characters? yes: split up command prefix and payload use textwrap module to split payload into multiple messages no longer than "510 - length of command prefix" prepend command prefix to each message and call self.sendLine with each one return None no: return message did self.longLineHandler return None? yes: return did self.longLineHandler return a list of `str`? yes: for each `str` in list: call self.reallySendLine or place on message queue no: call self.reallySendLine or place on message queue The user might also want to have their longLineHandler raise an exception if the line is too long, or they might want to have it make the lines shorter than 510 characters total, or strip control codes if they're too long to try and shorten it... there's a number of different use cases for this, so I'm trying to build a framework for it that's flexible enough to handle more or less anything. I'd value any comments anyone has on this. I also have an enhancement ticket open in the bug tracker, ticket #4416. -- Adrian ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Re: [Twisted-Python] SQLAlchemy and Twisted
If you want an ORM in Twisted look for STORM twisted integration. Overall, it works (I tried). Some quirks are there, e.g. without twisted you would do something like resultset[10:20].sort(Sort.ASC) but with twsited you have to do (assuming inlineCallbacks) res= yield resultset[10:20] res = yield res.sort(Sort.ASC) which ain't pretty but it sure beats using plain twisted.enterprise -- Konrads Smelkovs Applied IT sorcery. On Thu, May 6, 2010 at 11:00 PM, Kevin Horn wrote: > You might also check out sAsync: http://sasync.org/ > > This was a project apparently abandoned (?) by the original author, but > it's recently been picked up by someone else. > > Kevin Horn > > > On Thu, May 6, 2010 at 2:04 PM, César García wrote: > >> Guys, now that I see this and the past conversations about SA and Twisted, >> and now that I've read some more about the non-blocking concepts, I think >> that I'am not doing things the best way >> >> I am doing this: >> >> 1. Twisted IMAP4 Client to read my mails >> 2. Inside this client I import a module that contains some funtions that >> parse the email via re >> 3. Also inside the client I import a module that makes a DB connection and >> insert the data parsed from those emails, all this via SQL using mapped >> tables. >> >> I'm almost sure that I'm breacking the hole twisted concept doing this >> thisway , do you guys have any advice for me >> >> Thanks >> 2010/5/5 Chris Withers >> >> Doug Farrell wrote: >>> > >>> > I’ve been doing some searching about how to get SQLAlchemy and Twisted >>> > working together in a Twisted application. >>> >>> Short version: to be safe, anything that touches any SQLAlchemy-mapped >>> object needs to be run in its own thread. Any query or access of an >>> attribute of a mapped object may result in a blocking sql query. (aka: >>> twisted doesn't play nice with orms) >>> >>> > definitive answer. The most promising one I’ve run across concerns >>> > running the SQLAlchemy queries in a separate process (rather than a >>> > separate thread) and communicating the queries between the Twisted >>> > application in one process and the SQLAlchemy application in another. >>> >>> That seems a little odd. >>> What would be the IPC? >>> How would the "sqlachemy application" be run? >>> >>> > 1) Would the SQLAlchemy process also be a Twisted application with >>> > all the queries running as deferreds in the main thread, and blocking? >>> >>> What do you men by "all the queries"? >>> >>> > Thanks in advance for any help! >>> >>> In my case, since most of the app I'm working on is "web requested" >>> (either xmlrpc or http), I just agve up and used a good wsgi stack >>> (repoze.bfg in my case) and munge other incoming requests into wsgi >>> requests. >>> >>> Twisted's wsgi server runs each request in its own thread, so be it. >>> >>> cheers, >>> >>> Chris >>> >>> >>> ___ >>> Twisted-Python mailing list >>> Twisted-Python@twistedmatrix.com >>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python >>> >> >> >> >> -- >> http://celord.blogspot.com/ >> >> ___ >> 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] SQLAlchemy and Twisted
On Fri, May 7, 2010 at 12:53 PM, Konrads Smelkovs wrote: > If you want an ORM in Twisted look for STORM twisted integration. Overall, > it works (I tried). Some quirks are there, e.g. without twisted you would do > something like resultset[10:20].sort(Sort.ASC) but with twsited you have to > do (assuming inlineCallbacks) > > res= yield resultset[10:20] > res = yield res.sort(Sort.ASC) If you wanted to, you could write this as: (yield resultset[10:20]).sort(Sort.ASC) assuming a new enough version of Python. -- 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] SQLAlchemy and Twisted
> (yield resultset[10:20]).sort(Sort.ASC) > > assuming a new enough version of Python. I wonder if it a good idea to subclass Deferred and define __call__() for it, making it attach callbacks to itself. Theoretically should work in earlier versions and make the syntax look more transparent. ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Re: [Twisted-Python] SQLAlchemy and Twisted
On 01:34 pm, mithra...@mithrandi.net wrote: On Fri, May 7, 2010 at 12:53 PM, Konrads Smelkovs wrote: If you want an ORM in Twisted look for STORM twisted integration. Overall, it works (I tried). Some quirks are there, e.g. without twisted you would do something like resultset[10:20].sort(Sort.ASC) but with twsited you have to do (assuming inlineCallbacks) res= yield� resultset[10:20] res = yield res.sort(Sort.ASC) If you wanted to, you could write this as: (yield resultset[10:20]).sort(Sort.ASC) assuming a new enough version of Python. You left off one of the yields, though. res = yield (yield resultset[10:20]).sort(Sort.ASC) Jean-Paul ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Re: [Twisted-Python] SQLAlchemy and Twisted
On 03:37 pm, drwxrwxr.x+twistedm...@gmail.com wrote: >>(yield resultset[10:20]).sort(Sort.ASC) >> >>assuming a new enough version of Python. > >I wonder if it a good idea to subclass Deferred and define __call__() >for it, making it attach callbacks to itself. >Theoretically should work in earlier versions and make the syntax look >more transparent. Let me clear that up for you, then. No, this is not a good idea. :) Jean-Paul ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python