Merge pull request #442 from reduxionist/pr/420-merge-corrections

cleanup build-breaking whitespace merge errors
This commit is contained in:
Jonathan Barratt 2016-10-29 15:04:39 +07:00 committed by GitHub
commit cbbad8d370
3 changed files with 16 additions and 29 deletions

View File

@ -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.'
@ -96,7 +85,7 @@ def process_email(quiet=False):
logger = logging.getLogger('django.helpdesk.queue.' + q.slug) logger = logging.getLogger('django.helpdesk.queue.' + q.slug)
if not q.logging_type or q.logging_type == 'none': if not q.logging_type or q.logging_type == 'none':
logging.disable(logging.CRITICAL) #disable all messages logging.disable(logging.CRITICAL) # disable all messages
elif q.logging_type == 'info': elif q.logging_type == 'info':
logger.setLevel(logging.INFO) logger.setLevel(logging.INFO)
elif q.logging_type == 'warn': elif q.logging_type == 'warn':
@ -249,7 +238,7 @@ def process_queue(q, logger):
if ticket: if ticket:
logger.info("Successfully processed message %s, ticket/comment created." % str(m)) logger.info("Successfully processed message %s, ticket/comment created." % str(m))
try: try:
#unlink(m) #delete message file if ticket was successful # unlink(m) #delete message file if ticket was successful
logger.info("Successfully deleted message %s." % str(m)) logger.info("Successfully deleted message %s." % str(m))
except: except:
logger.error("Unable to delete message %s." % str(m)) logger.error("Unable to delete message %s." % str(m))
@ -281,7 +270,7 @@ def decode_mail_headers(string):
if six.PY2: if six.PY2:
return u' '.join([unicode(msg, charset or 'utf-8') for msg, charset in decoded]) return u' '.join([unicode(msg, charset or 'utf-8') for msg, charset in decoded])
elif six.PY3: elif six.PY3:
return u' '.join([str(msg,encoding=charset,errors='replace') if charset else str(msg) for msg, charset in decoded]) return u' '.join([str(msg, encoding=charset, errors='replace') if charset else str(msg) for msg, charset in decoded])
def ticket_from_message(message, queue, logger): def ticket_from_message(message, queue, logger):

View File

@ -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 '
@ -231,7 +231,7 @@ 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 '

View File

@ -20,8 +20,9 @@ except ImportError:
# Python < 3.3 # Python < 3.3
import mock import mock
class GetEmailTestCase(TestCase): class GetEmailTestCase(TestCase):
#fixtures = ['emailtemplate.json'] # may don't need this, not testing templates here # fixtures = ['emailtemplate.json'] # may not need this, not testing templates here
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 +57,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.")