forked from extern/django-helpdesk
Address deprecation warnings to be compatible with Django 2.0
This commit is contained in:
parent
f91762d4cd
commit
5112f0dfd0
@ -14,9 +14,9 @@ def protect_view(view_func):
|
|||||||
"""
|
"""
|
||||||
@wraps(view_func, assigned=available_attrs(view_func))
|
@wraps(view_func, assigned=available_attrs(view_func))
|
||||||
def _wrapped_view(request, *args, **kwargs):
|
def _wrapped_view(request, *args, **kwargs):
|
||||||
if not request.user.is_authenticated() and helpdesk_settings.HELPDESK_REDIRECT_TO_LOGIN_BY_DEFAULT:
|
if not request.user.is_authenticated and helpdesk_settings.HELPDESK_REDIRECT_TO_LOGIN_BY_DEFAULT:
|
||||||
return HttpResponseRedirect(reverse('helpdesk:login'))
|
return HttpResponseRedirect(reverse('helpdesk:login'))
|
||||||
elif not request.user.is_authenticated() and helpdesk_settings.HELPDESK_ANON_ACCESS_RAISES_404:
|
elif not request.user.is_authenticated and helpdesk_settings.HELPDESK_ANON_ACCESS_RAISES_404:
|
||||||
raise Http404
|
raise Http404
|
||||||
return view_func(request, *args, **kwargs)
|
return view_func(request, *args, **kwargs)
|
||||||
|
|
||||||
|
@ -374,7 +374,10 @@ def ticket_from_message(message, queue, logger):
|
|||||||
non_b64_err = TypeError
|
non_b64_err = TypeError
|
||||||
try:
|
try:
|
||||||
logger.debug("Try to base64 decode the attachment payload")
|
logger.debug("Try to base64 decode the attachment payload")
|
||||||
payloadToWrite = base64.decodestring(payload)
|
if six.PY2:
|
||||||
|
payloadToWrite = base64.decodestring(payload)
|
||||||
|
else:
|
||||||
|
payloadToWrite = base64.decodebytes(payload)
|
||||||
except non_b64_err:
|
except non_b64_err:
|
||||||
logger.debug("Payload was not base64 encoded, using raw bytes")
|
logger.debug("Payload was not base64 encoded, using raw bytes")
|
||||||
payloadToWrite = payload
|
payloadToWrite = payload
|
||||||
|
@ -140,7 +140,7 @@ class Migration(migrations.Migration):
|
|||||||
('votes', models.IntegerField(verbose_name='Votes', default=0, help_text='Total number of votes cast for this item')),
|
('votes', models.IntegerField(verbose_name='Votes', default=0, help_text='Total number of votes cast for this item')),
|
||||||
('recommendations', models.IntegerField(verbose_name='Positive Votes', default=0, help_text='Number of votes for this item which were POSITIVE.')),
|
('recommendations', models.IntegerField(verbose_name='Positive Votes', default=0, help_text='Number of votes for this item which were POSITIVE.')),
|
||||||
('last_updated', models.DateTimeField(verbose_name='Last Updated', blank=True, help_text='The date on which this question was most recently changed.')),
|
('last_updated', models.DateTimeField(verbose_name='Last Updated', blank=True, help_text='The date on which this question was most recently changed.')),
|
||||||
('category', models.ForeignKey(verbose_name='Category', to='helpdesk.KBCategory')),
|
('category', models.ForeignKey(verbose_name='Category', to='helpdesk.KBCategory', on_delete=models.CASCADE)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name_plural': 'Knowledge base items',
|
'verbose_name_plural': 'Knowledge base items',
|
||||||
@ -203,7 +203,7 @@ class Migration(migrations.Migration):
|
|||||||
('title', models.CharField(verbose_name='Query Name', help_text='User-provided name for this query', max_length=100)),
|
('title', models.CharField(verbose_name='Query Name', help_text='User-provided name for this query', max_length=100)),
|
||||||
('shared', models.BooleanField(verbose_name='Shared With Other Users?', default=False, help_text='Should other users see this query?')),
|
('shared', models.BooleanField(verbose_name='Shared With Other Users?', default=False, help_text='Should other users see this query?')),
|
||||||
('query', models.TextField(verbose_name='Search Query', help_text='Pickled query object. Be wary changing this.')),
|
('query', models.TextField(verbose_name='Search Query', help_text='Pickled query object. Be wary changing this.')),
|
||||||
('user', models.ForeignKey(verbose_name='User', to=settings.AUTH_USER_MODEL)),
|
('user', models.ForeignKey(verbose_name='User', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name_plural': 'Saved searches',
|
'verbose_name_plural': 'Saved searches',
|
||||||
@ -226,8 +226,8 @@ class Migration(migrations.Migration):
|
|||||||
('priority', models.IntegerField(verbose_name='Priority', help_text='1 = Highest Priority, 5 = Low Priority', blank=3, default=3, choices=[(1, '1. Critical'), (2, '2. High'), (3, '3. Normal'), (4, '4. Low'), (5, '5. Very Low')])),
|
('priority', models.IntegerField(verbose_name='Priority', help_text='1 = Highest Priority, 5 = Low Priority', blank=3, default=3, choices=[(1, '1. Critical'), (2, '2. High'), (3, '3. Normal'), (4, '4. Low'), (5, '5. Very Low')])),
|
||||||
('due_date', models.DateTimeField(null=True, verbose_name='Due on', blank=True)),
|
('due_date', models.DateTimeField(null=True, verbose_name='Due on', blank=True)),
|
||||||
('last_escalation', models.DateTimeField(editable=False, null=True, blank=True, help_text='The date this ticket was last escalated - updated automatically by management/commands/escalate_tickets.py.')),
|
('last_escalation', models.DateTimeField(editable=False, null=True, blank=True, help_text='The date this ticket was last escalated - updated automatically by management/commands/escalate_tickets.py.')),
|
||||||
('assigned_to', models.ForeignKey(null=True, verbose_name='Assigned to', blank=True, related_name='assigned_to', to=settings.AUTH_USER_MODEL)),
|
('assigned_to', models.ForeignKey(null=True, verbose_name='Assigned to', blank=True, related_name='assigned_to', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
|
||||||
('queue', models.ForeignKey(verbose_name='Queue', to='helpdesk.Queue')),
|
('queue', models.ForeignKey(verbose_name='Queue', to='helpdesk.Queue', on_delete=models.CASCADE)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name_plural': 'Tickets',
|
'verbose_name_plural': 'Tickets',
|
||||||
@ -244,8 +244,8 @@ class Migration(migrations.Migration):
|
|||||||
('email', models.EmailField(null=True, verbose_name='E-Mail Address', help_text='For non-user followers, enter their e-mail address', blank=True, max_length=75)),
|
('email', models.EmailField(null=True, verbose_name='E-Mail Address', help_text='For non-user followers, enter their e-mail address', blank=True, max_length=75)),
|
||||||
('can_view', models.BooleanField(verbose_name='Can View Ticket?', default=False, help_text='Can this CC login to view the ticket details?')),
|
('can_view', models.BooleanField(verbose_name='Can View Ticket?', default=False, help_text='Can this CC login to view the ticket details?')),
|
||||||
('can_update', models.BooleanField(verbose_name='Can Update Ticket?', default=False, help_text='Can this CC login and update the ticket?')),
|
('can_update', models.BooleanField(verbose_name='Can Update Ticket?', default=False, help_text='Can this CC login and update the ticket?')),
|
||||||
('ticket', models.ForeignKey(verbose_name='Ticket', to='helpdesk.Ticket')),
|
('ticket', models.ForeignKey(verbose_name='Ticket', to='helpdesk.Ticket', on_delete=models.CASCADE)),
|
||||||
('user', models.ForeignKey(null=True, verbose_name='User', blank=True, to=settings.AUTH_USER_MODEL, help_text='User who wishes to receive updates for this ticket.')),
|
('user', models.ForeignKey(null=True, verbose_name='User', blank=True, to=settings.AUTH_USER_MODEL, help_text='User who wishes to receive updates for this ticket.', on_delete=models.CASCADE)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
},
|
},
|
||||||
@ -258,7 +258,7 @@ class Migration(migrations.Migration):
|
|||||||
('field', models.CharField(verbose_name='Field', max_length=100)),
|
('field', models.CharField(verbose_name='Field', max_length=100)),
|
||||||
('old_value', models.TextField(null=True, verbose_name='Old Value', blank=True)),
|
('old_value', models.TextField(null=True, verbose_name='Old Value', blank=True)),
|
||||||
('new_value', models.TextField(null=True, verbose_name='New Value', blank=True)),
|
('new_value', models.TextField(null=True, verbose_name='New Value', blank=True)),
|
||||||
('followup', models.ForeignKey(verbose_name='Follow-up', to='helpdesk.FollowUp')),
|
('followup', models.ForeignKey(verbose_name='Follow-up', to='helpdesk.FollowUp', on_delete=models.CASCADE)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name_plural': 'Ticket changes',
|
'verbose_name_plural': 'Ticket changes',
|
||||||
@ -271,8 +271,8 @@ class Migration(migrations.Migration):
|
|||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)),
|
('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)),
|
||||||
('value', models.TextField(null=True, blank=True)),
|
('value', models.TextField(null=True, blank=True)),
|
||||||
('field', models.ForeignKey(verbose_name='Field', to='helpdesk.CustomField')),
|
('field', models.ForeignKey(verbose_name='Field', to='helpdesk.CustomField', on_delete=models.CASCADE)),
|
||||||
('ticket', models.ForeignKey(verbose_name='Ticket', to='helpdesk.Ticket')),
|
('ticket', models.ForeignKey(verbose_name='Ticket', to='helpdesk.Ticket', on_delete=models.CASCADE)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name_plural': 'Ticket custom field values',
|
'verbose_name_plural': 'Ticket custom field values',
|
||||||
@ -284,8 +284,8 @@ class Migration(migrations.Migration):
|
|||||||
name='TicketDependency',
|
name='TicketDependency',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)),
|
('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)),
|
||||||
('depends_on', models.ForeignKey(related_name='depends_on', verbose_name='Depends On Ticket', to='helpdesk.Ticket')),
|
('depends_on', models.ForeignKey(related_name='depends_on', verbose_name='Depends On Ticket', to='helpdesk.Ticket', on_delete=models.CASCADE)),
|
||||||
('ticket', models.ForeignKey(related_name='ticketdependency', verbose_name='Ticket', to='helpdesk.Ticket')),
|
('ticket', models.ForeignKey(related_name='ticketdependency', verbose_name='Ticket', to='helpdesk.Ticket', on_delete=models.CASCADE)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name_plural': 'Ticket dependencies',
|
'verbose_name_plural': 'Ticket dependencies',
|
||||||
@ -298,7 +298,7 @@ class Migration(migrations.Migration):
|
|||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)),
|
('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)),
|
||||||
('settings_pickled', models.TextField(null=True, verbose_name='Settings Dictionary', blank=True, help_text='This is a base64-encoded representation of a pickled Python dictionary. Do not change this field via the admin.')),
|
('settings_pickled', models.TextField(null=True, verbose_name='Settings Dictionary', blank=True, help_text='This is a base64-encoded representation of a pickled Python dictionary. Do not change this field via the admin.')),
|
||||||
('user', models.OneToOneField(to=settings.AUTH_USER_MODEL)),
|
('user', models.OneToOneField(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name_plural': 'User Settings',
|
'verbose_name_plural': 'User Settings',
|
||||||
@ -325,13 +325,13 @@ class Migration(migrations.Migration):
|
|||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='followup',
|
model_name='followup',
|
||||||
name='ticket',
|
name='ticket',
|
||||||
field=models.ForeignKey(verbose_name='Ticket', to='helpdesk.Ticket'),
|
field=models.ForeignKey(verbose_name='Ticket', to='helpdesk.Ticket', on_delete=models.CASCADE),
|
||||||
preserve_default=True,
|
preserve_default=True,
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='followup',
|
model_name='followup',
|
||||||
name='user',
|
name='user',
|
||||||
field=models.ForeignKey(null=True, verbose_name='User', blank=True, to=settings.AUTH_USER_MODEL),
|
field=models.ForeignKey(null=True, verbose_name='User', blank=True, to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
|
||||||
preserve_default=True,
|
preserve_default=True,
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
@ -343,7 +343,7 @@ class Migration(migrations.Migration):
|
|||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='attachment',
|
model_name='attachment',
|
||||||
name='followup',
|
name='followup',
|
||||||
field=models.ForeignKey(verbose_name='Follow-up', to='helpdesk.FollowUp'),
|
field=models.ForeignKey(verbose_name='Follow-up', to='helpdesk.FollowUp', on_delete=models.CASCADE),
|
||||||
preserve_default=True,
|
preserve_default=True,
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@ -18,7 +18,7 @@ class Migration(migrations.Migration):
|
|||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||||
('queues', models.ManyToManyField(to='helpdesk.Queue', verbose_name='Authorized Queues')),
|
('queues', models.ManyToManyField(to='helpdesk.Queue', verbose_name='Authorized Queues')),
|
||||||
('user', models.OneToOneField(verbose_name='User', to=settings.AUTH_USER_MODEL)),
|
('user', models.OneToOneField(verbose_name='User', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Queue Membership',
|
'verbose_name': 'Queue Membership',
|
||||||
|
@ -15,6 +15,8 @@ class Migration(migrations.Migration):
|
|||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='usersettings',
|
model_name='usersettings',
|
||||||
name='user',
|
name='user',
|
||||||
field=models.OneToOneField(to=settings.AUTH_USER_MODEL, related_name='usersettings_helpdesk'),
|
field=models.OneToOneField(to=settings.AUTH_USER_MODEL,
|
||||||
|
related_name='usersettings_helpdesk',
|
||||||
|
on_delete=models.CASCADE),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@ -255,11 +255,11 @@ class Queue(models.Model):
|
|||||||
|
|
||||||
default_owner = models.ForeignKey(
|
default_owner = models.ForeignKey(
|
||||||
settings.AUTH_USER_MODEL,
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.SET_NULL,
|
||||||
related_name='default_owner',
|
related_name='default_owner',
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
verbose_name=_('Default owner'),
|
verbose_name=_('Default owner'),
|
||||||
on_delete=models.SET_NULL,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
@ -387,6 +387,7 @@ class Ticket(models.Model):
|
|||||||
|
|
||||||
queue = models.ForeignKey(
|
queue = models.ForeignKey(
|
||||||
Queue,
|
Queue,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
verbose_name=_('Queue'),
|
verbose_name=_('Queue'),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -412,6 +413,7 @@ class Ticket(models.Model):
|
|||||||
|
|
||||||
assigned_to = models.ForeignKey(
|
assigned_to = models.ForeignKey(
|
||||||
settings.AUTH_USER_MODEL,
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
related_name='assigned_to',
|
related_name='assigned_to',
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
@ -628,6 +630,7 @@ class FollowUp(models.Model):
|
|||||||
|
|
||||||
ticket = models.ForeignKey(
|
ticket = models.ForeignKey(
|
||||||
Ticket,
|
Ticket,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
verbose_name=_('Ticket'),
|
verbose_name=_('Ticket'),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -659,6 +662,7 @@ class FollowUp(models.Model):
|
|||||||
|
|
||||||
user = models.ForeignKey(
|
user = models.ForeignKey(
|
||||||
settings.AUTH_USER_MODEL,
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
verbose_name=_('User'),
|
verbose_name=_('User'),
|
||||||
@ -701,6 +705,7 @@ class TicketChange(models.Model):
|
|||||||
|
|
||||||
followup = models.ForeignKey(
|
followup = models.ForeignKey(
|
||||||
FollowUp,
|
FollowUp,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
verbose_name=_('Follow-up'),
|
verbose_name=_('Follow-up'),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -763,6 +768,7 @@ class Attachment(models.Model):
|
|||||||
|
|
||||||
followup = models.ForeignKey(
|
followup = models.ForeignKey(
|
||||||
FollowUp,
|
FollowUp,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
verbose_name=_('Follow-up'),
|
verbose_name=_('Follow-up'),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -976,6 +982,7 @@ class KBItem(models.Model):
|
|||||||
"""
|
"""
|
||||||
category = models.ForeignKey(
|
category = models.ForeignKey(
|
||||||
KBCategory,
|
KBCategory,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
verbose_name=_('Category'),
|
verbose_name=_('Category'),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1049,6 +1056,7 @@ class SavedSearch(models.Model):
|
|||||||
"""
|
"""
|
||||||
user = models.ForeignKey(
|
user = models.ForeignKey(
|
||||||
settings.AUTH_USER_MODEL,
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
verbose_name=_('User'),
|
verbose_name=_('User'),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1093,6 +1101,7 @@ class UserSettings(models.Model):
|
|||||||
|
|
||||||
user = models.OneToOneField(
|
user = models.OneToOneField(
|
||||||
settings.AUTH_USER_MODEL,
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
related_name="usersettings_helpdesk")
|
related_name="usersettings_helpdesk")
|
||||||
|
|
||||||
settings_pickled = models.TextField(
|
settings_pickled = models.TextField(
|
||||||
@ -1251,11 +1260,13 @@ class TicketCC(models.Model):
|
|||||||
|
|
||||||
ticket = models.ForeignKey(
|
ticket = models.ForeignKey(
|
||||||
Ticket,
|
Ticket,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
verbose_name=_('Ticket'),
|
verbose_name=_('Ticket'),
|
||||||
)
|
)
|
||||||
|
|
||||||
user = models.ForeignKey(
|
user = models.ForeignKey(
|
||||||
settings.AUTH_USER_MODEL,
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
help_text=_('User who wishes to receive updates for this ticket.'),
|
help_text=_('User who wishes to receive updates for this ticket.'),
|
||||||
@ -1425,11 +1436,13 @@ class CustomField(models.Model):
|
|||||||
class TicketCustomFieldValue(models.Model):
|
class TicketCustomFieldValue(models.Model):
|
||||||
ticket = models.ForeignKey(
|
ticket = models.ForeignKey(
|
||||||
Ticket,
|
Ticket,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
verbose_name=_('Ticket'),
|
verbose_name=_('Ticket'),
|
||||||
)
|
)
|
||||||
|
|
||||||
field = models.ForeignKey(
|
field = models.ForeignKey(
|
||||||
CustomField,
|
CustomField,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
verbose_name=_('Field'),
|
verbose_name=_('Field'),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1458,12 +1471,14 @@ class TicketDependency(models.Model):
|
|||||||
|
|
||||||
ticket = models.ForeignKey(
|
ticket = models.ForeignKey(
|
||||||
Ticket,
|
Ticket,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
verbose_name=_('Ticket'),
|
verbose_name=_('Ticket'),
|
||||||
related_name='ticketdependency',
|
related_name='ticketdependency',
|
||||||
)
|
)
|
||||||
|
|
||||||
depends_on = models.ForeignKey(
|
depends_on = models.ForeignKey(
|
||||||
Ticket,
|
Ticket,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
verbose_name=_('Depends On Ticket'),
|
verbose_name=_('Depends On Ticket'),
|
||||||
related_name='depends_on',
|
related_name='depends_on',
|
||||||
)
|
)
|
||||||
|
@ -92,7 +92,7 @@ class GetEmailParametricTemplate(object):
|
|||||||
|
|
||||||
if self.socks:
|
if self.socks:
|
||||||
from socks import ProxyConnectionError
|
from socks import ProxyConnectionError
|
||||||
with self.assertRaisesRegexp(ProxyConnectionError, '%s:%s' % (unrouted_socks_server, unused_port)):
|
with self.assertRaisesRegex(ProxyConnectionError, '%s:%s' % (unrouted_socks_server, unused_port)):
|
||||||
call_command('get_email')
|
call_command('get_email')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@ -165,7 +165,7 @@ class GetEmailParametricTemplate(object):
|
|||||||
|
|
||||||
if self.socks:
|
if self.socks:
|
||||||
from socks import ProxyConnectionError
|
from socks import ProxyConnectionError
|
||||||
with self.assertRaisesRegexp(ProxyConnectionError, '%s:%s' % (unrouted_socks_server, unused_port)):
|
with self.assertRaisesRegex(ProxyConnectionError, '%s:%s' % (unrouted_socks_server, unused_port)):
|
||||||
call_command('get_email')
|
call_command('get_email')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@ -278,7 +278,7 @@ class GetEmailParametricTemplate(object):
|
|||||||
|
|
||||||
if self.socks:
|
if self.socks:
|
||||||
from socks import ProxyConnectionError
|
from socks import ProxyConnectionError
|
||||||
with self.assertRaisesRegexp(ProxyConnectionError, '%s:%s' % (unrouted_socks_server, unused_port)):
|
with self.assertRaisesRegex(ProxyConnectionError, '%s:%s' % (unrouted_socks_server, unused_port)):
|
||||||
call_command('get_email')
|
call_command('get_email')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@ -525,7 +525,7 @@ a9eiiQ+3V1v+7wWHXCzq
|
|||||||
|
|
||||||
if self.socks:
|
if self.socks:
|
||||||
from socks import ProxyConnectionError
|
from socks import ProxyConnectionError
|
||||||
with self.assertRaisesRegexp(ProxyConnectionError, '%s:%s' % (unrouted_socks_server, unused_port)):
|
with self.assertRaisesRegex(ProxyConnectionError, '%s:%s' % (unrouted_socks_server, unused_port)):
|
||||||
call_command('get_email')
|
call_command('get_email')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -23,7 +23,7 @@ from helpdesk.models import Ticket, Queue, UserSettings, KBCategory
|
|||||||
@protect_view
|
@protect_view
|
||||||
def homepage(request):
|
def homepage(request):
|
||||||
if request.user.is_staff or \
|
if request.user.is_staff or \
|
||||||
(request.user.is_authenticated() and
|
(request.user.is_authenticated and
|
||||||
helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE):
|
helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE):
|
||||||
try:
|
try:
|
||||||
if request.user.usersettings_helpdesk.settings.get('login_view_ticketlist', False):
|
if request.user.usersettings_helpdesk.settings.get('login_view_ticketlist', False):
|
||||||
@ -61,7 +61,7 @@ def homepage(request):
|
|||||||
if queue:
|
if queue:
|
||||||
initial_data['queue'] = queue.id
|
initial_data['queue'] = queue.id
|
||||||
|
|
||||||
if request.user.is_authenticated() and request.user.email:
|
if request.user.is_authenticated and request.user.email:
|
||||||
initial_data['submitter_email'] = request.user.email
|
initial_data['submitter_email'] = request.user.email
|
||||||
|
|
||||||
form = PublicTicketForm(initial=initial_data)
|
form = PublicTicketForm(initial=initial_data)
|
||||||
|
@ -46,14 +46,14 @@ User = get_user_model()
|
|||||||
if helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE:
|
if helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE:
|
||||||
# treat 'normal' users like 'staff'
|
# treat 'normal' users like 'staff'
|
||||||
staff_member_required = user_passes_test(
|
staff_member_required = user_passes_test(
|
||||||
lambda u: u.is_authenticated() and u.is_active)
|
lambda u: u.is_authenticated and u.is_active)
|
||||||
else:
|
else:
|
||||||
staff_member_required = user_passes_test(
|
staff_member_required = user_passes_test(
|
||||||
lambda u: u.is_authenticated() and u.is_active and u.is_staff)
|
lambda u: u.is_authenticated and u.is_active and u.is_staff)
|
||||||
|
|
||||||
|
|
||||||
superuser_required = user_passes_test(
|
superuser_required = user_passes_test(
|
||||||
lambda u: u.is_authenticated() and u.is_active and u.is_superuser)
|
lambda u: u.is_authenticated and u.is_active and u.is_superuser)
|
||||||
|
|
||||||
|
|
||||||
def _get_user_queues(user):
|
def _get_user_queues(user):
|
||||||
@ -387,7 +387,7 @@ def subscribe_staff_member_to_ticket(ticket, user):
|
|||||||
|
|
||||||
def update_ticket(request, ticket_id, public=False):
|
def update_ticket(request, ticket_id, public=False):
|
||||||
if not (public or (
|
if not (public or (
|
||||||
request.user.is_authenticated() and
|
request.user.is_authenticated and
|
||||||
request.user.is_active and (
|
request.user.is_active and (
|
||||||
request.user.is_staff or
|
request.user.is_staff or
|
||||||
helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE))):
|
helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE))):
|
||||||
@ -644,7 +644,7 @@ def update_ticket(request, ticket_id, public=False):
|
|||||||
ticket.save()
|
ticket.save()
|
||||||
|
|
||||||
# auto subscribe user if enabled
|
# auto subscribe user if enabled
|
||||||
if helpdesk_settings.HELPDESK_AUTO_SUBSCRIBE_ON_TICKET_RESPONSE and request.user.is_authenticated():
|
if helpdesk_settings.HELPDESK_AUTO_SUBSCRIBE_ON_TICKET_RESPONSE and request.user.is_authenticated:
|
||||||
ticketcc_string, SHOW_SUBSCRIBE = return_ticketccstring_and_show_subscribe(request.user, ticket)
|
ticketcc_string, SHOW_SUBSCRIBE = return_ticketccstring_and_show_subscribe(request.user, ticket)
|
||||||
if SHOW_SUBSCRIBE:
|
if SHOW_SUBSCRIBE:
|
||||||
subscribe_staff_member_to_ticket(ticket, request.user)
|
subscribe_staff_member_to_ticket(ticket, request.user)
|
||||||
|
@ -29,7 +29,8 @@ class QuickDjangoTest(object):
|
|||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'bootstrapform',
|
'bootstrapform',
|
||||||
)
|
)
|
||||||
MIDDLEWARE_CLASSES = [
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
'django.middleware.csrf.CsrfViewMiddleware',
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
@ -78,7 +79,7 @@ class QuickDjangoTest(object):
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
INSTALLED_APPS=self.INSTALLED_APPS + self.apps,
|
INSTALLED_APPS=self.INSTALLED_APPS + self.apps,
|
||||||
MIDDLEWARE_CLASSES=self.MIDDLEWARE_CLASSES,
|
MIDDLEWARE=self.MIDDLEWARE,
|
||||||
ROOT_URLCONF='helpdesk.tests.urls',
|
ROOT_URLCONF='helpdesk.tests.urls',
|
||||||
STATIC_URL='/static/',
|
STATIC_URL='/static/',
|
||||||
TEMPLATES=self.TEMPLATES
|
TEMPLATES=self.TEMPLATES
|
||||||
|
Loading…
Reference in New Issue
Block a user