Re: [Twisted-Python] prerelease preview predocumentation

2011-03-29 Thread Albert Brandl
On Mon, Mar 28, 2011 at 09:27:04AM -0400, Tom Davis wrote:
> 
> It's great to have everything indexed on one page with easy drill-down 
> into specific sections. It becomes really obvious where the hierarchy 
> can be optimized and how we can logically go about breaking up the 
> various sections.

This is right. But I was confused by the fact that the first-level items 
in the list ("Twisted Conch Documentation", "Twisted Core Documentation", 
etc.) link to pages that _again_ present links to the second-level items.
Adding to my confusion was the fact that the links on the main page have
different names from the ones on the subpages.

Best regards,
-- 
Albert Brandl
Weiermayer Solutions GmbH  | Abteistraße 12, A-4813 Altmünster
phone: +43 (0) 720 70 30 14| fax: +43 (0) 7612 20 3 56
web: http://www.weiermayer.com

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


Re: [Twisted-Python] running several services from a single app

2011-03-29 Thread Aljoša Mohorović
On Mon, Mar 28, 2011 at 7:44 PM, Allen Short  wrote:
> Get rid of 'application1' and 'application2' and just create a single one
> named 'application' , delete the last three lines, and this code will work
> just fine as a .tac file. You only need one call to 'Application' per

is it possible to setup this without .tac file?
i don't know howto create an exe file using cx_freeze from .tac file.

is there a way to tell reactor to run application and services defined
so i can skip .tac file and just execute python file?
maybe something similar to this:

application = service.Application("Services")

factory1 = protocol.ServerFactory()
factory1.protocol = Protocol1
internet.TCPServer(8000, factory1).setServiceParent(application)

factory2 = protocol.ServerFactory()
factory2.protocol = Protocol2
internet.TCPServer(9000, factory2).setServiceParent(application)

# howto make reactor do something like this:
reactor.run(application)


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


Re: [Twisted-Python] Deferred documentation.

2011-03-29 Thread Peter Hogg
I haven't been following the thread, but just wanted to mention 
something that caught me out when I was learning to use deferreds.

Both the old deferred documentation and your fix-up fail to mention 
addCallbacks() until near the end, when in practice I find 
addCallbacks() to be much more useful than addCallback(). The diagram 
near the top demonstrating the deferred process also implies the use of 
addCallbacks(), even though prior to this only addCallback() and 
addErrback() have been mentioned. This confused me into thinking a 
consecutive addCallback().addErrback() would register a callback and an 
errback at the same point in the processing chain.

Apart from this point I found the old documentation very clear. If you 
really want the idiots guide I think you need animated diagrams, or 
something, but I don't see that happening.

Rgds,
vokoda

Jasper St. Pierre wrote:
> Glyph Lefkowitz 

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


Re: [Twisted-Python] Deferred documentation.

2011-03-29 Thread Jasper St. Pierre
Good catch, I really should mention that...

On Tue, Mar 29, 2011 at 8:56 AM, Peter Hogg  wrote:

> I haven't been following the thread, but just wanted to mention
> something that caught me out when I was learning to use deferreds.
>
> Both the old deferred documentation and your fix-up fail to mention
> addCallbacks() until near the end, when in practice I find
> addCallbacks() to be much more useful than addCallback(). The diagram
> near the top demonstrating the deferred process also implies the use of
> addCallbacks(), even though prior to this only addCallback() and
> addErrback() have been mentioned. This confused me into thinking a
> consecutive addCallback().addErrback() would register a callback and an
> errback at the same point in the processing chain.
>
> Apart from this point I found the old documentation very clear. If you
> really want the idiots guide I think you need animated diagrams, or
> something, but I don't see that happening.
>
> Rgds,
> vokoda
>
> Jasper St. Pierre wrote:
> > Glyph Lefkowitz
>
> ___
> 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] Deferred documentation.

2011-03-29 Thread Christopher Armstrong
On Tue, Mar 29, 2011 at 7:56 AM, Peter Hogg  wrote:

> I haven't been following the thread, but just wanted to mention
> something that caught me out when I was learning to use deferreds.
>
> Both the old deferred documentation and your fix-up fail to mention
> addCallbacks() until near the end, when in practice I find
> addCallbacks() to be much more useful than addCallback(). The diagram
> near the top demonstrating the deferred process also implies the use of
> addCallbacks(), even though prior to this only addCallback() and
> addErrback() have been mentioned. This confused me into thinking a
> consecutive addCallback().addErrback() would register a callback and an
> errback at the same point in the processing chain.
>
>

I probably use addCallbacks once for every 30-100 addCallback or addErrback
calls I do (counted by lines of code, not times they're executed). But
that's just an off-the-cuff estimate.

-- 
Christopher Armstrong
http://radix.twistedmatrix.com/
http://planet-if.com/
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] running several services from a single app

2011-03-29 Thread Kevin Horn
On Tue, Mar 29, 2011 at 2:46 AM, Aljoša Mohorović <
aljosa.mohoro...@gmail.com> wrote:

> On Mon, Mar 28, 2011 at 7:44 PM, Allen Short 
> wrote:
> > Get rid of 'application1' and 'application2' and just create a single one
> > named 'application' , delete the last three lines, and this code will
> work
> > just fine as a .tac file. You only need one call to 'Application' per
>
> is it possible to setup this without .tac file?
> i don't know howto create an exe file using cx_freeze from .tac file.
>
> is there a way to tell reactor to run application and services defined
> so i can skip .tac file and just execute python file?
> maybe something similar to this:
> 
> application = service.Application("Services")
>
> factory1 = protocol.ServerFactory()
> factory1.protocol = Protocol1
> internet.TCPServer(8000, factory1).setServiceParent(application)
>
> factory2 = protocol.ServerFactory()
> factory2.protocol = Protocol2
> internet.TCPServer(9000, factory2).setServiceParent(application)
>
> # howto make reactor do something like this:
> reactor.run(application)
> 
>
>
Sadly it's undocumented, but you're probably looking for:
http://twistedmatrix.com/documents/current/api/twisted.application.app.html#startApplication

The only examples I can find of it's use are by people who want to start a
"tac" type application as a WinNT Service, but I think it would work for
your purposes as well.

Here's an example:
http://foobar.lu/wp/2007/06/27/runnning-a-twisted-application-as-windows-service/

You can see the application object is created as normal (though in the
example it happens in a different file and is imported), then
startApplication is called, then reactor.run().

Good Luck!

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


Re: [Twisted-Python] running several services from a single app

2011-03-29 Thread Tim Allen
On Tue, Mar 29, 2011 at 09:46:11AM +0200, Aljoša Mohorović wrote:
> is there a way to tell reactor to run application and services defined
> so i can skip .tac file and just execute python file?
> maybe something similar to this:
> 
> application = service.Application("Services")
> 
> factory1 = protocol.ServerFactory()
> factory1.protocol = Protocol1
> internet.TCPServer(8000, factory1).setServiceParent(application)
> 
> factory2 = protocol.ServerFactory()
> factory2.protocol = Protocol2
> internet.TCPServer(9000, factory2).setServiceParent(application)
> 
> # howto make reactor do something like this:
> reactor.run(application)
> 

It's not clear from your message whether you're using
internet.TCPServer() in your actual production code, or if that's just
something you picked to make a simple example for the mailing-list.

If you really are using internet.TCPServer(), you can just skip the
Application object entirely, and call reactor.listenTCP() instead of
internet.TCPServer(), then reactor.run() at the bottom.

If you've written your own Server or Application subclass that you want
to run, Kevin Horn's answer is probably the one you want.

Tim.

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