Also write member data as a members.csv
authorJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Mon, 28 May 2012 14:54:11 +0000 (14:54 +0000)
committerJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Mon, 28 May 2012 14:54:11 +0000 (14:54 +0000)
members.py

index a8fcd6407766fd69d13f1575f3080da059a37a3c..4923a4878b7c24b3e77b0b72174456de812c17d2 100755 (executable)
@@ -494,3 +494,21 @@ if __name__ == '__main__':
         f.seek(0)
         f.write(repr(newmembers))
         f.truncate()
+        f.close()
+
+        members_csvfilename = os.path.join(BASE_DIRECTORY, "members.csv")
+        f = open(members_csvfilename, mode='w', encoding='utf-8')
+        f.write('grade,nick,field,techno,anthill,active,colonized\n')
+        for nick, data in newmembers.items():
+            data = [
+                data['grade'],
+                nick,
+                data['field'],
+                data['techno'],
+                data['anthill'],
+                data['active'],
+                data['colonized'],
+                ]
+            data = [ str(x) for x in data ]
+            f.write(','.join(data) + '\n')
+        f.close()