mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2024-12-14 10:51:21 +01:00
patch: implicit closing of open files;
This commit is contained in:
parent
d54017f69f
commit
62163eaf0e
@ -234,17 +234,17 @@ def process_queue(q, logger):
|
|||||||
logger.info("Found %s messages in local mailbox directory" % str(len(mail)))
|
logger.info("Found %s messages in local mailbox directory" % str(len(mail)))
|
||||||
for m in mail:
|
for m in mail:
|
||||||
logger.info("Processing message %s" % str(m))
|
logger.info("Processing message %s" % str(m))
|
||||||
f = open(m, 'r')
|
with open(m, 'r') as f:
|
||||||
ticket = ticket_from_message(message=f.read(), queue=q, logger=logger)
|
ticket = ticket_from_message(message=f.read(), queue=q, logger=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))
|
||||||
else:
|
else:
|
||||||
logger.warn("Message %s was not successfully processed, and will be left in local directory" % str(m))
|
logger.warn("Message %s was not successfully processed, and will be left in local directory" % str(m))
|
||||||
|
|
||||||
|
|
||||||
def decodeUnknown(charset, string):
|
def decodeUnknown(charset, string):
|
||||||
|
Loading…
Reference in New Issue
Block a user