Exemple #1
0
def get_alternative_mail(req):
    name = get_name_from_number(req.pk)
    domains = get_foi_mail_domains()
    if len(domains) > 1:
        domains = domains[1:]

    random.shuffle(domains)
    return '%s_%s@%s' % (name, req.pk, domains[0])
Exemple #2
0
def get_alternative_mail(req):
    name = get_name_from_number(req.pk)
    domains = settings.FOI_EMAIL_DOMAIN
    if isinstance(domains, string_types):
        domains = [domains]
    if len(domains) > 1:
        domains = domains[1:]

    random.shuffle(domains)
    return '%s_%s@%s' % (name, req.pk, domains[0])
Exemple #3
0
def get_alternative_mail(req):
    name = get_name_from_number(req.pk)
    domains = settings.FOI_EMAIL_DOMAIN
    if isinstance(domains, str):
        domains = [domains]
    if len(domains) > 1:
        domains = domains[1:]

    random.shuffle(domains)
    return '%s_%s@%s' % (name, req.pk, domains[0])
Exemple #4
0
def get_foirequest_from_mail(email):
    from .models import FoiRequest

    if '_' in email:
        name, domain = email.split('@', 1)
        hero, num = name.rsplit('_', 1)
        try:
            num = int(num)
        except ValueError:
            return None
        hero_name = get_name_from_number(num)
        if hero_name != hero:
            return None
        try:
            return FoiRequest.objects.get(pk=num)
        except FoiRequest.DoesNotExist:
            return None

    else:
        try:
            return FoiRequest.objects.get_by_secret_mail(email)
        except FoiRequest.DoesNotExist:
            return None
Exemple #5
0
def get_foirequest_from_mail(email):
    from .models import FoiRequest

    if '_' in email:
        name, domain = email.split('@', 1)
        hero, num = name.rsplit('_', 1)
        try:
            num = int(num)
        except ValueError:
            return None
        hero_name = get_name_from_number(num)
        if hero_name != hero:
            return None
        try:
            return FoiRequest.objects.get(pk=num)
        except FoiRequest.DoesNotExist:
            return None

    else:
        try:
            return FoiRequest.objects.get_by_secret_mail(email)
        except FoiRequest.DoesNotExist:
            return None