Commits

David Jean Louis committed 7dde806

don't fail if the feedparser module is not installed but display a warning in the module instead

  • Participants
  • Parent commits 066824b

Comments (0)

Files changed (4)

admin_tools/dashboard/models.py

         try:
             import feedparser
         except ImportError:
-            raise ImportError('You must install the feedparser python module')
+            self.children.append({
+                'title': ('You must install the FeedParser python module'),
+                'warning': True,
+            })
+            return
 
         feed = feedparser.parse(self.feed_url)
         if self.limit is not None:

admin_tools/dashboard/templates/dashboard/modules/feed.html

     {% for child in module.children %}
     <li class="{% cycle 'odd' 'even' %}">
         {% if child.date %}<span class="float-right">{{ child.date|date }}&nbsp;</span>{% endif %}
-        <a class="external-link" href="{{ child.url }}">{{ child.title }}</a>
+        {% if child.warning %}<span class="warning">{{ child.title }}</span>{% else %}<a class="external-link" href="{{ child.url }}">{{ child.title }}</a>{% endif %}
     </li>
     {% endfor %}
     {% endspaceless %}

admin_tools/media/admin_tools/css/dashboard.css

 /* }}} */
 /* Dashboard general styles {{{ */
 
+.warning {
+    color: red;
+    background: transparent url(../images/admin-tools.png) 0 -410px no-repeat;
+    padding-left: 25px;
+    height: 25px;
+}
+
 .dashboard #content {
     display: block;
     width: auto; !important;

admin_tools/media/admin_tools/images/admin-tools.png

Old
Old image
New
New image