Fix PEP8 errors

This commit is contained in:
Garret Wassermann 2016-10-29 04:08:57 -04:00
parent cad174468b
commit d791700582
5 changed files with 44 additions and 49 deletions

View File

@ -573,6 +573,7 @@ class TicketCCForm(forms.ModelForm):
class TicketCCUserForm(forms.ModelForm):
''' Adds a helpdesk user as a CC on a Ticket '''
def __init__(self, *args, **kwargs):
super(TicketCCUserForm, self).__init__(*args, **kwargs)
if helpdesk_settings.HELPDESK_STAFF_ONLY_TICKET_CC:
@ -586,6 +587,7 @@ class TicketCCUserForm(forms.ModelForm):
class TicketCCEmailForm(forms.ModelForm):
''' Adds an email address as a CC on a Ticket '''
def __init__(self, *args, **kwargs):
super(TicketCCEmailForm, self).__init__(*args, **kwargs)
class Meta:
@ -593,6 +595,7 @@ class TicketCCEmailForm(forms.ModelForm):
exclude = ('ticket', 'user',)
class TicketDependencyForm(forms.ModelForm):
''' Adds a different ticket as a dependency for this Ticket '''
class Meta:
model = TicketDependency

View File

@ -61,17 +61,6 @@ class Command(BaseCommand):
def __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 ' \
'from a local mailbox directory as required, feeding them into the helpdesk.'
@ -137,8 +126,9 @@ def process_queue(q, logger):
try:
import socks
except ImportError:
no_socks_msg = "Queue has been configured with proxy settings, but no socks " \
"library was installed. Try to install PySocks via PyPI."
no_socks_msg = "Queue has been configured with proxy settings, " \
"but no socks library was installed. Try to " \
"install PySocks via PyPI."
logger.error(no_socks_msg)
raise ImportError(no_socks_msg)

View File

@ -178,7 +178,8 @@ class Queue(models.Model):
blank=True,
null=True,
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(
@ -231,12 +232,19 @@ class Queue(models.Model):
logging_type = models.CharField(
_('Logging Type'),
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,
null=True,
help_text=_('Set the default logging level. All messages at that '
'level or above will be logged to the directory set below. '
'If no level is set, logging will be disabled.'),
'level or above will be logged to the directory set '
'below. If no level is set, logging will be disabled.'),
)
logging_dir = models.CharField(

View File

@ -21,7 +21,7 @@ except ImportError:
import mock
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):
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)
self.assertEqual(ticket2.ticket_for_url, "QQ-%s" % ticket2.id)
self.assertEqual(ticket2.description, "This is the helpdesk comment via email.")

View File

@ -1077,9 +1077,7 @@ def report_index(request):
saved_query = request.GET.get('saved_query', None)
user_queues = _get_user_queues(request.user)
Tickets = Ticket.objects.filter(
queue__in=user_queues,
)
Tickets = Ticket.objects.filter(queue__in=user_queues)
basic_ticket_stats = calc_basic_ticket_stats(Tickets)
# The following query builds a grid of queues & ticket statuses,
@ -1172,7 +1170,6 @@ def run_report(request, report):
periods = []
year, month = first_year, first_month
working = True
#periods.append("%s %s" % (month_name(month), year))
periods.append("%s-%s" % (year, month))
while working: