[Twisted-Python] util.quote deprecated

2009-03-03 Thread Pet
Hi, what is a proper way to escape user input in database query strings? I've used quote from twisted.enterprise.util, but it is deprecated now. Is there any other module for this purpose? Thanks, Pet ___ Twisted-Python mailing list Twisted-P

Re: [Twisted-Python] util.quote deprecated

2009-03-03 Thread Pet
On Tue, Mar 3, 2009 at 2:04 PM, Tim Allen wrote: > On Tue, Mar 03, 2009 at 01:17:48PM +0100, Pet wrote: > > what is a proper way to escape user input in database query strings? > > I've used quote from twisted.enterprise.util, but it is deprecated now. > > Is there

[Twisted-Python] twistd tap file are not created

2009-03-09 Thread Pet
Hello, I'm trying an example from twisted book and when I run this: twistd -n reverse_app.py application works, but no .tap file is created Another question, how are twisted daemons actually stopped? Pet reverse_app.py from twisted.application import service import reverse applic

Re: [Twisted-Python] twistd tap file are not created

2009-03-09 Thread Pet
On Mon, Mar 9, 2009 at 9:02 PM, Drew Smathers wrote: > On Mon, Mar 9, 2009 at 8:02 AM, Pet wrote: >> Hello, >> >> I'm trying an example from twisted book and when I run this: >> twistd -n reverse_app.py >> >> application works, but no .tap file is cre

[Twisted-Python] LineReceiver MAX_LENGTH limitation

2009-03-18 Thread Pet
Hi, in LineReceiver there is MAX_LENGTH = 16384 limitation. Is it possible to set it bigger at start of an application? Regards, Pet ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo

Re: [Twisted-Python] LineReceiver MAX_LENGTH limitation

2009-03-18 Thread Pet
On Wed, Mar 18, 2009 at 1:19 PM, Jean-Paul Calderone wrote: > On Wed, 18 Mar 2009 13:10:12 +0100, Pet wrote: >> >> Hi, >> >> in LineReceiver there is MAX_LENGTH = 16384 limitation. Is it possible >> to set it bigger at start of an application? > > It's

[Twisted-Python] db connections

