Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The current fix (in 0.6.30) had an issue with media paths. The media filter always returned paths to the default skin.

This (in skins/utils.py) did work:

skin_found = False
for skins in reversed(get_skin_dirs()):

    #see if file exists, if not, try skins 'default', then 'common'
    file_path = os.path.join(skins, use_skin, 'media', url)
    if not os.path.isfile(file_path):
        file_path = os.path.join(skins, 'default', 'media', url)
        if os.path.isfile(file_path):
            use_skin = 'default'
            skin_found = True
            break
        else:
            file_path = os.path.join(skins, 'common', 'media', url)
            if os.path.isfile(file_path):
                use_skin = 'common'
                skin_found = True
                break
    else:
        skin_found = True
        break

if not skin_found:
    log_message = 'missing media resource %s in skin %s' \
                % (url, use_skin)
    logging.critical(log_message)
    use_skin = ''
    return None
click to hide/show revision 2
added waring re testing

The current fix (in 0.6.30) had an issue with media paths. The media filter always returned paths to the default skin.

This (in skins/utils.py) did work:

skin_found = False
for skins in reversed(get_skin_dirs()):

    #see if file exists, if not, try skins 'default', then 'common'
    file_path = os.path.join(skins, use_skin, 'media', url)
    if not os.path.isfile(file_path):
        file_path = os.path.join(skins, 'default', 'media', url)
        if os.path.isfile(file_path):
            use_skin = 'default'
            skin_found = True
            break
        else:
            file_path = os.path.join(skins, 'common', 'media', url)
            if os.path.isfile(file_path):
                use_skin = 'common'
                skin_found = True
                break
    else:
        skin_found = True
        break

if not skin_found:
    log_message = 'missing media resource %s in skin %s' \
                % (url, use_skin)
    logging.critical(log_message)
    use_skin = ''
    return None

This is not well tested ("works for me") and has not been tested at all with multiple skin directories.

Also note your server config needs to be updated if you use the new skin setting to ensure media is served directly by the server (rather than by the Django fast cgi process).

click to hide/show revision 3
images directory needs copying

The current fix (in 0.6.30) had an issue with media paths. The media filter always returned paths to the default skin.

This (in skins/utils.py) did work:

skin_found = False
for skins in reversed(get_skin_dirs()):

    #see if file exists, if not, try skins 'default', then 'common'
    file_path = os.path.join(skins, use_skin, 'media', url)
    if not os.path.isfile(file_path):
        file_path = os.path.join(skins, 'default', 'media', url)
        if os.path.isfile(file_path):
            use_skin = 'default'
            skin_found = True
            break
        else:
            file_path = os.path.join(skins, 'common', 'media', url)
            if os.path.isfile(file_path):
                use_skin = 'common'
                skin_found = True
                break
    else:
        skin_found = True
        break

if not skin_found:
    log_message = 'missing media resource %s in skin %s' \
                % (url, use_skin)
    logging.critical(log_message)
    use_skin = ''
    return None

This is not well tested ("works for me") and has not been tested at all with multiple skin directories.

Also note your server config needs to be updated if you use the new skin setting to ensure media is served directly by the server (rather than by the Django fast cgi process).

edit: if you are doing a variant of the default theme, you do need to copy the image directory over, as there are some relative references to images from the css.