[Python-checkins] python/dist/src/Lib smtpd.py,1.13,1.14
montanaro at users.sourceforge.net
montanaro at users.sourceforge.net
Sat Jun 26 15:18:51 EDT 2004
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16173
Modified Files:
smtpd.py
Log Message:
Allow classes from other modules to be specified at startup. For example,
using the postfixproxy module from Spambayes you might start smtpd up like
smtpd.py -c spambayes.postfixproxy.SpambayesProxy :8025 :8026
Index: smtpd.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/smtpd.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** smtpd.py 14 May 2002 02:13:30 -0000 1.13
--- smtpd.py 26 Jun 2004 19:18:49 -0000 1.14
***************
*** 534,539 ****
'Cannot setuid "nobody"; try running with -n option.'
sys.exit(1)
! import __main__
! class_ = getattr(__main__, options.classname)
proxy = class_((options.localhost, options.localport),
(options.remotehost, options.remoteport))
--- 534,546 ----
'Cannot setuid "nobody"; try running with -n option.'
sys.exit(1)
! classname = options.classname
! if "." in classname:
! lastdot = classname.rfind(".")
! mod = __import__(classname[:lastdot], globals(), locals(), [""])
! classname = classname[lastdot+1:]
! else:
! import __main__ as mod
! print mod.__name__, dir(mod)
! class_ = getattr(mod, classname)
proxy = class_((options.localhost, options.localport),
(options.remotehost, options.remoteport))
More information about the Python-checkins
mailing list