Ejemplo n.º 1
0
 def save(self, email_template_name=None, use_https=False, token_generator=default_token_generator, from_email=None, request=None, email_template=None, **kwargs):
     if not email_template:
         email_template = email_template_name
     if not email_template:
         email_template = auth.default_password_reset_template()
     user = self.get_user()
     domain = viewutil.get_request_server_url(request)
     return auth.send_password_reset_mail(domain, user, email_template, sender=from_email, token_generator=token_generator)
Ejemplo n.º 2
0
 def save(self, email_template_name=None, use_https=False, token_generator=default_token_generator, from_email=None, request=None, email_template=None, **kwargs):
     if not email_template:
         email_template = email_template_name
     if not email_template:
         email_template = auth.default_password_reset_template()
     user = self.get_user()
     domain = viewutil.get_request_server_url(request)
     return auth.send_password_reset_mail(domain, user, email_template, sender=from_email, token_generator=token_generator)
Ejemplo n.º 3
0
import post_office.models

from tracker import prizemail, auth, commandutil

_default_templates = {
    auth.default_password_reset_template_name(): auth.default_password_reset_template(),
    auth.default_registration_template_name(): auth.default_registration_template(),
    auth.default_volunteer_registration_template_name(): auth.default_volunteer_registration_template(),
    prizemail.default_prize_winner_template_name(): prizemail.default_prize_winner_template(),
    prizemail.default_prize_contributor_template_name(): prizemail.default_prize_contributor_template(),
    prizemail.default_prize_winner_accept_template_name(): prizemail.default_prize_winner_accept_template(),
    prizemail.default_prize_shipping_template_name(): prizemail.default_prize_shipping_template(),
    prizemail.default_activate_prize_handlers_template_name(): prizemail.default_activate_prize_handlers_template(),
}


def email_template_name(arg):
    parts = arg.partition(':')
    template_obj = _default_templates[parts[0]]
    custom_name = None
    if parts[1] == ':':
        if parts[2]:
            custom_name = parts[2]
        else:
            raise Exception('Must specify custom name after colon')
    return (template_obj, custom_name)


class Command(commandutil.TrackerCommand):
    help = 'Generates all default mail templates that are not currently in the database'
from django.core.management.base import BaseCommand, CommandError

import post_office

import tracker.prizemail as prizemail
import tracker.auth as auth
import tracker.commandutil as commandutil

_defaultTemplates = {
    auth.default_password_reset_template_name(): auth.default_password_reset_template(),
    auth.default_registration_template_name(): auth.default_registration_template(),
    prizemail.default_prize_winner_template_name(): prizemail.default_prize_winner_template(),
    prizemail.default_prize_contributor_template_name(): prizemail.default_prize_contributor_template(),
    prizemail.default_prize_winner_accept_template_name(): prizemail.default_prize_winner_accept_template(),
    prizemail.default_prize_shipping_template_name(): prizemail.default_prize_shipping_template(),
    prizemail.default_activate_prize_handlers_template_name(): prizemail.default_activate_prize_handlers_template(),
}

def email_template_name(arg):
    parts = arg.partition(':')
    templateObj = _defaultTemplates[parts[0]]
    customName = None
    if parts[1] == ':':
        if parts[2]:
            customName = parts[2]
        else:
            raise Exception("Must specify custom name after colon")
    return (templateObj,customName)
         

class Command(commandutil.TrackerCommand):