docs: python bindings howto
authorBen McGinnes <ben@adversary.org>
Thu, 24 May 2018 19:22:16 +0000 (05:22 +1000)
committerBen McGinnes <ben@adversary.org>
Thu, 24 May 2018 19:50:11 +0000 (05:50 +1000)
* Fixed the groups.py script so it really does what is described (the
  old code had the same result for groups, group_lines and
  group_lists).
* Updated the corresponding example in the doc to match.

lang/python/docs/GPGMEpythonHOWTOen.org
lang/python/examples/howto/groups.py

index d7a1891..c9397bc 100644 (file)
         if lines[i].startswith("group") is True:
             line = lines[i]
         else:
-            pass
+                pass
 
      groups = line.split(":")[-1].replace('"', '').split(',')
 
-     group_lines = groups
-     for i in range(len(group_lines)):
-        group_lines[i] = group_lines[i].split("=")
+     group_lines = []
+     group_lists = []
+
+     for i in range(len(groups)):
+        group_lines.append(groups[i].split("="))
+        group_lists.append(groups[i].split("="))
 
-     group_lists = group_lines
      for i in range(len(group_lists)):
         group_lists[i][1] = group_lists[i][1].split()
    #+end_src
index 5e7fdf6..fe31d7f 100644 (file)
@@ -41,10 +41,12 @@ for i in range(len(lines)):
 
 groups = line.split(":")[-1].replace('"', '').split(',')
 
-group_lines = groups
-for i in range(len(group_lines)):
-    group_lines[i] = group_lines[i].split("=")
+group_lines = []
+group_lists = []
+
+for i in range(len(groups)):
+    group_lines.append(groups[i].split("="))
+    group_lists.append(groups[i].split("="))
 
-group_lists = group_lines
 for i in range(len(group_lists)):
     group_lists[i][1] = group_lists[i][1].split()