forked from extern/django-helpdesk
Remove old python2/six code
This commit is contained in:
parent
41d71e9062
commit
696d10db12
@ -11,6 +11,17 @@ scripts/get_email.py - Designed to be run from cron, this script checks the
|
|||||||
helpdesk, creating tickets from the new messages (or
|
helpdesk, creating tickets from the new messages (or
|
||||||
adding to existing tickets if needed)
|
adding to existing tickets if needed)
|
||||||
"""
|
"""
|
||||||
|
from django.core.files.base import ContentFile
|
||||||
|
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||||
|
from django.core.management.base import BaseCommand
|
||||||
|
from django.db.models import Q
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
from django.utils import encoding, timezone
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
|
from helpdesk import settings
|
||||||
|
from helpdesk.lib import safe_template_context, process_attachments
|
||||||
|
from helpdesk.models import Queue, Ticket, TicketCC, FollowUp, IgnoreEmail
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import base64
|
import base64
|
||||||
@ -31,18 +42,6 @@ from bs4 import BeautifulSoup
|
|||||||
|
|
||||||
from email_reply_parser import EmailReplyParser
|
from email_reply_parser import EmailReplyParser
|
||||||
|
|
||||||
from django.core.files.base import ContentFile
|
|
||||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
|
||||||
from django.core.management.base import BaseCommand
|
|
||||||
from django.db.models import Q
|
|
||||||
from django.utils.translation import ugettext as _
|
|
||||||
from django.utils import encoding, timezone
|
|
||||||
|
|
||||||
from helpdesk import settings
|
|
||||||
from helpdesk.lib import safe_template_context, process_attachments
|
|
||||||
from helpdesk.models import Queue, Ticket, TicketCC, FollowUp, IgnoreEmail
|
|
||||||
from django.contrib.auth.models import User
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ forms.py - Definitions of newforms-based forms for creating and maintaining
|
|||||||
|
|
||||||
|
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.utils.six import StringIO
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.forms import widgets
|
from django.forms import widgets
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
@ -8,17 +8,15 @@ scripts/create_escalation_exclusion.py - Easy way to routinely add particular
|
|||||||
days to the list of days on which no
|
days to the list of days on which no
|
||||||
escalation should take place.
|
escalation should take place.
|
||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
|
|
||||||
|
from helpdesk.models import EscalationExclusion, Queue
|
||||||
|
|
||||||
from datetime import timedelta, date
|
from datetime import timedelta, date
|
||||||
import getopt
|
import getopt
|
||||||
from optparse import make_option
|
from optparse import make_option
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
|
||||||
|
|
||||||
from helpdesk.models import EscalationExclusion, Queue
|
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ django-helpdesk - A Django powered ticket tracker for small enterprise.
|
|||||||
scripts/escalate_tickets.py - Easy way to escalate tickets based on their age,
|
scripts/escalate_tickets.py - Easy way to escalate tickets based on their age,
|
||||||
designed to be run from Cron or similar.
|
designed to be run from Cron or similar.
|
||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
from datetime import timedelta, date
|
from datetime import timedelta, date
|
||||||
import getopt
|
import getopt
|
||||||
@ -17,11 +16,7 @@ import sys
|
|||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
from django.utils import timezone
|
||||||
try:
|
|
||||||
from django.utils import timezone
|
|
||||||
except ImportError:
|
|
||||||
from datetime import datetime as timezone
|
|
||||||
|
|
||||||
from helpdesk.models import Queue, Ticket, FollowUp, EscalationExclusion, TicketChange
|
from helpdesk.models import Queue, Ticket, FollowUp, EscalationExclusion, TicketChange
|
||||||
from helpdesk.lib import safe_template_context
|
from helpdesk.lib import safe_template_context
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import models, migrations
|
from django.db import models, migrations
|
||||||
import django.utils.timezone
|
import django.utils.timezone
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
import helpdesk.models
|
import helpdesk.models
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.db import models, migrations
|
from django.db import models, migrations
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from sys import path
|
from sys import path
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import models, migrations
|
from django.db import models, migrations
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import models, migrations
|
from django.db import models, migrations
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import models, migrations
|
from django.db import models, migrations
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import models, migrations
|
from django.db import models, migrations
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import models, migrations
|
from django.db import models, migrations
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
from django.db.utils import IntegrityError
|
from django.db.utils import IntegrityError
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import models, migrations
|
from django.db import models, migrations
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import models, migrations
|
from django.db import models, migrations
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Generated by Django 1.9.2 on 2016-02-15 21:37
|
# Generated by Django 1.9.2 on 2016-02-15 21:37
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Generated by Django 1.10.1 on 2016-09-14 23:47
|
# Generated by Django 1.10.1 on 2016-09-14 23:47
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Generated by Django 1.10.5 on 2017-02-10 19:27
|
# Generated by Django 1.10.5 on 2017-02-10 19:27
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Generated by Django 1.10.2 on 2017-03-08 17:51
|
# Generated by Django 1.10.2 on 2017-03-08 17:51
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Generated by Django 1.11.2 on 2018-01-19 09:48
|
# Generated by Django 1.11.2 on 2018-01-19 09:48
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
# Generated by Django 2.0.1 on 2018-09-07 21:22
|
# Generated by Django 2.0.1 on 2018-09-07 21:22
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import helpdesk.models
|
import helpdesk.models
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
# Generated by Django 2.0.1 on 2018-09-07 21:22
|
# Generated by Django 2.0.1 on 2018-09-07 21:22
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import helpdesk.models
|
import helpdesk.models
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# Generated by Django 2.0.7 on 2018-10-19 14:11
|
# Generated by Django 2.0.7 on 2018-10-19 14:11
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import helpdesk.models
|
import helpdesk.models
|
||||||
|
|
||||||
|
|
||||||
def unpickle_settings(settings_pickled):
|
def unpickle_settings(settings_pickled):
|
||||||
# return a python dictionary representing the pickled data.
|
# return a python dictionary representing the pickled data.
|
||||||
try:
|
try:
|
||||||
@ -11,13 +11,11 @@ def unpickle_settings(settings_pickled):
|
|||||||
import cPickle as pickle
|
import cPickle as pickle
|
||||||
from helpdesk.lib import b64decode
|
from helpdesk.lib import b64decode
|
||||||
try:
|
try:
|
||||||
if six.PY2:
|
|
||||||
return pickle.loads(b64decode(str(settings_pickled)))
|
|
||||||
else:
|
|
||||||
return pickle.loads(b64decode(settings_pickled.encode('utf-8')))
|
return pickle.loads(b64decode(settings_pickled.encode('utf-8')))
|
||||||
except Exception:
|
except Exception:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
||||||
def move_old_values(apps, schema_editor):
|
def move_old_values(apps, schema_editor):
|
||||||
UserSettings = apps.get_model("helpdesk", "UserSettings")
|
UserSettings = apps.get_model("helpdesk", "UserSettings")
|
||||||
db_alias = schema_editor.connection.alias
|
db_alias = schema_editor.connection.alias
|
||||||
@ -28,6 +26,7 @@ def move_old_values(apps, schema_editor):
|
|||||||
for setting, value in settings_dict.items():
|
for setting, value in settings_dict.items():
|
||||||
user_settings.__set_attr__(setting, value)
|
user_settings.__set_attr__(setting, value)
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
# Generated by Django 2.1.2 on 2018-10-17 17:37
|
# Generated by Django 2.1.2 on 2018-10-17 17:37
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ models.py - Model (and hence database) definitions. This is the core of the
|
|||||||
helpdesk structure.
|
helpdesk structure.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
from django.contrib.auth.models import Permission
|
from django.contrib.auth.models import Permission
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
@ -15,18 +14,15 @@ from django.core.exceptions import ObjectDoesNotExist
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils import six
|
|
||||||
from django.utils.translation import ugettext_lazy as _, ugettext
|
from django.utils.translation import ugettext_lazy as _, ugettext
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from io import StringIO
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import six
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from .templated_email import send_templated_mail
|
from .templated_email import send_templated_mail
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class Queue(models.Model):
|
class Queue(models.Model):
|
||||||
"""
|
"""
|
||||||
A queue is a collection of tickets into what would generally be business
|
A queue is a collection of tickets into what would generally be business
|
||||||
@ -358,7 +354,6 @@ def mk_secret():
|
|||||||
return str(uuid.uuid4())
|
return str(uuid.uuid4())
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class Ticket(models.Model):
|
class Ticket(models.Model):
|
||||||
"""
|
"""
|
||||||
To allow a ticket to be entered as quickly as possible, only the
|
To allow a ticket to be entered as quickly as possible, only the
|
||||||
@ -694,7 +689,6 @@ class FollowUpManager(models.Manager):
|
|||||||
return self.filter(public=True)
|
return self.filter(public=True)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class FollowUp(models.Model):
|
class FollowUp(models.Model):
|
||||||
"""
|
"""
|
||||||
A FollowUp is a comment and/or change to a ticket. We keep a simple
|
A FollowUp is a comment and/or change to a ticket. We keep a simple
|
||||||
@ -776,7 +770,6 @@ class FollowUp(models.Model):
|
|||||||
super(FollowUp, self).save(*args, **kwargs)
|
super(FollowUp, self).save(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class TicketChange(models.Model):
|
class TicketChange(models.Model):
|
||||||
"""
|
"""
|
||||||
For each FollowUp, any changes to the parent ticket (eg Title, Priority,
|
For each FollowUp, any changes to the parent ticket (eg Title, Priority,
|
||||||
@ -839,7 +832,6 @@ def attachment_path(instance, filename):
|
|||||||
return os.path.join(path, filename)
|
return os.path.join(path, filename)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class Attachment(models.Model):
|
class Attachment(models.Model):
|
||||||
"""
|
"""
|
||||||
Represents a file attached to a follow-up. This could come from an e-mail
|
Represents a file attached to a follow-up. This could come from an e-mail
|
||||||
@ -882,7 +874,6 @@ class Attachment(models.Model):
|
|||||||
verbose_name_plural = _('Attachments')
|
verbose_name_plural = _('Attachments')
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class PreSetReply(models.Model):
|
class PreSetReply(models.Model):
|
||||||
"""
|
"""
|
||||||
We can allow the admin to define a number of pre-set replies, used to
|
We can allow the admin to define a number of pre-set replies, used to
|
||||||
@ -924,7 +915,6 @@ class PreSetReply(models.Model):
|
|||||||
return '%s' % self.name
|
return '%s' % self.name
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class EscalationExclusion(models.Model):
|
class EscalationExclusion(models.Model):
|
||||||
"""
|
"""
|
||||||
An 'EscalationExclusion' lets us define a date on which escalation should
|
An 'EscalationExclusion' lets us define a date on which escalation should
|
||||||
@ -961,7 +951,6 @@ class EscalationExclusion(models.Model):
|
|||||||
verbose_name_plural = _('Escalation exclusions')
|
verbose_name_plural = _('Escalation exclusions')
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class EmailTemplate(models.Model):
|
class EmailTemplate(models.Model):
|
||||||
"""
|
"""
|
||||||
Since these are more likely to be changed than other templates, we store
|
Since these are more likely to be changed than other templates, we store
|
||||||
@ -1021,7 +1010,6 @@ class EmailTemplate(models.Model):
|
|||||||
verbose_name_plural = _('e-mail templates')
|
verbose_name_plural = _('e-mail templates')
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class KBCategory(models.Model):
|
class KBCategory(models.Model):
|
||||||
"""
|
"""
|
||||||
Lets help users help themselves: the Knowledge Base is a categorised
|
Lets help users help themselves: the Knowledge Base is a categorised
|
||||||
@ -1054,7 +1042,6 @@ class KBCategory(models.Model):
|
|||||||
return reverse('helpdesk:kb_category', kwargs={'slug': self.slug})
|
return reverse('helpdesk:kb_category', kwargs={'slug': self.slug})
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class KBItem(models.Model):
|
class KBItem(models.Model):
|
||||||
"""
|
"""
|
||||||
An item within the knowledgebase. Very straightforward question/answer
|
An item within the knowledgebase. Very straightforward question/answer
|
||||||
@ -1123,7 +1110,6 @@ class KBItem(models.Model):
|
|||||||
return reverse('helpdesk:kb_item', args=(self.id,))
|
return reverse('helpdesk:kb_item', args=(self.id,))
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class SavedSearch(models.Model):
|
class SavedSearch(models.Model):
|
||||||
"""
|
"""
|
||||||
Allow a user to save a ticket search, eg their filtering and sorting
|
Allow a user to save a ticket search, eg their filtering and sorting
|
||||||
@ -1195,7 +1181,6 @@ def use_email_as_submitter_default():
|
|||||||
return get_default_setting('use_email_as_submitter')
|
return get_default_setting('use_email_as_submitter')
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class UserSettings(models.Model):
|
class UserSettings(models.Model):
|
||||||
"""
|
"""
|
||||||
A bunch of user-specific settings that we want to be able to define, such
|
A bunch of user-specific settings that we want to be able to define, such
|
||||||
@ -1275,7 +1260,6 @@ def create_usersettings(sender, instance, created, **kwargs):
|
|||||||
models.signals.post_save.connect(create_usersettings, sender=settings.AUTH_USER_MODEL)
|
models.signals.post_save.connect(create_usersettings, sender=settings.AUTH_USER_MODEL)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class IgnoreEmail(models.Model):
|
class IgnoreEmail(models.Model):
|
||||||
"""
|
"""
|
||||||
This model lets us easily ignore e-mails from certain senders when
|
This model lets us easily ignore e-mails from certain senders when
|
||||||
@ -1362,7 +1346,6 @@ class IgnoreEmail(models.Model):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class TicketCC(models.Model):
|
class TicketCC(models.Model):
|
||||||
"""
|
"""
|
||||||
Often, there are people who wish to follow a ticket who aren't the
|
Often, there are people who wish to follow a ticket who aren't the
|
||||||
@ -1433,7 +1416,6 @@ class CustomFieldManager(models.Manager):
|
|||||||
return super(CustomFieldManager, self).get_queryset().order_by('ordering')
|
return super(CustomFieldManager, self).get_queryset().order_by('ordering')
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class CustomField(models.Model):
|
class CustomField(models.Model):
|
||||||
"""
|
"""
|
||||||
Definitions for custom fields that are glued onto each ticket.
|
Definitions for custom fields that are glued onto each ticket.
|
||||||
@ -1517,7 +1499,6 @@ class CustomField(models.Model):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def _choices_as_array(self):
|
def _choices_as_array(self):
|
||||||
from django.utils.six import StringIO
|
|
||||||
valuebuffer = StringIO(self.list_values)
|
valuebuffer = StringIO(self.list_values)
|
||||||
choices = [[item.strip(), item.strip()] for item in valuebuffer.readlines()]
|
choices = [[item.strip(), item.strip()] for item in valuebuffer.readlines()]
|
||||||
valuebuffer.close()
|
valuebuffer.close()
|
||||||
@ -1547,7 +1528,6 @@ class CustomField(models.Model):
|
|||||||
verbose_name_plural = _('Custom fields')
|
verbose_name_plural = _('Custom fields')
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class TicketCustomFieldValue(models.Model):
|
class TicketCustomFieldValue(models.Model):
|
||||||
ticket = models.ForeignKey(
|
ticket = models.ForeignKey(
|
||||||
Ticket,
|
Ticket,
|
||||||
@ -1572,7 +1552,6 @@ class TicketCustomFieldValue(models.Model):
|
|||||||
verbose_name_plural = _('Ticket custom field values')
|
verbose_name_plural = _('Ticket custom field values')
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class TicketDependency(models.Model):
|
class TicketDependency(models.Model):
|
||||||
"""
|
"""
|
||||||
The ticket identified by `ticket` cannot be resolved until the ticket in `depends_on` has been resolved.
|
The ticket identified by `ticket` cannot be resolved until the ticket in `depends_on` has been resolved.
|
||||||
|
@ -4,7 +4,6 @@ django-helpdesk - A Django powered ticket tracker for small enterprise.
|
|||||||
templatetags/load_helpdesk_settings.py - returns the settings as defined in
|
templatetags/load_helpdesk_settings.py - returns the settings as defined in
|
||||||
django-helpdesk/helpdesk/settings.py
|
django-helpdesk/helpdesk/settings.py
|
||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
|
||||||
from django.template import Library
|
from django.template import Library
|
||||||
from helpdesk import settings as helpdesk_settings_config
|
from helpdesk import settings as helpdesk_settings_config
|
||||||
|
|
||||||
|
@ -5,9 +5,9 @@ templatetags/saved_queries.py - This template tag returns previously saved
|
|||||||
queries. Therefore you don't need to modify
|
queries. Therefore you don't need to modify
|
||||||
any views.
|
any views.
|
||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
|
||||||
from django.template import Library
|
from django.template import Library
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
from helpdesk.models import SavedSearch
|
from helpdesk.models import SavedSearch
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,15 +10,14 @@ templatetags/ticket_to_link.py - Used in ticket comments to allow wiki-style
|
|||||||
to show the status of that ticket (eg a closed
|
to show the status of that ticket (eg a closed
|
||||||
ticket would have a strikethrough).
|
ticket would have a strikethrough).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
from django import template
|
from django import template
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
|
|
||||||
from helpdesk.models import Ticket
|
from helpdesk.models import Ticket
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
def num_to_link(text):
|
def num_to_link(text):
|
||||||
if text == '':
|
if text == '':
|
||||||
|
@ -22,10 +22,6 @@ def get_staff_user(username='helpdesk.staff', password='password'):
|
|||||||
|
|
||||||
def reload_urlconf(urlconf=None):
|
def reload_urlconf(urlconf=None):
|
||||||
|
|
||||||
from django.utils import six
|
|
||||||
if six.PY2:
|
|
||||||
from imp import reload
|
|
||||||
else:
|
|
||||||
from importlib import reload
|
from importlib import reload
|
||||||
|
|
||||||
if urlconf is None:
|
if urlconf is None:
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
# vim: set fileencoding=utf-8 :
|
# vim: set fileencoding=utf-8 :
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import os
|
|
||||||
import shutil
|
|
||||||
from tempfile import gettempdir
|
|
||||||
|
|
||||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.test import override_settings, TestCase
|
from django.test import override_settings, TestCase
|
||||||
@ -12,12 +6,12 @@ from django.utils.encoding import smart_text
|
|||||||
|
|
||||||
from helpdesk import lib, models
|
from helpdesk import lib, models
|
||||||
|
|
||||||
try:
|
import os
|
||||||
# Python >= 3.3
|
import shutil
|
||||||
from unittest import mock
|
from tempfile import gettempdir
|
||||||
except ImportError:
|
|
||||||
# Python < 3.3
|
from unittest import mock
|
||||||
import mock
|
|
||||||
|
|
||||||
MEDIA_DIR = os.path.join(gettempdir(), 'helpdesk_test_media')
|
MEDIA_DIR = os.path.join(gettempdir(), 'helpdesk_test_media')
|
||||||
|
|
||||||
|
@ -1,30 +1,21 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from helpdesk.models import Queue, Ticket, TicketCC, FollowUp, Attachment
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.core.management import call_command
|
from django.core.management import call_command
|
||||||
from django.utils import six
|
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.contrib.auth.hashers import make_password
|
from django.contrib.auth.hashers import make_password
|
||||||
|
|
||||||
|
from helpdesk.models import Queue, Ticket, TicketCC, FollowUp, Attachment
|
||||||
|
|
||||||
import itertools
|
import itertools
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
import sys
|
import sys
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp
|
||||||
|
|
||||||
try: # python 3
|
|
||||||
from urllib.parse import urlparse
|
|
||||||
except ImportError: # python 2
|
|
||||||
from urlparse import urlparse
|
|
||||||
|
|
||||||
try:
|
from urllib.parse import urlparse
|
||||||
# Python >= 3.3
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
except ImportError:
|
|
||||||
# Python < 3.3
|
|
||||||
import mock
|
|
||||||
|
|
||||||
# class A addresses can't have first octet of 0
|
# class A addresses can't have first octet of 0
|
||||||
unrouted_socks_server = "0.0.0.1"
|
unrouted_socks_server = "0.0.0.1"
|
||||||
@ -100,7 +91,7 @@ class GetEmailParametricTemplate(object):
|
|||||||
if self.method == 'local':
|
if self.method == 'local':
|
||||||
with mock.patch('helpdesk.email.listdir') as mocked_listdir, \
|
with mock.patch('helpdesk.email.listdir') as mocked_listdir, \
|
||||||
mock.patch('helpdesk.email.isfile') as mocked_isfile, \
|
mock.patch('helpdesk.email.isfile') as mocked_isfile, \
|
||||||
mock.patch('builtins.open' if six.PY3 else '__builtin__.open', mock.mock_open(read_data=test_email)):
|
mock.patch('builtins.open', mock.mock_open(read_data=test_email)):
|
||||||
mocked_isfile.return_value = True
|
mocked_isfile.return_value = True
|
||||||
mocked_listdir.return_value = ['filename1', 'filename2']
|
mocked_listdir.return_value = ['filename1', 'filename2']
|
||||||
|
|
||||||
@ -173,7 +164,7 @@ class GetEmailParametricTemplate(object):
|
|||||||
if self.method == 'local':
|
if self.method == 'local':
|
||||||
with mock.patch('helpdesk.email.listdir') as mocked_listdir, \
|
with mock.patch('helpdesk.email.listdir') as mocked_listdir, \
|
||||||
mock.patch('helpdesk.email.isfile') as mocked_isfile, \
|
mock.patch('helpdesk.email.isfile') as mocked_isfile, \
|
||||||
mock.patch('builtins.open' if six.PY3 else '__builtin__.open', mock.mock_open(read_data=test_email)):
|
mock.patch('builtins.open', mock.mock_open(read_data=test_email)):
|
||||||
mocked_isfile.return_value = True
|
mocked_isfile.return_value = True
|
||||||
mocked_listdir.return_value = ['filename1', 'filename2']
|
mocked_listdir.return_value = ['filename1', 'filename2']
|
||||||
|
|
||||||
@ -286,7 +277,7 @@ class GetEmailParametricTemplate(object):
|
|||||||
if self.method == 'local':
|
if self.method == 'local':
|
||||||
with mock.patch('helpdesk.email.listdir') as mocked_listdir, \
|
with mock.patch('helpdesk.email.listdir') as mocked_listdir, \
|
||||||
mock.patch('helpdesk.email.isfile') as mocked_isfile, \
|
mock.patch('helpdesk.email.isfile') as mocked_isfile, \
|
||||||
mock.patch('builtins.open' if six.PY3 else '__builtin__.open', mock.mock_open(read_data=msg.as_string())):
|
mock.patch('builtins.open', mock.mock_open(read_data=msg.as_string())):
|
||||||
mocked_isfile.return_value = True
|
mocked_isfile.return_value = True
|
||||||
mocked_listdir.return_value = ['filename1', 'filename2']
|
mocked_listdir.return_value = ['filename1', 'filename2']
|
||||||
|
|
||||||
@ -533,7 +524,7 @@ a9eiiQ+3V1v+7wWHXCzq
|
|||||||
if self.method == 'local':
|
if self.method == 'local':
|
||||||
with mock.patch('helpdesk.email.listdir') as mocked_listdir, \
|
with mock.patch('helpdesk.email.listdir') as mocked_listdir, \
|
||||||
mock.patch('helpdesk.email.isfile') as mocked_isfile, \
|
mock.patch('helpdesk.email.isfile') as mocked_isfile, \
|
||||||
mock.patch('builtins.open' if six.PY3 else '__builtin__.open', mock.mock_open(read_data=test_email)):
|
mock.patch('builtins.open', mock.mock_open(read_data=test_email)):
|
||||||
mocked_isfile.return_value = True
|
mocked_isfile.return_value = True
|
||||||
mocked_listdir.return_value = ['filename1']
|
mocked_listdir.return_value = ['filename1']
|
||||||
|
|
||||||
@ -703,7 +694,7 @@ class GetEmailCCHandling(TestCase):
|
|||||||
|
|
||||||
with mock.patch('helpdesk.email.listdir') as mocked_listdir, \
|
with mock.patch('helpdesk.email.listdir') as mocked_listdir, \
|
||||||
mock.patch('helpdesk.email.isfile') as mocked_isfile, \
|
mock.patch('helpdesk.email.isfile') as mocked_isfile, \
|
||||||
mock.patch('builtins.open' if six.PY3 else '__builtin__.open', mock.mock_open(read_data=test_email)):
|
mock.patch('builtins.open', mock.mock_open(read_data=test_email)):
|
||||||
|
|
||||||
mocked_isfile.return_value = True
|
mocked_isfile.return_value = True
|
||||||
mocked_listdir.return_value = ['filename1']
|
mocked_listdir.return_value = ['filename1']
|
||||||
|
@ -6,10 +6,6 @@ django-helpdesk - A Django powered ticket tracker for small enterprise.
|
|||||||
views/staff.py - The bulk of the application - provides most business logic and
|
views/staff.py - The bulk of the application - provides most business logic and
|
||||||
renders all staff-facing views.
|
renders all staff-facing views.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
from datetime import date, datetime, timedelta
|
|
||||||
import re
|
|
||||||
|
|
||||||
from django import VERSION as DJANGO_VERSION
|
from django import VERSION as DJANGO_VERSION
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
@ -27,14 +23,9 @@ from django.utils.html import escape
|
|||||||
from django import forms
|
from django import forms
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.views.generic.edit import FormView, UpdateView
|
from django.views.generic.edit import FormView, UpdateView
|
||||||
|
|
||||||
from django.utils import six
|
|
||||||
|
|
||||||
# For datatables serverside
|
# For datatables serverside
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from rest_framework import viewsets, status
|
|
||||||
from rest_framework.response import Response
|
|
||||||
from rest_framework.decorators import api_view
|
|
||||||
from helpdesk.lib import query_tickets_by_args
|
from helpdesk.lib import query_tickets_by_args
|
||||||
from helpdesk.serializers import TicketSerializer
|
from helpdesk.serializers import TicketSerializer
|
||||||
|
|
||||||
@ -57,6 +48,14 @@ from helpdesk.models import (
|
|||||||
from helpdesk import settings as helpdesk_settings
|
from helpdesk import settings as helpdesk_settings
|
||||||
from helpdesk.views.permissions import MustBeStaffMixin
|
from helpdesk.views.permissions import MustBeStaffMixin
|
||||||
|
|
||||||
|
from rest_framework import viewsets, status
|
||||||
|
from rest_framework.response import Response
|
||||||
|
from rest_framework.decorators import api_view
|
||||||
|
|
||||||
|
from datetime import date, datetime, timedelta
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
User = get_user_model()
|
User = get_user_model()
|
||||||
|
|
||||||
if helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE:
|
if helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE:
|
||||||
|
2
setup.py
2
setup.py
@ -6,7 +6,7 @@ from distutils.util import convert_path
|
|||||||
from fnmatch import fnmatchcase
|
from fnmatch import fnmatchcase
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
version = '0.3.0.dev1'
|
version = '0.3.0.dev2'
|
||||||
|
|
||||||
# Provided as an attribute, so you can append to these instead
|
# Provided as an attribute, so you can append to these instead
|
||||||
# of replicating them:
|
# of replicating them:
|
||||||
|
Loading…
Reference in New Issue
Block a user