diff --git a/cabot/cabotapp/alert.py b/cabot/cabotapp/alert.py index 0b70e30..eefd83a 100644 --- a/cabot/cabotapp/alert.py +++ b/cabot/cabotapp/alert.py @@ -27,7 +27,7 @@ class AlertPlugin(PolymorphicModel): def __unicode__(self): return u'%s' % (self.title) - def send_alert(service, users, duty_officers): + def send_alert(self, service, users, duty_officers): """ Implement a send_alert function here that shall be called. """ @@ -39,7 +39,7 @@ class AlertPluginUserData(PolymorphicModel): class Meta: unique_together = ('title', 'user',) - + def __unicode__(self): return u'%s' % (self.title) diff --git a/cabot/settings.py b/cabot/settings.py index e92f223..ee5371a 100644 --- a/cabot/settings.py +++ b/cabot/settings.py @@ -1,5 +1,6 @@ import os import dj_database_url +import re from django.conf import settings from cabot.celeryconfig import * from cabot.cabot_config import * @@ -125,8 +126,13 @@ INSTALLED_APPS = ( ) # Load additional apps from configuration file +CABOT_PLUGINS_ENABLED_PARSED = [] for plugin in CABOT_PLUGINS_ENABLED.split(","): - INSTALLED_APPS += (plugin,) + # Hack to clean up if versions of plugins specified + exploded = re.split(r'[<>=]+', plugin) + CABOT_PLUGINS_ENABLED_PARSED.append(exploded[0]) + +INSTALLED_APPS += tuple(CABOT_PLUGINS_ENABLED_PARSED) COMPRESS_PRECOMPILERS = ( ('text/coffeescript', 'coffee --compile --stdio'), diff --git a/cabot/urls.py b/cabot/urls.py index bf13042..72c1f27 100644 --- a/cabot/urls.py +++ b/cabot/urls.py @@ -24,6 +24,9 @@ from django.contrib.auth.views import login, logout, password_reset, password_re admin.autodiscover() from importlib import import_module +import logging + +logger = logging.getLogger(__name__) urlpatterns = patterns('', url(r'^$', view=RedirectView.as_view(url='services/', permanent=False), @@ -143,11 +146,11 @@ def append_plugin_urls(): Appends plugin specific URLs to the urlpatterns variable. """ global urlpatterns - for plugin in settings.CABOT_PLUGINS_ENABLED.split(','): + for plugin in settings.CABOT_PLUGINS_ENABLED_PARSED: try: _module = import_module('%s.urls' % plugin) - except: - pass + except Exception as e: + logger.error('No url file available for plugin %s' % plugin) else: urlpatterns += patterns('', url(r'^plugins/%s/' % plugin, include('%s.urls' % plugin))