Ejemplo n.º 1
0
 def getMessage(self):
     """Check signatories validator and generate status message
     of the form {"level": <level> , "message_text": "<i18n_message>"}
     """
     message = {"level": "info", "message_text": u""}
     validator = ISignatoriesValidator(self.context, None)
     if validator is None:
         return message
     if validator.requireSignatures():
         if validator.validateConsentedSignatories():
             message["message_text"] = _("signature_requirement_met",
                 default=(u"This document has the required number of "
                     u"signatories. ${signed_members} member(s) have signed"
                     u". ${required_members} signature(s) required."
                 ),
                 mapping = {
                     "signed_members": validator.consented_signatories,
                     "required_members": validator.min_signatories
                 }
             )
         else:
             message["level"] = "warning"
             message["message_text"] = _("signature_requirements_not_met",
                     default=(u"This document does not have the required "
                         u"number of signatories. Requires "
                         u"${required_members} signature(s). " 
                         u"${signed_members} member(s) have signed."
                     ),
                     mapping={
                         "required_members": validator.min_signatories,
                         "signed_members": validator.consented_signatories
                     }
             )
     return message
Ejemplo n.º 2
0
 def getMessage(self):
     """Check signatories validator and generate status message
     of the form {"level": <level> , "message_text": "<i18n_message>"}
     """
     message = {"level": "info", "message_text": u""}
     validator = ISignatoriesValidator(self.context, None)
     if validator is None:
         return message
     if validator.requireSignatures():
         if validator.validateConsentedSignatories():
             message["message_text"] = _(
                 "signature_requirement_met",
                 default=(
                     u"This document has the required number of "
                     u"signatories. ${signed_members} member(s) have signed"
                     u". ${required_members} signature(s) required."),
                 mapping={
                     "signed_members": validator.consented_signatories,
                     "required_members": validator.min_signatories
                 })
         else:
             message["level"] = "warning"
             message["message_text"] = _(
                 "signature_requirements_not_met",
                 default=(u"This document does not have the required "
                          u"number of signatories. Requires "
                          u"${required_members} signature(s). "
                          u"${signed_members} member(s) have signed."),
                 mapping={
                     "required_members": validator.min_signatories,
                     "signed_members": validator.consented_signatories
                 })
     return message