def parse_size(size):
    """
    Converts a size specified as '800x600-fit' to a list like [800, 600]
    and a string 'fit'. The strings in the error messages are really for the
    developer so they don't need to be translated.
    """
    first_split = size.split('-')
    if len(first_split) != 2:
        raise AttributeError(
            'Size must be specified as 000x000-method such as 800x600-fit.')
    size, method = first_split
    if method not in ('fit', 'thumb'):
        raise AttributeError(
            'The method must either be "fit" or "thumb", not "%s".' % method)
    try:
        size_ints = [int(x) for x in size.split('x')]
    except ValueError:
        raise AttributeError(
            'Size must be specified as 000x000-method such as 800x600-fit.')
    if len(size_ints) != 2:
        raise AttributeError(
            'Size must be specified as 000x000-method such as 800x600-fit.')
    if size_ints[0] <= 0 or size_ints[1] <= 0:
        raise AttributeError(
            'Height and width for size must both be greater than 0.')
    return size_ints, method