|
26 | 26 | import pathlib |
27 | 27 |
|
28 | 28 | import asfpy.db |
| 29 | +import easydict |
29 | 30 |
|
30 | 31 | from . import crypto |
31 | 32 | from . import vtypes |
@@ -114,11 +115,10 @@ def gather_election_data(self, pdb): |
114 | 115 | idata = ''.join(f'{i.iid}{i.title}{i.description}{i.type}{i.kv}' |
115 | 116 | for i in self.q_issues.fetchall()) |
116 | 117 |
|
| 118 | + # Include the PID and EMAIL for each Person. |
117 | 119 | ### we don't want all people. Just those who are allowed to |
118 | 120 | ### vote in this Election. Examine the "mayvote" table. |
119 | | - ### list_persons returns 3-tuples of (PID,NAME,EMAIL). We only |
120 | | - ### want pid/email in PDATA. |
121 | | - pdata = ''.join(p[0] + p[2] for p in pdb.list_persons()) |
| 121 | + pdata = ''.join(p.pid + p.email for p in pdb.list_persons()) |
122 | 122 |
|
123 | 123 | return (mdata + idata + pdata).encode() |
124 | 124 |
|
@@ -188,11 +188,15 @@ def delete_issue(self, iid): |
188 | 188 | self.c_delete_issue.perform(iid) |
189 | 189 |
|
190 | 190 | def list_issues(self): |
191 | | - "Return ordered (IID, TITLE, DESCRIPTION, TYPE, KV) for all ISSUES." |
| 191 | + "Return ordered EasyDicgt<IID, TITLE, DESCRIPTION, TYPE, KV> for all ISSUES." |
192 | 192 |
|
193 | 193 | def extract_issue(row): |
194 | | - return (row.iid, row.title, row.description, row.type, |
195 | | - self.json2kv(row.kv),) |
| 194 | + return easydict.EasyDict(iid=row.iid, |
| 195 | + title=row.title, |
| 196 | + description=row.description, |
| 197 | + type=row.type, |
| 198 | + kv=self.json2kv(row.kv), |
| 199 | + ) |
196 | 200 |
|
197 | 201 | self.q_issues.perform(self.eid) |
198 | 202 | return [ extract_issue(row) for row in self.q_issues.fetchall() ] |
|
0 commit comments