]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
rlm_python: Update example.py to be Python3 friendly (#2980)
authorJorge Pereira <jpereira@users.noreply.github.com>
Thu, 12 Sep 2019 23:01:13 +0000 (20:01 -0300)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 12 Sep 2019 23:01:13 +0000 (18:01 -0500)
Of course, keep to be supported by Python 2.x also.

src/modules/rlm_python/example.py

index 5950a076783245c589678ec8e9098f5859d5d7fa..3ba9a92efb2c244370d6449557edcecf6842a60f 100644 (file)
@@ -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
-