VALUES(%s, %s, %s)", self.uid, reset_code, address)
# Send a password reset email
- self.backend.messages.send_template("auth/messages/password-reset",
- priority=100, account=self, reset_code=reset_code)
+ self.send_message("auth/messages/password-reset", priority=100, reset_code=reset_code)
def reset_password(self, reset_code, new_password):
# Delete the reset token
set_contents_to_promotional_emails,
)
+ # Messages
+
+ def send_message(self, *args, **kwargs):
+ """
+ Sends an email
+ """
+ return self.backend.messages.send_template(*args, account=self, **kwargs)
+
# Bugzilla
async def _disable_on_bugzilla(self, text=None):
with self.db.transaction():
# Generate an email for everybody in this group
for account in group:
- self.backend.messages.send_template("blog/messages/announcement",
- account=account, post=self)
+ account.send_message("blog/messages/announcement", post=self)
# Mark this post as announced
self.db.execute("UPDATE blog SET announced_at = CURRENT_TIMESTAMP \
# Generate the email
if self.should_be_sent:
- self.backend.messages.send_template(self.template, account=self.account)
+ account.send_message(self.template)
# Update this email for the next launch
self._update()
logging.debug("Sending watcher email to %s" % watcher)
# Compose message
- self.backend.messages.send_template("wiki/messages/page-changed",
- account=watcher, page=self, priority=-10)
+ watcher.send_message("wiki/messages/page-changed", page=self, priority=-10)
def restore(self, author, address, comment=None):
changes = "Restore to revision from %s" % self.timestamp.isoformat()