2009-03-24 Thread Pet
pass it to Protocol? But what happens if too much clients are connected to server? What is the way to control it? Regards, Pet class MyProtocol(basic.LineReceiver): def __init__(self): print "new connection" self.dbcon = adbapi.ConnectionPool("pyPgSQL.Pg

Re: [Twisted-Python] db connections

2009-03-24 Thread Pet
I do as you suggested. > > > On Tue, Mar 24, 2009 at 6:10 PM, Pet wrote: >> >> Hi, >> >> I've wrote an daemon which does some queries to db and sends response >> back to client. Do I need to make for every request from client (new >> insta

Re: [Twisted-Python] db connections

2009-03-24 Thread Pet
ue, Mar 24, 2009 at 6:45 AM, Alvin Delagon wrote: >> Put self.dbcon in the MyFactory class. MyProtocol instances can access it >> via self.factory. >> >> >> On Tue, Mar 24, 2009 at 6:10 PM, Pet wrote: >>> >>> Hi, >>> >>> I've wrote

Re: [Twisted-Python] db connections

2009-03-25 Thread Pet
adbapi.ConnectionPool("pyPgSQL.PgSQL", database="data", > user='pet', host='local', password='some') > > if __name__ == "__main__": >     reactor.listenTCP(8080, MyFactory()) >     reactor.run() > > I usually put persist

Re: [Twisted-Python] db connections

2009-03-25 Thread Pet
On Wed, Mar 25, 2009 at 10:22 AM, Pet wrote: > On Tue, Mar 24, 2009 at 6:10 PM, Alvin Delagon wrote: >> Something like this: >> >> from twisted.protocols import basic >> from twisted.internet import protocol, reactor >> from twisted.enterprise imp

Re: [Twisted-Python] db connections

2009-03-28 Thread Pet
On Sat, Mar 28, 2009 at 2:32 AM, Enrique Samson Jr. wrote: > On Wed, 2009-03-25 at 11:00 +0100, Pet wrote: >> > Hi, >> > >> > thanks for example! >> > In that way, I'm getting error: >> > >> > exceptions.AttributeError: MyProtocol in

[Twisted-Python] design question

2009-05-04 Thread Pet
MyObj(self.db), but it doesn't work and runInteraction passes automatically db variable to interaction method. I'm new to Python and Twisted and would appreciate your advises. Pet ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com

[Twisted-Python] XML-RPC for paralell clients

2009-05-19 Thread Pet
sults after slow function returned. There is no factory for clients in server.Site() like in Protokoll? What is the way to do that for XML-RPC? Thanks for your help! Pet from twisted.web import xmlrpc, server from twisted.application import internet from time import sleep PORT = 1

Re: [Twisted-Python] XML-RPC for paralell clients

2009-05-19 Thread Pet
On Tue, May 19, 2009 at 10:59 AM, wrote: > On 07:51 am, petshm...@googlemail.com wrote: >>after playing with reactor, factory and protocol, I'm trying to >>implement XML-RPC server, but it seems that it is not able to handle >>several clients in parallel. If I call the slow function with first >>

Re: [Twisted-Python] XML-RPC for paralell clients

2009-05-19 Thread Pet
On Tue, May 19, 2009 at 11:48 AM, Pet wrote: > On Tue, May 19, 2009 at 10:59 AM,   wrote: >> On 07:51 am, petshm...@googlemail.com wrote: >>>after playing with reactor, factory and protocol, I'm trying to >>>implement XML-RPC server, but it seems that it is not a

[Twisted-Python] can addCallback accept list of deferreds?

2009-06-16 Thread Pet
Hi, I'm trying to process several items in callback function writeLog d.addCallback(self.writeLog,g=g) see below. Can writeLog return DeferredList instead of Deferred? WriteLog should run several inserts into db (some of which may fail). Or am I completely wrong here? Thanks

[Twisted-Python] unicode for pyPgSQL

2009-08-12 Thread Pet
decode all results back to unicode? Pet ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Re: [Twisted-Python] unicode for pyPgSQL

2009-08-13 Thread Pet
On Wed, Aug 12, 2009 at 6:51 PM, wrote: > On 03:28 pm, petshm...@googlemail.com wrote: >>Hello, >> >>does pyPgSQL doesn't support unicode? >> >>execute(query, params) #all items in params list are of  >'unicode'> >> >>I'm getting >>'ascii' codec can't encode character u'\xfc' in position 1: ordina

[Twisted-Python] run queries in deffered, but not in transaction

2009-09-15 Thread Pet
Hi, I'd like to run several queries in background, some of them may fail. Currently, I do runInteraction for each query. Is there a way to run them all in one deferred, so that if one of them fails, other are not aborted? Thanks in advance!

Re: [Twisted-Python] run queries in deffered, but not in transaction

2009-09-15 Thread Pet
 yield db.runInteraction(two) >    except: >       pass > >    try: >        yield db.runInteraction(three) >    except: >       pass > > Or with callback/errbacks, like this: > > def someInteractions(db) >        d = db.runInteraction(one).addBoth(db.runInt

Re: [Twisted-Python] run queries in deffered, but not in transaction

2009-09-16 Thread Pet
On Tue, Sep 15, 2009 at 6:21 PM, Pet wrote: > On Tue, Sep 15, 2009 at 5:19 PM, Mark Visser wrote: >> exar...@twistedmatrix.com wrote: >>> On 10:37 am, petshm...@googlemail.com wrote: >>>> >>>> I'd like to run several queries in background, so

Re: [Twisted-Python] run queries in deffered, but not in transaction

2009-09-16 Thread Pet
ed > >   # same as above, code won't get executed until "secondDeferred" has a > result > > then you'll get the behavior you're looking for. > > See > http://twistedmatrix.com/documents/8.2.0/api/twisted.internet.defer.html#inlineCallbacks > for s

[Twisted-Python] inlineCallbacks

2009-10-06 Thread Pet
Hi, calling in client code self.cred.login() I can't print login result. What I'm doing wrong? login method returns deffered, but should yield result from callRemote method. Thanks for any help! Pet class Cred: @inlineCallbacks def login(self): proxy = Proxy(L

Re: [Twisted-Python] inlineCallbacks

2009-10-08 Thread Pet
ult from callRemote method. >> >>Thanks for any help! >> >>Pet >> >>class Cred: >> >>   �...@inlinecallbacks >>    def login(self): >>        proxy = Proxy(LOGIN_PROXY) >>        l = {"user":LOGIN_USERNAME, "

[Twisted-Python] Log rotates not as expected

2010-01-20 Thread Pet
root root 301K 2010-01-20 13:26 /var/log/my.log it writes simultaneously to both my.log.5 and my.log. It is not big problem, but in this way I have only recent files, because they grows quickly Pet from twisted.python import log from twisted.python import logfile from twisted.application import

Re: [Twisted-Python] Log rotates not as expected

2010-01-21 Thread Pet
ogfile.LogFile somewhere? > > Maybe twistd's log rotation? Yes, may be. I start my daemon with /usr/bin/twistd -y mydaemon.py --logfile=/var/log/my.log --pidfile=/var/lock/mydaemon.pid How do I start twistd, so it doesn't produce own log file? Thanks for help!

Re: [Twisted-Python] Log rotates not as expected

2010-01-22 Thread Pet
On Fri, Jan 22, 2010 at 12:13 AM, Lucas Taylor wrote: > On 1/21/10 11:17 AM, Pet wrote: >> On Thu, Jan 21, 2010 at 7:02 PM, Maarten ter Huurne >> wrote: >>> On Thursday 21 January 2010, Lucas Taylor wrote: >>> >>>> This can occur if you have multip

Re: [Twisted-Python] Log rotates not as expected

2010-01-28 Thread Pet
On Fri, Jan 22, 2010 at 10:21 PM, Lucas Taylor wrote: > On 1/22/10 3:15 AM, Pet wrote: >> On Fri, Jan 22, 2010 at 12:13 AM, Lucas Taylor >> wrote: >>> On 1/21/10 11:17 AM, Pet wrote: >>>> On Thu, Jan 21, 2010 at 7:02 PM, Maarten ter Huurne >>>>

Re: [Twisted-Python] Log rotates not as expected

2010-01-28 Thread Pet
On Thu, Jan 28, 2010 at 9:46 AM, Pet wrote: > On Fri, Jan 22, 2010 at 10:21 PM, Lucas Taylor > wrote: >> On 1/22/10 3:15 AM, Pet wrote: >>> On Fri, Jan 22, 2010 at 12:13 AM, Lucas Taylor >>> wrote: >>>> On 1/21/10 11:17 AM, Pet wrote: >>>>

[Twisted-Python] multiple versions of twisted on same machine

2010-02-11 Thread Pet
Hi, I'd like to upgrade twisted to the newest version and obviously first test if my application works fine with new version. What is the best (safest) way to do it? Thanks for help, Pet ___ Twisted-Python mailing list Twisted-Python@twistedmatri

Re: [Twisted-Python] multiple versions of twisted on same machine

2010-02-12 Thread Pet
On Thu, Feb 11, 2010 at 1:55 PM, Matt Bone wrote: > You could try virtualenv: > > http://pypi.python.org/pypi/virtualenv > > And have one virtual environment with Twisted 9.0 and another with > Twisted 8.2, etc, etc. > Thanks! Will try it out > --matt > > On Thu

[Twisted-Python] profiling code that runs in threads

2010-04-14 Thread Pet
functions which runs in other threads? Thanks! Pet ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Re: [Twisted-Python] multiple versions of twisted on same machine

2010-04-27 Thread Pet
On Sat, Feb 13, 2010 at 6:05 AM, Glyph Lefkowitz wrote: > On Feb 11, 2010, at 5:27 PM, Timothy Allen wrote: > >> On Thu, 11 Feb 2010 11:54:47 -0600 >> Kevin Horn wrote: >>> Not entirely related to this discussion (though not entirely >>> unrelated), I think that Twisted's whole release/distributi

Re: [Twisted-Python] multiple versions of twisted on same machine

2010-04-27 Thread Pet
On Tue, Apr 27, 2010 at 5:28 PM, wrote: > On 02:43 pm, petshm...@googlemail.com wrote: >> >>Hi, >> >>I can't install Twisted in VirtualEnv. Can someone explain what is >>wrong, please? Thanks! >> >> >>(newtwisted)hostname:/usr/local/development/newtwisted/bin# >>easy_install Twisted >>[snip] >>Ru

[Twisted-Python] print unicode

2010-05-05 Thread Pet
Hello! I'm using Twisted 10.0 and as usually sometime print debug infos with myunicodestr.encode('UTF-8') which are saved to logfile, but since using twisted 10 I'm getting UnicodeEncodeError: 'ascii' codec can't encode characters... type(myunicodestr) returns What is the problem here? Thank

Re: [Twisted-Python] print unicode

2010-05-05 Thread Pet
On Wed, May 5, 2010 at 2:05 PM, Maarten ter Huurne wrote: > On Wednesday 05 May 2010, Pet wrote: > >> I'm using Twisted 10.0 and as usually sometime print debug infos with >> myunicodestr.encode('UTF-8') which are saved to logfile, but sinc

Re: [Twisted-Python] print unicode

2010-05-05 Thread Pet
On Wed, May 5, 2010 at 2:47 PM, Phil Mayers wrote: > On 05/05/10 13:31, Pet wrote: >> On Wed, May 5, 2010 at 2:05 PM, Maarten ter Huurne >>  wrote: >>> On Wednesday 05 May 2010, Pet wrote: >>> >>>> I'm using Twisted 10.0 and as usually someti

Re: [Twisted-Python] print unicode

2010-05-05 Thread Pet
On Wed, May 5, 2010 at 2:49 PM, Itamar Turner-Trauring wrote: > On Wed, 2010-05-05 at 13:45 +0200, Pet wrote: >> Hello! >> >> I'm using Twisted 10.0 and as usually sometime print debug infos with >> myunicodestr.encode('UTF-8') which are saved to logfile,

Re: [Twisted-Python] print unicode

2010-05-05 Thread Pet
On Wed, May 5, 2010 at 4:15 PM, Pet wrote: > On Wed, May 5, 2010 at 2:49 PM, Itamar Turner-Trauring > wrote: >> On Wed, 2010-05-05 at 13:45 +0200, Pet wrote: >>> Hello! >>> >>> I'm using Twisted 10.0 and as usually sometime print debug infos with >

Re: [Twisted-Python] print unicode

2010-05-05 Thread Pet
On Wed, May 5, 2010 at 4:29 PM, Pet wrote: > On Wed, May 5, 2010 at 4:15 PM, Pet wrote: >> On Wed, May 5, 2010 at 2:49 PM, Itamar Turner-Trauring >> wrote: >>> On Wed, 2010-05-05 at 13:45 +0200, Pet wrote: >>>> Hello! >>>> >>>> I&#x

Re: [Twisted-Python] print unicode

2010-05-05 Thread Pet
On Wed, May 5, 2010 at 4:54 PM, Itamar Turner-Trauring wrote: > On Wed, 2010-05-05 at 16:47 +0200, Pet wrote: >> Now, I'm getting Exception with >> >>           File >> "/usr/local/tw10/lib/python2.5/site-packages/Twisted-10.0.0-py2.5-linux-x86_64.egg/tw

[Twisted-Python] multiline log entries

2010-05-06 Thread Pet
Hello! Is it possible to print multiline debug messages into log? If print a query it looks like this 2010-05-06 10:10:07 [HTTPChannel,0,192.168.2.15] SELECT * 2010-05-06 10:10:07 [HTTPChannel,0,192.168.2.15] FROM foo AS a 2010-05-06 10:10:07 [HTTPChannel,0,192.168.2.15] JOI

Re: [Twisted-Python] multiline log entries

2010-05-06 Thread Pet
On Thu, May 6, 2010 at 4:37 PM, wrote: > On 02:30 pm, petshm...@googlemail.com wrote: >>Hello! >> >>Is it possible to print multiline debug messages into log? >> >>If print a query it looks like this >> >> >>2010-05-06 10:10:07 [HTTPChannel,0,192.168.2.15] >>SELECT * >>2010-05-06 10:10:07 [HTTPCh

[Twisted-Python] getting all results from DeferredList

2010-06-30 Thread Pet
ested runInteraction ok? Thanks for help! Pet class Test: def __init__(self, cursor): self.cursor = cursor def test(db, params): if params.get('query'): params['q'] = self.someFunc3(db, params) def processResults(results, out):

Re: [Twisted-Python] getting all results from DeferredList

2010-06-30 Thread Pet
and that's not allowed. That is why it not worked. I should redesign my application. Thanks! > > Jean-Paul >>Thanks for help! >>Pet >> >> >>class Test: >>    def __init__(self, cursor): >>        self.cursor = cursor >> >>    def t

[Twisted-Python] xmlrpc protocoll instanze per connection?

2010-08-04 Thread Pet
PC this looks for me like Protocol instance is reused for all connection. If it is so, can I change this behavior, so I have one instance of Protocol per connection? Thanks for help! Pet class MyXMLRPCFactory(server.Site): def __init__(self): self.db = adbapi.ConnectionPool() self.r

Re: [Twisted-Python] xmlrpc protocoll instanze per connection?

2010-08-04 Thread Pet
On Wed, Aug 4, 2010 at 12:25 PM, Alan Franzoni wrote: > Just ovverride the "protocol" attribute on your factory with the > callable you want to be called when a new protocol needs to be Hello Alan, AFAIU this works only if Factory is subclassing protocol.ServerFactory, XMLRPCFactory subclasses s

Re: [Twisted-Python] xmlrpc protocoll instanze per connection?

2010-08-04 Thread Pet
On Wed, Aug 4, 2010 at 2:13 PM, Itamar Turner-Trauring wrote: > On Wed, 2010-08-04 at 12:00 +0200, Pet wrote: > >> Now, for XMLRPC this looks for me like Protocol instance is reused for >> all connection. If it is so, can I change this behavior, so I have one >>

Re: [Twisted-Python] xmlrpc protocoll instanze per connection?

2010-08-05 Thread Pet
On Thu, Aug 5, 2010 at 3:32 PM, Alan Franzoni wrote: > On 8/4/10 1:30 PM, Pet wrote: > >> AFAIU this works only if Factory is subclassing >> protocol.ServerFactory, XMLRPCFactory subclasses server.Site, where >> protocol attribute is not present > > server.Site subc

Re: [Twisted-Python] xmlrpc protocoll instanze per connection?

2010-08-05 Thread Pet
On Thu, Aug 5, 2010 at 5:01 PM, wrote: > On 02:21 pm, petshm...@googlemail.com wrote: >> >> On Thu, Aug 5, 2010 at 3:32 PM, Alan Franzoni wrote: >>> >>> On 8/4/10 1:30 PM, Pet wrote: >>>> >>>> AFAIU this works only if Factory is subclass

Re: [Twisted-Python] xmlrpc protocoll instanze per connection?

2010-08-09 Thread Pet
On Thu, Aug 5, 2010 at 5:01 PM, wrote: > On 02:21 pm, petshm...@googlemail.com wrote: >> >> On Thu, Aug 5, 2010 at 3:32 PM, Alan Franzoni wrote: >>> >>> On 8/4/10 1:30 PM, Pet wrote: >>>> >>>> AFAIU this works only if Factory is subclass

Re: [Twisted-Python] xmlrpc protocoll instanze per connection?

2010-08-09 Thread Pet
y code, I'm not calling it anywhere. so it must be framework holding reference returned by getChild. Well now after some minutes they were destroyed. Thanks Pet > > Jean-Paul > > > ___ > T

[Twisted-Python] timeout in agent

2010-08-30 Thread Pet
Hello! I have modified Agent.request method (twisted.web.client.Agent) to pass timeout parameter to d = cc.connectTCP(host, port, timeout=timeout) but it looks like timeout is ignored (cbConnected is called). Is this known issue? Thanks! ___ Twisted-P

Re: [Twisted-Python] timeout in agent

2010-08-30 Thread Pet
On Mon, Aug 30, 2010 at 1:56 PM, Itamar Turner-Trauring wrote: > On Mon, 2010-08-30 at 10:54 +0200, Pet wrote: >> Hello! >> >> I have modified Agent.request method (twisted.web.client.Agent) to >> pass timeout parameter to >> d = cc.connectTCP(host, port, timeout

[Twisted-Python] How to get original error message in failure object

2010-09-09 Thread Pet
Hello, if an error occurs in HTTP11ClientProtocol request method (twisted.web._newclient) then error is stored in RequestGenerationFailed Exception and wrapped in Failure object: def ebRequestWriting(err): if self._state == 'TRANSMITTING': self._state = 'GENER

Re: [Twisted-Python] How to get original error message in failure object

2010-09-09 Thread Pet
On Thu, Sep 9, 2010 at 2:33 PM, wrote: > On 09:42 am, petshm...@googlemail.com wrote: >>Hello, >> >>if an error occurs in HTTP11ClientProtocol request method >>(twisted.web._newclient) then error is stored in >>RequestGenerationFailed Exception and wrapped in Failure object: >> >> >>        def e