~landscape/twisted/14.0.2-1ubuntu1

« back to all changes in this revision

Viewing changes to doc/core/examples/postfix.py

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-07-14 13:53:15 UTC
  • mfrom: (1.3.2) (44.2.3 sid)
  • Revision ID: package-import@ubuntu.com-20140714135315-z2f6727ypy31nldq
Tags: 14.0.0-1ubuntu1
* Merge with Debian; remaining changes:
  - Keep the preliminary python3 support, but don't enable it.
  - Try to use plain pygtkcompat and fall back to gi.pygtkcompat, to
    avoid a DeprecationWarning, and a crash.
  - Use new io_add_watch api on new versions of pygobject.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (c) Twisted Matrix Laboratories.
2
 
# See LICENSE for details.
3
 
 
4
 
"""
5
 
Test app for PostfixTCPMapServer.
6
 
 
7
 
Call with parameters KEY1=VAL1 KEY2=VAL2 ...
8
 
"""
9
 
 
10
 
import sys
11
 
 
12
 
from twisted.internet import reactor
13
 
from twisted.protocols import postfix
14
 
from twisted.python import log
15
 
 
16
 
log.startLogging(sys.stdout)
17
 
 
18
 
d = {}
19
 
for arg in sys.argv[1:]:
20
 
    try:
21
 
        k,v = arg.split('=', 1)
22
 
    except ValueError:
23
 
        k = arg
24
 
        v = ''
25
 
    d[k] = v
26
 
    
27
 
f = postfix.PostfixTCPMapDictServerFactory(d)
28
 
port = reactor.listenTCP(4242, f, interface='127.0.0.1')
29
 
reactor.run()