whitespace fixes
[mirror/userdir-ldap.git] / ud-generate
index c448701..6e4cf4d 100755 (executable)
@@ -582,8 +582,7 @@ def GenMarkers(File):
       # Write out the position for each user
       for x in PasswdAttrs:
          a = UDLdap.Account(x[0], x[1])
-         if not ('latitude' in a and 'longitude' in a):
-            continue
+         if not ('latitude' in a and 'longitude' in a): continue
          try:
             Line = "%8s %8s \"\""%(a.latitude_dec(True), a.longitude_dec(True))
             Line = Sanitize(Line) + "\n"
@@ -609,10 +608,8 @@ def GenPrivate(File):
       # Write out the position for each user
       for x in DebianDDUsers:
          a = UDLdap.Account(x[0], x[1])
-         if not a.is_active_user():
-            continue
-         if not 'privateSub' in a:
-            continue
+         if not a.is_active_user(): continue
+         if not 'privateSub' in a: continue
          try:
             Line = "%s"%(a['privateSub'])
             Line = Sanitize(Line) + "\n"
@@ -639,8 +636,7 @@ def GenDisabledAccounts(File):
       I = 0
       for x in PasswdAttrs:
          a = UDLdap.Account(x[0], x[1])
-         if a.pw_active():
-            continue
+         if a.pw_active(): continue
          Line = "%s:%s" % (a['uid'], "Account is locked")
          DisabledUsers.append(x)
          F.write(Sanitize(Line) + "\n")
@@ -661,19 +657,11 @@ def GenMailDisable(File):
       global PasswdAttrs
      
       for x in PasswdAttrs:
-         Reason = None
-     
-         if x[1].has_key("mailDisableMessage"):
-            Reason = GetAttr(x, "mailDisableMessage")
-         else:
-            continue
-     
-         try:
-            Line = "%s: %s"%(GetAttr(x, "uid"), Reason)
-            Line = Sanitize(Line) + "\n"
-            F.write(Line)
-         except:
-            pass
+         a = UDLdap.Account(x[0], x[1])
+         if not 'mailDisableMessage' in a: continue
+         Line = "%s: %s"%(a['uid'], a['mailDisableMessage'])
+         Line = Sanitize(Line) + "\n"
+         F.write(Line)
   
    # Oops, something unspeakable happened.
    except:
@@ -682,7 +670,7 @@ def GenMailDisable(File):
    Done(File, F, None)
 
 # Generate a list of uids that should have boolean affects applied
-def GenMailBool(File, Key):
+def GenMailBool(File, key):
    F = None
    try:
       F = open(File + ".tmp", "w")
@@ -691,21 +679,13 @@ def GenMailBool(File, Key):
       global PasswdAttrs
      
       for x in PasswdAttrs:
-         Reason = None
-     
-         if x[1].has_key(Key) == 0:
-            continue
-     
-         if GetAttr(x, Key) != "TRUE":
-            continue
-     
-         try:
-            Line = "%s"%(GetAttr(x, "uid"))
-            Line = Sanitize(Line) + "\n"
-            F.write(Line)
-         except:
-            pass
-  
+         a = UDLdap.Account(x[0], x[1])
+         if not key in a: continue
+         if not a[key] == 'TRUE': continue
+         Line = "%s"%(a['uid'])
+         Line = Sanitize(Line) + "\n"
+         F.write(Line)
+
    # Oops, something unspeakable happened.
    except:
       Die(File, F, None)