s4-dns: use neater python for reading lines
authorAndrew Tridgell <tridge@samba.org>
Mon, 19 Apr 2010 07:18:20 +0000 (17:18 +1000)
committerAndrew Tridgell <tridge@samba.org>
Mon, 19 Apr 2010 08:21:42 +0000 (18:21 +1000)
files are line iterators

source4/scripting/bin/samba_dnsupdate

index cebfae28710b7ce462da5d545e5f33b20fb61adb..3fe55e2cc552af54efaa7c8129eab7e04772d215 100755 (executable)
@@ -148,15 +148,12 @@ def check_dns_name(d):
         except IOError:
             return False
         
-        line = dns_file.readline()
-        while line:
-            line = line.rstrip().lstrip()
+        for line in dns_file:
+            line = line.strip()
             if line[0] == "#":
-                line = dns_file.readline()
                 continue
             if line.lower() == str(d).lower():
                 return True
-            line = dns_file.readline()
         return False
 
     try:
@@ -296,5 +293,3 @@ for d in update_list:
 # delete the ccache if we created it
 if ccachename is not None:
     os.unlink(ccachename)
-
-