[Da-tools-commits] ./debian/userdir-ldap r429: Allow setting of gender in ud-mailgate. Based on patch by Bernhard R. Link.

Peter Palfrader peter at palfrader.org
Mon Jun 9 20:59:39 UTC 2008


------------------------------------------------------------
revno: 429
committer: Peter Palfrader <peter at palfrader.org>
branch nick: userdir-ldap
timestamp: Mon 2008-06-09 22:59:39 +0200
message:
  Allow setting of gender in ud-mailgate.  Based on patch by Bernhard R. Link.
modified:
  debian/changelog
  ud-mailgate
-------------- next part --------------
=== modified file 'debian/changelog'
--- a/debian/changelog	2008-05-25 23:29:09 +0000
+++ b/debian/changelog	2008-06-09 20:59:39 +0000
@@ -11,8 +11,10 @@
     a few months they should move on to retired, with their mail
     also disabled.  accountStatus is just a freeform text, but
     these 4 options should be the only ones that exist.
+  * Allow setting of gender in ud-mailgate.  Based on patch by Bernhard
+    R.  Link.
 
- -- Peter Palfrader <weasel at debian.org>  Mon, 26 May 2008 01:27:11 +0200
+ -- Peter Palfrader <weasel at debian.org>  Mon, 09 Jun 2008 22:59:06 +0200
 
 userdir-ldap (0.3.32) unstable; urgency=low
 

=== modified file 'ud-mailgate'
--- a/ud-mailgate	2008-05-23 21:52:29 +0000
+++ b/ud-mailgate	2008-06-09 20:59:39 +0000
@@ -32,6 +32,14 @@
 SSHFingerprint = re.compile('^(\d+) ([0-9a-f\:]{47}) (.+)$')
 SSHRSA1Match = re.compile('^^(.* )?\d+ \d+ \d+')
 
+GenderTable = {"male": 1,
+	       "1": 1,
+	       "female": 2,
+	       "2": 2,
+	       "unspecified": 9,
+	       "9": 9,
+};
+
 ArbChanges = {"c": "..",
 	      "l": ".*",
 	      "facsimileTelephoneNumber": ".*",
@@ -50,6 +58,7 @@
 	      "mailGreylisting": "^(TRUE|FALSE)$",
 	      "mailCallout": "^(TRUE|FALSE)$",
 	      "VoIP": ".*",
+	      "gender": "^(1|2|9|male|female|unspecified)$",
 };
 
 DelItems = {"c": None,
@@ -158,6 +167,12 @@
    if re.match(ArbChanges[attrName],G[1]) == None:
       raise Error, "Item does not match the required format"+ArbChanges[attrName];
 
+   value = G[1];
+   if attrName == 'gender':
+      if G[1] not in GenderTable:
+         raise Error, "Gender not found in table"
+      value = GenderTable[G[1]]
+
 #   if attrName == 'birthDate':
 #      (re.match("^([0-9]{4})([01][0-9])([0-3][0-9])$",G[1]) {
 #    $bd_yr = $1; $bd_mo = $2; $bd_day = $3;
@@ -181,8 +196,8 @@
 #  } elsif (not defined($query->param('birthdate')) or $query->param('birthdate') =~ /^\s*$/) {
 #    $bd_ok = 1;
 #  }
-   Attrs.append((ldap.MOD_REPLACE,attrName,G[1]));
-   return "Changed entry %s to %s"%(attrName,G[1]);
+   Attrs.append((ldap.MOD_REPLACE,attrName,value));
+   return "Changed entry %s to %s"%(attrName,value);
 
 # Handle changing a set of arbitary fields
 #  <field>: value



More information about the Da-tools-commits mailing list