Exemplo n.º 1
0
 def _send_claim_email(self, *args, **kwargs):
     """ This avoids needing to reimplement all of the logic in the sender methods.
     When v1 is more fully deprecated, those send hooks should be reworked to not
     rely upon a flask context and placed in utils (or elsewhere).
     :param bool registered: Indicates which sender to call (passed in as keyword)
     :param *args: Positional arguments passed to senders
     :param **kwargs: Keyword arguments passed to senders
     :return: None
     """
     from website.app import app
     from website.routes import make_url_map
     try:
         make_url_map(app)
     except AssertionError:
         # Already mapped
         pass
     ctx = app.test_request_context()
     ctx.push()
     if kwargs.pop('registered', False):
         send_claim_registered_email(*args, **kwargs)
     else:
         send_claim_email(*args, **kwargs)
     ctx.pop()
Exemplo n.º 2
0
    def _send_claim_email(self, *args, **kwargs):
        """ This avoids needing to reimplement all of the logic in the sender methods.
        When v1 is more fully deprecated, those send hooks should be reworked to not
        rely upon a flask context and placed in utils (or elsewhere).

        :param bool registered: Indicates which sender to call (passed in as keyword)
        :param *args: Positional arguments passed to senders
        :param **kwargs: Keyword arguments passed to senders
        :return: None
        """
        from website.app import app
        from website.routes import make_url_map
        try:
            make_url_map(app)
        except AssertionError:
            # Already mapped
            pass
        ctx = app.test_request_context()
        ctx.push()
        if kwargs.pop('registered', False):
            send_claim_registered_email(*args, **kwargs)
        else:
            send_claim_email(*args, **kwargs)
        ctx.pop()