Repository: django-wiki/django-wiki

Issue:
sekizai error python 3.6
![1](https://user-images.githubusercontent.com/5114048/47404817-c0e3a280-d71c-11e8-9708-51b25883adfc.png)
![2](https://user-images.githubusercontent.com/5114048/47404822-c50fc000-d71c-11e8-8cb3-8e031523f04a.png)


It is to report what looks like an error in python 3.6
sekizai, has stopped updating, which is a bad idea to use this long-term dependency.


Discussion:
"alert-success" looks oddly like a CSS class name
Have you customized `WIKI_MESSAGE_TAG_CSS_CLASS` ?
I'm also having this issue. 
Some info:
* `WIKI_MESSAGE_TAG_CSS_CLASS` is unmodified.
* Tried with python 3.5 and 3.6
* Django 2.0.9, wiki 0.4.1

Apparently this error occurs when you have the `MESSAGE_TAGS` setting set.
I'm using version 0.4.x, unmodified (only the html and css have changed)

This error occurs when an alert message is triggered.

{% wiki-messages %}

**It is causing this error**

```
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]
```
https://github.com/django-wiki/django-wiki/blob/master/src/wiki/templatetags/wiki_tags.py#L84


@teury what's the output from running this?

```
$ python manage.py shell
from django.conf import settings
print(settings.MESSAGE_TAGS)
```
If this error has occurred suddenly, it must be a load order change. As I read the rather messy code of `django.contrib.messages`, it will assign `messages.storage.base.LEVEL_TAGS` in the global module space at load time, which might be resolved before `wiki.conf.settings`.

Thus, when a message is created, it gets created with different tags.

ANYWAYS! I think that the way messages are stored and have their tags applied is based on a mistaken assumption that they do not have their original level (ERROR/DEBUG/INFO etc) stored. They actually do, so the issue should be fixable in this manner...

Resolving patch:
diff --git a/src/wiki/conf/settings.py b/src/wiki/conf/settings.py
--- a/src/wiki/conf/settings.py
+++ b/src/wiki/conf/settings.py
@@ -160,16 +160,16 @@
 #: 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",
     }
 )
 
diff --git a/src/wiki/templatetags/wiki_tags.py b/src/wiki/templatetags/wiki_tags.py
--- a/src/wiki/templatetags/wiki_tags.py
+++ b/src/wiki/templatetags/wiki_tags.py
@@ -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
     })


Test patch: