Don't provide a default for the scanner source adf_mode. Some scanners throw an error even when the selection if supported.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-06-07 20:58:50 -04:00
parent 3e58fd4e38
commit 460570ed05
5 changed files with 25 additions and 69 deletions

View File

@@ -173,7 +173,8 @@
- Fix error when trying to upload a document from and email account with 'from' and 'subject' metadata.
- Fix typo on message.header get from 'Suject' to 'Subject'.
- On multi part emails keep the original From and Subject properties for all subsequent parts if the sub parts don't specify them. Fixes issue #481. Thanks to Robert Schöftner @robert.schoeftner for the report and debug information.
- Don't provide a default for the scanner source adf_mode. Some scanners throw an error even when the selection
if supported.
2.7.3 (2017-09-11)

View File

@@ -519,6 +519,8 @@ Other changes worth mentioning
- Fix error when trying to upload a document from and email account with 'from' and 'subject' metadata.
- Fix typo on message.header get from 'Suject' to 'Subject'.
- On multi part emails keep the original From and Subject properties for all subsequent parts if the sub parts don't specify them. Fixes issue #481. Thanks to Robert Schöftner @robert.schoeftner for the report and debug information.
- Don't provide a default for the scanner source adf_mode. Some scanners throw an error even when the selection
if supported.
Removals
--------

View File

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-06-08 00:57
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sources', '0017_auto_20180510_2151'),
]
operations = [
migrations.AlterField(
model_name='sanescanner',
name='adf_mode',
field=models.CharField(blank=True, choices=[('simplex', 'Simplex'), ('duplex', 'Duplex')], help_text='Selects the document feeder mode (simplex/duplex). If this option is not supported by your scanner, leave it blank.', max_length=16, verbose_name='ADF mode'),
),
]

View File

@@ -207,7 +207,7 @@ class SaneScanner(InteractiveSource):
)
adf_mode = models.CharField(
blank=True, choices=SCANNER_ADF_MODE_CHOICES,
default=SCANNER_ADF_MODE_SIMPLEX, help_text=_(
help_text=_(
'Selects the document feeder mode (simplex/duplex). If this '
'option is not supported by your scanner, leave it blank.'
), max_length=16, verbose_name=_('ADF mode')

View File

@@ -161,73 +161,6 @@ class EmailFilenameDecodingTestCase(BaseTestCase):
)
@override_settings(OCR_AUTO_OCR=False)
class IMAPSourceTestCase(BaseTestCase):
class MockIMAP4_SSL(object):
#def dele(self, which):
# return
#def getwelcome(self):
# return
#def list(self, which=None):
# return (None, ['1 test'])
#def pass_(self, password):
# return
#def quit(self):
# return
#def retr(self, which=None):
# return (
# 1, [TEST_EMAIL_BASE64_FILENAME]
# )
def fetch(self, message_set, message_parts):
return 'STATUS', '(1 BODY[{}])'.format(TEST_EMAIL_ATTACHMENT_AND_INLINE)
#status, data = mailbox.fetch(message_number, '(RFC822)')
#EmailBaseModel.process_message(
# source=self, message_text=data[0][1]
#)
#mailbox.store(message_number, '+FLAGS', '\\Deleted')
def login(self, username, password):
return
def search(self, charset, *criterion):
return (None, ['1'])
def select(self, mailbox):
return
def user(self, username):
return
def setUp(self):
super(IMAPSourceTestCase, self).setUp()
self.document_type = DocumentType.objects.create(
label=TEST_DOCUMENT_TYPE_LABEL
)
def tearDown(self):
self.document_type.delete()
super(IMAPSourceTestCase, self).tearDown()
@mock.patch('imaplib.IMAP4_SSL')
def test_download_document(self, mock_imaplib):
mock_imaplib.return_value = IMAPSourceTestCase.MockIMAP4_SSL()
self.source = IMAPEmail.objects.create(
document_type=self.document_type, label='', host='', password='',
username=''
)
self.source.check_source()
self.assertEqual(
Document.objects.first().label, 'Ampelm\xe4nnchen.txt'
)
@override_settings(OCR_AUTO_OCR=False)
class POP3SourceTestCase(BaseTestCase):
class MockMailbox(object):