~netlandish/django-wiki

4a634b04d83b874f175160aed559dac4b852f95e — Benjamin Bach 6 years ago 2043d04 + 8a0d09a
Merge branch 'releases/0.4.x'
3 files changed, 16 insertions(+), 11 deletions(-)

M docs/release_notes.rst
M src/wiki/conf/settings.py
M src/wiki/templatetags/wiki_tags.py
M docs/release_notes.rst => docs/release_notes.rst +9 -0
@@ 20,6 20,15 @@ Changed
* Update to Markdown >= 3 :url-issue:`920` (Don Bowman)


0.4.2
-----

Security
~~~~~~~~

* Using customized ``MESSAGE_TAGS`` setting caused ``KEY_ERROR`` :url-issue:`922` (Benjamin Bach)


0.4.1
-----


M src/wiki/conf/settings.py => src/wiki/conf/settings.py +6 -6
@@ 159,16 159,16 @@ LOG_IPS_ANONYMOUS = getattr(django_settings, 'WIKI_LOG_IPS_ANONYMOUS', True)
#: Do we want to log IPs of logged in users?
LOG_IPS_USERS = getattr(django_settings, 'WIKI_LOG_IPS_USERS', False)

#: Mapping from message.tag to bootstrap class names.
#: Mapping from message.level to bootstrap class names.
MESSAGE_TAG_CSS_CLASS = getattr(
    django_settings,
    'WIKI_MESSAGE_TAG_CSS_CLASS',
    {
        messages.DEFAULT_TAGS[messages.DEBUG]: "alert alert-info",
        messages.DEFAULT_TAGS[messages.ERROR]: "alert alert-danger",
        messages.DEFAULT_TAGS[messages.INFO]: "alert alert-info",
        messages.DEFAULT_TAGS[messages.SUCCESS]: "alert alert-success",
        messages.DEFAULT_TAGS[messages.WARNING]: "alert alert-warning",
        messages.DEBUG: "alert alert-info",
        messages.ERROR: "alert alert-danger",
        messages.INFO: "alert alert-info",
        messages.SUCCESS: "alert alert-success",
        messages.WARNING: "alert alert-warning",
    }
)


M src/wiki/templatetags/wiki_tags.py => src/wiki/templatetags/wiki_tags.py +1 -5
@@ 80,11 80,7 @@ def wiki_messages(context):

    messages = context.get('messages', [])
    for message in messages:
        message.css_class = ""
        for tag in message.tags.split(" "):
            # Drop KeyError if MESSAGE_TAG_CSS_CLASS doesn't have the tag,
            # that seems valuable.
            message.css_class += " " + settings.MESSAGE_TAG_CSS_CLASS[tag]
        message.css_class = settings.MESSAGE_TAG_CSS_CLASS[message.level]
    context.update({
        'messages': messages
    })