mailer/engine.py
def prioritize():
    """
    Yield the messages in the queue in the order they should be sent.
    """

    while True:
        while Message.objects.high_priority().count() or Message.objects.medium_priority().count():
            while Message.objects.high_priority().count():
                for message in Message.objects.high_priority().order_by('when_added'):
                    yield message
            while Message.objects.high_priority().count() == 0 and Message.objects.medium_priority().count():
                yield Message.objects.medium_priority().order_by('when_added')[0]
        while Message.objects.high_priority().count() == 0 and Message.objects.medium_priority().count() == 0 and Message.objects.low_priority().count():
            yield Message.objects.low_priority().order_by('when_added')[0]
        if Message.objects.all().count() == 0:
            break

    Yield the messages in the queue in the order they should be sent.
    
Yield the messages in the queue in the order they should be sent.
Yield the messages in the queue in the order they should be sent .
def prioritize():
    while True:
        while Message.objects.high_priority().count() or Message.objects.medium_priority().count():
            while Message.objects.high_priority().count():
                for message in Message.objects.high_priority().order_by('when_added'):
                    yield message
            while Message.objects.high_priority().count() == 0 and Message.objects.medium_priority().count():
                yield Message.objects.medium_priority().order_by('when_added')[0]
        while Message.objects.high_priority().count() == 0 and Message.objects.medium_priority().count() == 0 and Message.objects.low_priority().count():
            yield Message.objects.low_priority().order_by('when_added')[0]
        if Message.objects.all().count() == 0:
            break
def prioritize ( ) : while True : while Message . objects . high_priority ( ) . count ( ) or Message . objects . medium_priority ( ) . count ( ) : while Message . objects . high_priority ( ) . count ( ) : for message in Message . objects . high_priority ( ) . order_by ( 'when_added' ) : yield message while Message . objects . high_priority ( ) . count ( ) == 0 and Message . objects . medium_priority ( ) . count ( ) : yield Message . objects . medium_priority ( ) . order_by ( 'when_added' ) [ 0 ] while Message . objects . high_priority ( ) . count ( ) == 0 and Message . objects . medium_priority ( ) . count ( ) == 0 and Message . objects . low_priority ( ) . count ( ) : yield Message . objects . low_priority ( ) . order_by ( 'when_added' ) [ 0 ] if Message . objects . all ( ) . count ( ) == 0 : break
Yield the messages in the queue in the order they should be sent.
Yield the messages in the queue in the order they should be sent .
"""
    Yield the messages in the queue in the order they should be sent.
    """