From f1f3725d615a51b26b9928a21930939283713472 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sat, 13 Nov 2010 01:56:39 +0100 Subject: Manage an application with no email server set --- chimere/.gitignore | 3 +++ chimere/main/actions.py | 10 +++++----- chimere/main/forms.py | 2 ++ chimere/main/models.py | 1 - chimere/urls.py | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/chimere/.gitignore b/chimere/.gitignore index dc3d5e7..282a255 100644 --- a/chimere/.gitignore +++ b/chimere/.gitignore @@ -1,2 +1,5 @@ settings.py *.pyc +*.swp +static/icons/* +static/upload/* diff --git a/chimere/main/actions.py b/chimere/main/actions.py index 4857005..f86e954 100644 --- a/chimere/main/actions.py +++ b/chimere/main/actions.py @@ -23,16 +23,16 @@ Actions available in the main interface from django.utils.translation import ugettext_lazy as _ from django.contrib.auth import models -from chimere.settings import EXTRA_URL +from chimere.settings import EXTRA_URL, EMAIL_HOST class Action: def __init__(self, id, path, label): self.id, self.path, self.label = id, path, label -actions = ((Action('view', '', _('View')), []), +actions = [(Action('view', '', _('View')), []), (Action('contribute', 'edit', _('Contribute')), (Action('edit', 'edit', _('Add a new point of interest')), Action('edit_route', 'edit_route', _('Add a new route'))) - ), - (Action('contact', 'contact', _('Contact us')), []), - ) + ),] +if EMAIL_HOST: + actions.append((Action('contact', 'contact', _('Contact us')), []),) diff --git a/chimere/main/forms.py b/chimere/main/forms.py index 4618321..f2490da 100644 --- a/chimere/main/forms.py +++ b/chimere/main/forms.py @@ -33,6 +33,8 @@ from chimere.main.models import Marker, Route, PropertyModel, Property, Area,\ from chimere.main.widgets import AreaField, PointField, TextareaWidget def notifyStaff(subject, body, sender=None): + if not settings.EMAIL_HOST: + return if settings.PROJECT_NAME: subject = u'[%s] %s' % (settings.PROJECT_NAME, subject) user_list = [u.email for u in diff --git a/chimere/main/models.py b/chimere/main/models.py index 4ef4c0d..3efc1bc 100644 --- a/chimere/main/models.py +++ b/chimere/main/models.py @@ -155,7 +155,6 @@ class SubCategory(models.Model): subcategories ''' sub_categories = {} - subcategories = None subcategories = cls.objects.filter(category__available=True) if not item_types: subcategories = subcategories.filter(available=True) diff --git a/chimere/urls.py b/chimere/urls.py index 9652eb6..b94cd6f 100644 --- a/chimere/urls.py +++ b/chimere/urls.py @@ -71,7 +71,7 @@ urlpatterns += patterns('chimere.main.views', 'getDescriptionDetail', default_dct), (base + extra + r'getGeoObjects/(?P\w+)(/(?P\w+))?$', 'getGeoObjects', default_dct), -(base + extra + r'getAvailableCategories/(?P\w+)(/(?P\w+))?(/(?P\w+))?$', +(base + extra + r'getAvailableCategories/((?P\w+))?(/(?P\w+))?(/(?P\w+))?$', 'getAvailableCategories', default_dct), (base + extra + r'getTinyUrl/(?P.*)$', 'getTinyfiedUrl', default_dct), (base + extra + r'ty/(?P\w+)$', 'redirectFromTinyURN', default_dct), -- cgit v1.2.3