From: Jorge Pereira Date: Thu, 12 Sep 2019 23:01:13 +0000 (-0300) Subject: rlm_python: Update example.py to be Python3 friendly (#2980) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=149483b4752483771db7464df6d468bbbcd9f60c;p=thirdparty%2Ffreeradius-server.git rlm_python: Update example.py to be Python3 friendly (#2980) Of course, keep to be supported by Python 2.x also. --- diff --git a/src/modules/rlm_python/example.py b/src/modules/rlm_python/example.py index 5950a076783..3ba9a92efb2 100644 --- a/src/modules/rlm_python/example.py +++ b/src/modules/rlm_python/example.py @@ -8,60 +8,58 @@ import radiusd def instantiate(p): - print "*** instantiate ***" - print p + print("*** instantiate ***") + print(p) # return 0 for success or -1 for failure def authorize(p): - print "*** authorize ***" - print + print("*** authorize ***") + print("") radiusd.radlog(radiusd.L_INFO, '*** radlog call in authorize ***') - print - print p - print - print radiusd.config - print + print("") + print(p) + print("") + print(radiusd.config) + print("") return radiusd.RLM_MODULE_OK def preacct(p): - print "*** preacct ***" - print p + print("*** preacct ***") + print(p) return radiusd.RLM_MODULE_OK def accounting(p): - print "*** accounting ***" + print("*** accounting ***") radiusd.radlog(radiusd.L_INFO, '*** radlog call in accounting (0) ***') - print - print p + print("") + print(p) return radiusd.RLM_MODULE_OK def pre_proxy(p): - print "*** pre_proxy ***" - print p + print("*** pre_proxy ***") + print(p) return radiusd.RLM_MODULE_OK def post_proxy(p): - print "*** post_proxy ***" - print p + print("*** post_proxy ***") + print(p) return radiusd.RLM_MODULE_OK def post_auth(p): - print "*** post_auth ***" - print p + print("*** post_auth ***") + print(p) return radiusd.RLM_MODULE_OK def recv_coa(p): - print "*** recv_coa ***" - print p + print("*** recv_coa ***") + print(p) return radiusd.RLM_MODULE_OK def send_coa(p): - print "*** send_coa ***" - print p + print("*** send_coa ***") + print(p) return radiusd.RLM_MODULE_OK - def detach(): - print "*** goodbye from example.py ***" + print("*** goodbye from example.py ***") return radiusd.RLM_MODULE_OK -