mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2024-12-14 10:51:21 +01:00
Allow tests to run if Sites module isn't properly configured.
This commit is contained in:
parent
0bd559003b
commit
9ae358e6f8
@ -241,9 +241,13 @@ def text_is_spam(text, request):
|
|||||||
from helpdesk.akismet import Akismet
|
from helpdesk.akismet import Akismet
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
try:
|
||||||
|
site = Site.objects.get_current()
|
||||||
|
except:
|
||||||
|
site = Site(domain='configure-django-sites.com')
|
||||||
|
|
||||||
ak = Akismet(
|
ak = Akismet(
|
||||||
blog_url='http://%s/' % Site.objects.get(pk=settings.SITE_ID).domain,
|
blog_url='http://%s/' % site.domain,
|
||||||
agent='django-helpdesk',
|
agent='django-helpdesk',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -395,7 +395,10 @@ class Ticket(models.Model):
|
|||||||
"""
|
"""
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
site = Site.objects.get_current()
|
try:
|
||||||
|
site = Site.objects.get_current()
|
||||||
|
except:
|
||||||
|
site = Site(domain='configure-django-sites.com')
|
||||||
return u"http://%s%s?ticket=%s&email=%s" % (
|
return u"http://%s%s?ticket=%s&email=%s" % (
|
||||||
site.domain,
|
site.domain,
|
||||||
reverse('helpdesk_public_view'),
|
reverse('helpdesk_public_view'),
|
||||||
@ -411,7 +414,10 @@ class Ticket(models.Model):
|
|||||||
"""
|
"""
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
site = Site.objects.get_current()
|
try:
|
||||||
|
site = Site.objects.get_current()
|
||||||
|
except:
|
||||||
|
site = Site(domain='configure-django-sites.com')
|
||||||
return u"http://%s%s" % (
|
return u"http://%s%s" % (
|
||||||
site.domain,
|
site.domain,
|
||||||
reverse('helpdesk_view',
|
reverse('helpdesk_view',
|
||||||
|
@ -350,7 +350,7 @@ def update_ticket(request, ticket_id, public=False):
|
|||||||
title == ticket.title,
|
title == ticket.title,
|
||||||
priority == int(ticket.priority),
|
priority == int(ticket.priority),
|
||||||
due_date == ticket.due_date,
|
due_date == ticket.due_date,
|
||||||
(not owner and not ticket.assigned_to) or (owner and User.objects.get(id=owner) == ticket.assigned_to),
|
(owner == -1) or (not owner and not ticket.assigned_to) or (owner and User.objects.get(id=owner) == ticket.assigned_to),
|
||||||
(HAS_TAG_SUPPORT and tags == ticket.tags) or not HAS_TAG_SUPPORT,
|
(HAS_TAG_SUPPORT and tags == ticket.tags) or not HAS_TAG_SUPPORT,
|
||||||
])
|
])
|
||||||
if no_changes:
|
if no_changes:
|
||||||
|
Loading…
Reference in New Issue
Block a user