コード例 #1
0
def get_priority(priority):
    from mailer.models import PRIORITY_MAPPING, PRIORITY_MEDIUM
    if priority is None:
        priority = PRIORITY_MEDIUM

    if priority in PRIORITY_MAPPING:
        warnings.warn("Please pass one of the PRIORITY_* constants to 'send_mail' "
                      "and 'send_html_mail', not '{0}'.".format(priority),
                      DeprecationWarning)
        priority = PRIORITY_MAPPING[priority]
    if priority not in PRIORITY_MAPPING.values():
        raise ValueError("Invalid priority {0}".format(repr(priority)))
    return priority
コード例 #2
0
def get_priority(priority):
    from mailer.models import PRIORITY_MAPPING, PRIORITY_MEDIUM
    if priority is None:
        priority = PRIORITY_MEDIUM

    if priority in PRIORITY_MAPPING:
        warnings.warn("Please pass one of the PRIORITY_* constants to 'send_mail' "
                      "and 'send_html_mail', not '{0}'.".format(priority),
                      DeprecationWarning)
        priority = PRIORITY_MAPPING[priority]
    if priority not in PRIORITY_MAPPING.values():
        raise ValueError("Invalid priority {0}".format(repr(priority)))
    return priority