Skip to content

Commit 2ba6884

Browse files
authored
Merge pull request UWPCE-PythonCert#184 from johnnzz/partial_json_save_support
Partial json save support
2 parents 15fc46d + 41c5ed2 commit 2ba6884

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

students/johnn/mailroom/mailroom/donors.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
import os
1010
from mailroom import security
1111
from mailroom.audit import audit_log
12+
import json_save.json_save_meta as js
1213

1314

14-
class Donors:
15+
class Donors(js.JsonSaveable):
1516

1617
"""
1718
Class that stores donor records
@@ -26,6 +27,9 @@ class Donors:
2627
donor did.
2728
"""
2829

30+
_donors = js.Dict()
31+
audit = js.List()
32+
2933
def __init__(self, donor=None):
3034

3135
self.__name__ = "Donors"
@@ -94,7 +98,7 @@ def match_donor(self, query_full_name):
9498
return matches
9599

96100

97-
class Donor:
101+
class Donor(js.JsonSaveable):
98102

99103
"""
100104
Class to store a donor record
@@ -172,6 +176,15 @@ class Donor:
172176
173177
"""
174178

179+
created = js.String()
180+
audit = js.List()
181+
_did = js.String()
182+
_first_name = js.String()
183+
_last_name = js.String()
184+
_middle_name = js.String()
185+
_suffix = js.String()
186+
_donations = js.List()
187+
175188
def __init__(self,
176189
did="",
177190
created="",
@@ -190,7 +203,7 @@ def __init__(self,
190203
if did == "":
191204
did = str(uuid.uuid1())
192205
# create a uuid for each record
193-
self._did = did
206+
self.did = did
194207

195208
# normally, no timestamp is passed in, so we create one
196209
if created == "":
@@ -240,6 +253,12 @@ def did(self):
240253
""" return the donor did """
241254
return self._did
242255

256+
@did.setter
257+
@audit_log
258+
def did(self, value):
259+
""" set the did """
260+
self._did = value
261+
243262
@property
244263
def donations(self):
245264
""" print all donations """

0 commit comments

Comments
 (0)