comparison pages/association/membership/page_meta.py @ 21:67487063f421

fix membership following changes with new theme
author Goffi <goffi@goffi.org>
date Tue, 30 Nov 2021 17:39:46 +0100
parents 9ce41ef66dfa
children 5fd933e238bb
comparison
equal deleted inserted replaced
20:a24d362796be 21:67487063f421
61 "You must have read the documents to validate your membership request") 61 "You must have read the documents to validate your membership request")
62 WARNING_MSG_MISSING_FIELDS = D_( 62 WARNING_MSG_MISSING_FIELDS = D_(
63 "The form you posted is not complete, we can't validate this membership request.\n" 63 "The form you posted is not complete, we can't validate this membership request.\n"
64 "Please fill all the required fields, thank you!") 64 "Please fill all the required fields, thank you!")
65 65
66 @defer.inlineCallbacks 66 async def on_data_post(self, request):
67 def on_data_post(self, request):
68 data = FormData(*self.getPostedData(request, FIELDS, raise_on_missing=False)) 67 data = FormData(*self.getPostedData(request, FIELDS, raise_on_missing=False))
69 if any(not getattr(data, f) for f in REQUIRED): 68 if any(not getattr(data, f) for f in REQUIRED):
70 log.warning("missing data fields:\n{data}".format(data=data)) 69 log.warning("missing data fields:\n{data}".format(data=data))
71 raise exceptions.DataError(WARNING_MSG_MISSING_FIELDS) 70 raise exceptions.DataError(WARNING_MSG_MISSING_FIELDS)
72 if not C.bool(data.documents_read or C.BOOL_FALSE): 71 if not C.bool(data.documents_read or C.BOOL_FALSE):
75 addresses = config.getConfig( 74 addresses = config.getConfig(
76 self.host.main_conf, 75 self.host.main_conf,
77 None, 76 None,
78 "email_admins_list", 77 "email_admins_list",
79 default=Exception) 78 default=Exception)
80 yield email.sendEmail( 79 await email.sendEmail(
81 self.host.main_conf, 80 self.host.main_conf,
82 addresses, 81 addresses,
83 SUBJECT_ADMIN, 82 SUBJECT_ADMIN,
84 BODY_ADMIN.format(**data._asdict()), 83 BODY_ADMIN.format(**data._asdict()),
85 ) 84 )
86 yield email.sendEmail( 85 await email.sendEmail(
87 self.host.main_conf, 86 self.host.main_conf,
88 data.email, 87 data.email,
89 SUBJECT, 88 SUBJECT,
90 BODY.format(**data._asdict()), 89 BODY.format(**data._asdict()),
91 ) 90 )