forked from extern/django-helpdesk
fix get_email from gmail imap
This commit is contained in:
parent
540531c916
commit
03a57bdc5f
@ -207,3 +207,8 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
|||||||
# - This is only necessary to make the demo project work, not needed for
|
# - This is only necessary to make the demo project work, not needed for
|
||||||
# your own projects unless you make your own fixtures
|
# your own projects unless you make your own fixtures
|
||||||
FIXTURE_DIRS = [os.path.join(BASE_DIR, 'fixtures')]
|
FIXTURE_DIRS = [os.path.join(BASE_DIR, 'fixtures')]
|
||||||
|
|
||||||
|
try:
|
||||||
|
from .local_settings import *
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
@ -340,13 +340,14 @@ def ticket_from_message(message, queue, logger):
|
|||||||
if not name:
|
if not name:
|
||||||
ext = mimetypes.guess_extension(part.get_content_type())
|
ext = mimetypes.guess_extension(part.get_content_type())
|
||||||
name = "part-%i%s" % (counter, ext)
|
name = "part-%i%s" % (counter, ext)
|
||||||
|
|
||||||
payload = part.get_payload()
|
payload = part.get_payload()
|
||||||
|
if isinstance(payload, list):
|
||||||
|
payload = payload.pop().as_string()
|
||||||
payloadToWrite = payload
|
payloadToWrite = payload
|
||||||
try:
|
try:
|
||||||
logger.debug("Try to base64 decode the attachment payload")
|
logger.debug("Try to base64 decode the attachment payload")
|
||||||
payloadToWrite = base64.decodestring(payload)
|
payloadToWrite = base64.decodestring(payload)
|
||||||
except binascii.Error:
|
except binascii.Error, TypeError:
|
||||||
logger.debug("Payload was not base64 encoded, using raw bytes")
|
logger.debug("Payload was not base64 encoded, using raw bytes")
|
||||||
payloadToWrite = payload
|
payloadToWrite = payload
|
||||||
files.append(SimpleUploadedFile(name, part.get_payload(decode=True), mimetypes.guess_type(name)[0]))
|
files.append(SimpleUploadedFile(name, part.get_payload(decode=True), mimetypes.guess_type(name)[0]))
|
||||||
|
Loading…
Reference in New Issue
Block a user