mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2025-02-03 20:09:18 +01:00
Fix PEP8 errors
This commit is contained in:
parent
cad174468b
commit
d791700582
@ -133,7 +133,7 @@ class EditFollowUpForm(forms.ModelForm):
|
|||||||
|
|
||||||
class TicketForm(CustomFieldMixin, forms.Form):
|
class TicketForm(CustomFieldMixin, forms.Form):
|
||||||
queue = forms.ChoiceField(
|
queue = forms.ChoiceField(
|
||||||
widget=forms.Select(attrs={'class':'form-control'}),
|
widget=forms.Select(attrs={'class': 'form-control'}),
|
||||||
label=_('Queue'),
|
label=_('Queue'),
|
||||||
required=True,
|
required=True,
|
||||||
choices=()
|
choices=()
|
||||||
@ -142,26 +142,26 @@ class TicketForm(CustomFieldMixin, forms.Form):
|
|||||||
title = forms.CharField(
|
title = forms.CharField(
|
||||||
max_length=100,
|
max_length=100,
|
||||||
required=True,
|
required=True,
|
||||||
widget=forms.TextInput(attrs={'class':'form-control'}),
|
widget=forms.TextInput(attrs={'class': 'form-control'}),
|
||||||
label=_('Summary of the problem'),
|
label=_('Summary of the problem'),
|
||||||
)
|
)
|
||||||
|
|
||||||
submitter_email = forms.EmailField(
|
submitter_email = forms.EmailField(
|
||||||
required=False,
|
required=False,
|
||||||
label=_('Submitter E-Mail Address'),
|
label=_('Submitter E-Mail Address'),
|
||||||
widget=forms.TextInput(attrs={'class':'form-control'}),
|
widget=forms.TextInput(attrs={'class': 'form-control'}),
|
||||||
help_text=_('This e-mail address will receive copies of all public '
|
help_text=_('This e-mail address will receive copies of all public '
|
||||||
'updates to this ticket.'),
|
'updates to this ticket.'),
|
||||||
)
|
)
|
||||||
|
|
||||||
body = forms.CharField(
|
body = forms.CharField(
|
||||||
widget=forms.Textarea(attrs={'class':'form-control', 'rows': 15}),
|
widget=forms.Textarea(attrs={'class': 'form-control', 'rows': 15}),
|
||||||
label=_('Description of Issue'),
|
label=_('Description of Issue'),
|
||||||
required=True,
|
required=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
assigned_to = forms.ChoiceField(
|
assigned_to = forms.ChoiceField(
|
||||||
widget=forms.Select(attrs={'class':'form-control'}),
|
widget=forms.Select(attrs={'class': 'form-control'}),
|
||||||
choices=(),
|
choices=(),
|
||||||
required=False,
|
required=False,
|
||||||
label=_('Case owner'),
|
label=_('Case owner'),
|
||||||
@ -170,7 +170,7 @@ class TicketForm(CustomFieldMixin, forms.Form):
|
|||||||
)
|
)
|
||||||
|
|
||||||
priority = forms.ChoiceField(
|
priority = forms.ChoiceField(
|
||||||
widget=forms.Select(attrs={'class':'form-control'}),
|
widget=forms.Select(attrs={'class': 'form-control'}),
|
||||||
choices=Ticket.PRIORITY_CHOICES,
|
choices=Ticket.PRIORITY_CHOICES,
|
||||||
required=False,
|
required=False,
|
||||||
initial='3',
|
initial='3',
|
||||||
@ -179,7 +179,7 @@ class TicketForm(CustomFieldMixin, forms.Form):
|
|||||||
)
|
)
|
||||||
|
|
||||||
due_date = forms.DateTimeField(
|
due_date = forms.DateTimeField(
|
||||||
widget=forms.TextInput(attrs={'class':'form-control'}),
|
widget=forms.TextInput(attrs={'class': 'form-control'}),
|
||||||
required=False,
|
required=False,
|
||||||
label=_('Due on'),
|
label=_('Due on'),
|
||||||
)
|
)
|
||||||
@ -539,8 +539,8 @@ class UserSettingsForm(forms.Form):
|
|||||||
label=_('Number of tickets to show per page'),
|
label=_('Number of tickets to show per page'),
|
||||||
help_text=_('How many tickets do you want to see on the Ticket List page?'),
|
help_text=_('How many tickets do you want to see on the Ticket List page?'),
|
||||||
required=False,
|
required=False,
|
||||||
choices=((10,'10'),(25,'25'),(50,'50'),(100,'100')),
|
choices=((10,'10'), (25,'25'), (50,'50'), (100,'100')),
|
||||||
)
|
)
|
||||||
|
|
||||||
use_email_as_submitter = forms.BooleanField(
|
use_email_as_submitter = forms.BooleanField(
|
||||||
label=_('Use my e-mail address when submitting tickets?'),
|
label=_('Use my e-mail address when submitting tickets?'),
|
||||||
@ -573,6 +573,7 @@ class TicketCCForm(forms.ModelForm):
|
|||||||
|
|
||||||
class TicketCCUserForm(forms.ModelForm):
|
class TicketCCUserForm(forms.ModelForm):
|
||||||
''' Adds a helpdesk user as a CC on a Ticket '''
|
''' Adds a helpdesk user as a CC on a Ticket '''
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(TicketCCUserForm, self).__init__(*args, **kwargs)
|
super(TicketCCUserForm, self).__init__(*args, **kwargs)
|
||||||
if helpdesk_settings.HELPDESK_STAFF_ONLY_TICKET_CC:
|
if helpdesk_settings.HELPDESK_STAFF_ONLY_TICKET_CC:
|
||||||
@ -582,17 +583,19 @@ class TicketCCUserForm(forms.ModelForm):
|
|||||||
self.fields['user'].queryset = users
|
self.fields['user'].queryset = users
|
||||||
class Meta:
|
class Meta:
|
||||||
model = TicketCC
|
model = TicketCC
|
||||||
exclude = ('ticket','email',)
|
exclude = ('ticket', 'email',)
|
||||||
|
|
||||||
class TicketCCEmailForm(forms.ModelForm):
|
class TicketCCEmailForm(forms.ModelForm):
|
||||||
''' Adds an email address as a CC on a Ticket '''
|
''' Adds an email address as a CC on a Ticket '''
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(TicketCCEmailForm, self).__init__(*args, **kwargs)
|
super(TicketCCEmailForm, self).__init__(*args, **kwargs)
|
||||||
class Meta:
|
class Meta:
|
||||||
model = TicketCC
|
model = TicketCC
|
||||||
exclude = ('ticket','user',)
|
exclude = ('ticket', 'user',)
|
||||||
|
|
||||||
class TicketDependencyForm(forms.ModelForm):
|
class TicketDependencyForm(forms.ModelForm):
|
||||||
|
''' Adds a different ticket as a dependency for this Ticket '''
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = TicketDependency
|
model = TicketDependency
|
||||||
|
@ -61,17 +61,6 @@ class Command(BaseCommand):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
BaseCommand.__init__(self)
|
BaseCommand.__init__(self)
|
||||||
|
|
||||||
# Django 1.7 uses different way to specify options than 1.8+
|
|
||||||
if VERSION < (1, 8):
|
|
||||||
self.option_list += (
|
|
||||||
make_option(
|
|
||||||
'--quiet',
|
|
||||||
default=False,
|
|
||||||
action='store_true',
|
|
||||||
dest='quiet',
|
|
||||||
help='Hide details about each queue/message as they are processed'),
|
|
||||||
)
|
|
||||||
|
|
||||||
help = 'Process django-helpdesk queues and process e-mails via POP3/IMAP or ' \
|
help = 'Process django-helpdesk queues and process e-mails via POP3/IMAP or ' \
|
||||||
'from a local mailbox directory as required, feeding them into the helpdesk.'
|
'from a local mailbox directory as required, feeding them into the helpdesk.'
|
||||||
|
|
||||||
@ -137,8 +126,9 @@ def process_queue(q, logger):
|
|||||||
try:
|
try:
|
||||||
import socks
|
import socks
|
||||||
except ImportError:
|
except ImportError:
|
||||||
no_socks_msg = "Queue has been configured with proxy settings, but no socks " \
|
no_socks_msg = "Queue has been configured with proxy settings, " \
|
||||||
"library was installed. Try to install PySocks via PyPI."
|
"but no socks library was installed. Try to " \
|
||||||
|
"install PySocks via PyPI."
|
||||||
logger.error(no_socks_msg)
|
logger.error(no_socks_msg)
|
||||||
raise ImportError(no_socks_msg)
|
raise ImportError(no_socks_msg)
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ class Queue(models.Model):
|
|||||||
email_box_type = models.CharField(
|
email_box_type = models.CharField(
|
||||||
_('E-Mail Box Type'),
|
_('E-Mail Box Type'),
|
||||||
max_length=5,
|
max_length=5,
|
||||||
choices=(('pop3', _('POP 3')), ('imap', _('IMAP')), ('local',_('Local Directory'))),
|
choices=(('pop3', _('POP 3')), ('imap', _('IMAP')), ('local', _('Local Directory'))),
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
help_text=_('E-Mail server type for creating tickets automatically '
|
help_text=_('E-Mail server type for creating tickets automatically '
|
||||||
@ -178,8 +178,9 @@ class Queue(models.Model):
|
|||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
help_text=_('If using a local directory, what directory path do you '
|
help_text=_('If using a local directory, what directory path do you '
|
||||||
'wish to poll for new email? Example: /var/lib/mail/helpdesk/'),
|
'wish to poll for new email? '
|
||||||
)
|
'Example: /var/lib/mail/helpdesk/'),
|
||||||
|
)
|
||||||
|
|
||||||
permission_name = models.CharField(
|
permission_name = models.CharField(
|
||||||
_('Django auth permission name'),
|
_('Django auth permission name'),
|
||||||
@ -230,14 +231,21 @@ class Queue(models.Model):
|
|||||||
|
|
||||||
logging_type = models.CharField(
|
logging_type = models.CharField(
|
||||||
_('Logging Type'),
|
_('Logging Type'),
|
||||||
max_length=5,
|
max_length = 5,
|
||||||
choices=(('none', _('None')), ('debug', _('Debug')), ('info',_('Information')), ('warn', _('Warning')), ('error', _('Error')), ('crit', _('Critical'))),
|
choices = (
|
||||||
|
('none', _('None')),
|
||||||
|
('debug', _('Debug')),
|
||||||
|
('info', _('Information')),
|
||||||
|
('warn', _('Warning')),
|
||||||
|
('error', _('Error')),
|
||||||
|
('crit', _('Critical'))
|
||||||
|
),
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
help_text=_('Set the default logging level. All messages at that '
|
help_text=_('Set the default logging level. All messages at that '
|
||||||
'level or above will be logged to the directory set below. '
|
'level or above will be logged to the directory set '
|
||||||
'If no level is set, logging will be disabled.'),
|
'below. If no level is set, logging will be disabled.'),
|
||||||
)
|
)
|
||||||
|
|
||||||
logging_dir = models.CharField(
|
logging_dir = models.CharField(
|
||||||
_('Logging Directory'),
|
_('Logging Directory'),
|
||||||
@ -245,9 +253,9 @@ class Queue(models.Model):
|
|||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
help_text=_('If logging is enabled, what directory should we use to '
|
help_text=_('If logging is enabled, what directory should we use to '
|
||||||
'store log files for this queue? '
|
'store log files for this queue? '
|
||||||
'If no directory is set, default to /var/log/helpdesk/'),
|
'If no directory is set, default to /var/log/helpdesk/'),
|
||||||
)
|
)
|
||||||
|
|
||||||
default_owner = models.ForeignKey(
|
default_owner = models.ForeignKey(
|
||||||
settings.AUTH_USER_MODEL,
|
settings.AUTH_USER_MODEL,
|
||||||
|
@ -21,7 +21,7 @@ except ImportError:
|
|||||||
import mock
|
import mock
|
||||||
|
|
||||||
class GetEmailTestCase(TestCase):
|
class GetEmailTestCase(TestCase):
|
||||||
#fixtures = ['emailtemplate.json'] # may don't need this, not testing templates here
|
''' Test reading emails from a local directory '''
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.queue_public = Queue.objects.create(title='Queue 1', slug='QQ', allow_public_submission=True, allow_email_submission=True, email_box_type='local', email_box_local_dir='/var/lib/mail/helpdesk/')
|
self.queue_public = Queue.objects.create(title='Queue 1', slug='QQ', allow_public_submission=True, allow_email_submission=True, email_box_type='local', email_box_local_dir='/var/lib/mail/helpdesk/')
|
||||||
@ -56,6 +56,3 @@ class GetEmailTestCase(TestCase):
|
|||||||
ticket2 = get_object_or_404(Ticket, pk=2)
|
ticket2 = get_object_or_404(Ticket, pk=2)
|
||||||
self.assertEqual(ticket2.ticket_for_url, "QQ-%s" % ticket2.id)
|
self.assertEqual(ticket2.ticket_for_url, "QQ-%s" % ticket2.id)
|
||||||
self.assertEqual(ticket2.description, "This is the helpdesk comment via email.")
|
self.assertEqual(ticket2.description, "This is the helpdesk comment via email.")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -511,7 +511,7 @@ def update_ticket(request, ticket_id, public=False):
|
|||||||
field=_('Status'),
|
field=_('Status'),
|
||||||
old_value=old_status_str,
|
old_value=old_status_str,
|
||||||
new_value=ticket.get_status_display(),
|
new_value=ticket.get_status_display(),
|
||||||
)
|
)
|
||||||
c.save()
|
c.save()
|
||||||
|
|
||||||
if ticket.assigned_to != old_owner:
|
if ticket.assigned_to != old_owner:
|
||||||
@ -520,7 +520,7 @@ def update_ticket(request, ticket_id, public=False):
|
|||||||
field=_('Owner'),
|
field=_('Owner'),
|
||||||
old_value=old_owner,
|
old_value=old_owner,
|
||||||
new_value=ticket.assigned_to,
|
new_value=ticket.assigned_to,
|
||||||
)
|
)
|
||||||
c.save()
|
c.save()
|
||||||
|
|
||||||
if priority != ticket.priority:
|
if priority != ticket.priority:
|
||||||
@ -1077,9 +1077,7 @@ def report_index(request):
|
|||||||
saved_query = request.GET.get('saved_query', None)
|
saved_query = request.GET.get('saved_query', None)
|
||||||
|
|
||||||
user_queues = _get_user_queues(request.user)
|
user_queues = _get_user_queues(request.user)
|
||||||
Tickets = Ticket.objects.filter(
|
Tickets = Ticket.objects.filter(queue__in=user_queues)
|
||||||
queue__in=user_queues,
|
|
||||||
)
|
|
||||||
basic_ticket_stats = calc_basic_ticket_stats(Tickets)
|
basic_ticket_stats = calc_basic_ticket_stats(Tickets)
|
||||||
|
|
||||||
# The following query builds a grid of queues & ticket statuses,
|
# The following query builds a grid of queues & ticket statuses,
|
||||||
@ -1172,8 +1170,7 @@ def run_report(request, report):
|
|||||||
periods = []
|
periods = []
|
||||||
year, month = first_year, first_month
|
year, month = first_year, first_month
|
||||||
working = True
|
working = True
|
||||||
#periods.append("%s %s" % (month_name(month), year))
|
periods.append("%s-%s" % (year, month))
|
||||||
periods.append("%s-%s" % (year,month))
|
|
||||||
|
|
||||||
while working:
|
while working:
|
||||||
month += 1
|
month += 1
|
||||||
@ -1182,7 +1179,7 @@ def run_report(request, report):
|
|||||||
month = 1
|
month = 1
|
||||||
if (year > last_year) or (month > last_month and year >= last_year):
|
if (year > last_year) or (month > last_month and year >= last_year):
|
||||||
working = False
|
working = False
|
||||||
periods.append("%s-%s" % (year,month))
|
periods.append("%s-%s" % (year, month))
|
||||||
|
|
||||||
if report == 'userpriority':
|
if report == 'userpriority':
|
||||||
title = _('User by Priority')
|
title = _('User by Priority')
|
||||||
@ -1298,8 +1295,8 @@ def run_report(request, report):
|
|||||||
morrisjs_data = []
|
morrisjs_data = []
|
||||||
for label in column_headings[1:]:
|
for label in column_headings[1:]:
|
||||||
seriesnum += 1
|
seriesnum += 1
|
||||||
datadict = { "x": label }
|
datadict = {"x": label}
|
||||||
for n in range(0,len(table)):
|
for n in range(0, len(table)):
|
||||||
datadict[n] = table[n][seriesnum]
|
datadict[n] = table[n][seriesnum]
|
||||||
morrisjs_data.append(datadict)
|
morrisjs_data.append(datadict)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user