Ticket #379: email2trac_ignore_attachments.diff
File email2trac_ignore_attachments.diff, 1.9 KB (added by anonymous, 8 years ago) |
---|
-
c:/trac/email2trac.
old new 319 319 320 320 return False 321 321 322 def email_attachment_ignored(self, attachment_name): 323 """ 324 This function will check if the attachment should be ignored. 325 """ 326 self.logger.debug('function email_attachment_acl: %s' % attachment_name) 327 328 try: 329 ignored_attachments = self.parameters['ignored_attachments'] 330 331 # Check empty string 332 # 333 if not ignored_attachments: 334 return false #not ignored 335 336 except KeyError, detail: 337 self.logger.debug('\t %s not defined, all messages are allowed.' % ('ignored_attachments')) 338 339 return false #not ignored 340 341 ignored_attachments = string.split(ignored_attachments, ',') 342 343 for entry in ignored_attachments: 344 if attachment_name == entry: 345 return True #ignore this attachment 346 322 347 def email_header_txt(self, m): 323 348 """ 324 349 Display To and CC addresses in description field … … 1385 1410 1386 1411 (original, filename, part) = item 1387 1412 1413 # Skip black-listed attachments 1414 if self.email_attachment_ignored(filename): 1415 continue 1416 1388 1417 ## We have to determine the size so we use this temporary solution. 1389 1418 # 1390 1419 path, fd = util.create_unique_file(os.path.join(self.parameters.tmpdir, 'email2trac_tmp.att')) … … 2334 2363 2335 2364 (original, filename, part) = part 2336 2365 inline = self.inline_part(part) 2366 2367 if self.email_attachment_ignored(filename): 2368 continue 2337 2369 2338 2370 ## Skip generation of attachment link if html is converted to text 2339 2371 #