Use print function everywhere
This commit is contained in:
+5
-4
@@ -8,6 +8,7 @@
|
||||
# Copyright 2001,2009 Business Management Systems, Inc.
|
||||
# This code is under the GNU General Public License. See COPYING for details.
|
||||
|
||||
from __future__ import print_function
|
||||
__version__ = '0.9.8'
|
||||
|
||||
import os
|
||||
@@ -365,7 +366,7 @@ class Base(object):
|
||||
for func,(nr,nc) in OPTIONAL_CALLBACKS.items():
|
||||
func = getattr(klass,func)
|
||||
ca = getattr(func,'milter_protocol',0)
|
||||
#print func,hex(nr),hex(nc),hex(ca)
|
||||
#print(func,hex(nr),hex(nc),hex(ca))
|
||||
p |= (nr|nc) & ~ca
|
||||
klass._protocol_mask = p
|
||||
return p
|
||||
@@ -579,9 +580,9 @@ class Milter(Base):
|
||||
|
||||
## Provide simple logging to sys.stdout
|
||||
def log(self,*msg):
|
||||
print 'Milter:',
|
||||
for i in msg: print i,
|
||||
print
|
||||
print('Milter:',end=None)
|
||||
for i in msg: print(i,end=None)
|
||||
print()
|
||||
|
||||
@noreply
|
||||
def connect(self,hostname,family,hostaddr):
|
||||
|
||||
+5
-2
@@ -46,6 +46,7 @@
|
||||
# Copyright 2001,2002,2003,2004,2005 Business Management Systems, Inc.
|
||||
# This code is under the GNU General Public License. See COPYING for details.
|
||||
|
||||
from __future__ import print_function
|
||||
import time
|
||||
from plock import PLock
|
||||
|
||||
@@ -147,7 +148,8 @@ class AddrCache(object):
|
||||
if not ts: return # already permanent
|
||||
self.cache[lsender] = (None,res)
|
||||
if not res:
|
||||
print >>open(self.fname,'a'),sender
|
||||
with open(self.fname,'a') as fp:
|
||||
print(sender,file=fp)
|
||||
|
||||
def __setitem__(self,sender,res):
|
||||
lsender = sender.lower()
|
||||
@@ -155,7 +157,8 @@ class AddrCache(object):
|
||||
self.cache[lsender] = (now,res)
|
||||
if not res and self.fname:
|
||||
s = time.strftime(AddrCache.time_format,time.localtime(now))
|
||||
print >>open(self.fname,'a'),sender,s # log refreshed senders
|
||||
with open(self.fname,'a') as fp:
|
||||
print(sender,s,file=fp) # log refreshed senders
|
||||
|
||||
def __len__(self):
|
||||
return len(self.cache)
|
||||
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
## @package Milter.dns
|
||||
# Provide a higher level interface to pydns.
|
||||
|
||||
from __future__ import print_function
|
||||
import DNS
|
||||
from DNS import DNSError
|
||||
|
||||
@@ -120,5 +121,5 @@ if __name__ == '__main__':
|
||||
import sys
|
||||
s = Session()
|
||||
for n,t in zip(*[iter(sys.argv[1:])]*2):
|
||||
print n,t
|
||||
print s.dns(n,t)
|
||||
print(n,t)
|
||||
print(s.dns(n,t))
|
||||
|
||||
+4
-3
@@ -69,6 +69,7 @@
|
||||
# a DSN or use a null MAIL FROM with an email address obtained from
|
||||
# anywhere else.
|
||||
#
|
||||
from __future__ import print_function
|
||||
import smtplib
|
||||
import socket
|
||||
from email.Message import Message
|
||||
@@ -230,6 +231,6 @@ Subject: Test
|
||||
Test DSN template
|
||||
"""
|
||||
)
|
||||
print msg.as_string()
|
||||
# print send_dsn(f,msg.as_string())
|
||||
# print send_dsn(q.s,'mail.example.com',msg.as_string())
|
||||
print(msg.as_string())
|
||||
# print(send_dsn(f,msg.as_string()))
|
||||
# print(send_dsn(q.s,'mail.example.com',msg.as_string()))
|
||||
|
||||
+3
-2
@@ -9,6 +9,7 @@
|
||||
# wiley-268-8196.roadrunner.nf.net at ('205.251.174.46', 4810)
|
||||
# cbl-sd-02-79.aster.com.do at ('200.88.62.79', 4153)
|
||||
|
||||
from __future__ import print_function
|
||||
import re
|
||||
|
||||
ip3 = re.compile('[0-9]{1,3}')
|
||||
@@ -91,6 +92,6 @@ if __name__ == '__main__':
|
||||
if ip in seen: continue
|
||||
seen.add(ip)
|
||||
if is_dynip(host,ip):
|
||||
print '%s\t%s DYN' % (ip,host)
|
||||
print('%s\t%s DYN' % (ip,host))
|
||||
else:
|
||||
print '%s\t%s' % (ip,host)
|
||||
print('%s\t%s' % (ip,host))
|
||||
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
from __future__ import print_function
|
||||
import time
|
||||
import shelve
|
||||
import thread
|
||||
@@ -58,7 +59,7 @@ class Greylist(object):
|
||||
cnt = 0
|
||||
dbp = self.dbp
|
||||
for key, r in dbp.iteritems():
|
||||
#print key,r,time.ctime(now)
|
||||
#print(key,r,time.ctime(now))
|
||||
if now > r.lastseen + self.greylist_retain:
|
||||
self.lock.acquire()
|
||||
try:
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@ This module is free software, and you may redistribute it and/or modify
|
||||
it under the same terms as Python itself, so long as this copyright message
|
||||
and disclaimer are retained in their original form.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
import struct
|
||||
#from spf import RE_IP4
|
||||
import re
|
||||
@@ -80,7 +81,7 @@ def inet_pton(p):
|
||||
(0, 0, 0, 0, 0, 65535, 258, 772)
|
||||
|
||||
>>> try: inet_pton('::1.2.3.4.5')
|
||||
... except ValueError,x: print x
|
||||
... except ValueError,x: print(x)
|
||||
::1.2.3.4.5
|
||||
"""
|
||||
if p == '::':
|
||||
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
## @package Milter.test
|
||||
# A test framework for milters
|
||||
|
||||
from __future__ import print_function
|
||||
import rfc822
|
||||
import StringIO
|
||||
import Milter
|
||||
@@ -35,8 +36,8 @@ class TestBase(object):
|
||||
self._symlist = [ None, None, None, None, None, None, None ]
|
||||
|
||||
def log(self,*msg):
|
||||
for i in msg: print >>self.logfp, i,
|
||||
print >>self.logfp
|
||||
for i in msg: print(i,file=self.logfp,end=None)
|
||||
print(file=self.logfp,flush=True)
|
||||
|
||||
## Set a macro value.
|
||||
# These are retrieved by the %milter with getsymval.
|
||||
|
||||
Reference in New Issue
Block a user