Roundup Tracker

   1 def eml_to_mht(db, cl, nodeid, newvalues):
   2     '''This auditor fires whenever a new file entity is created.
   3 
   4     If the file is of type message/rfc822, we tack onthe extension .eml.
   5 
   6     The reason for this is that Microsoft Internet Explorer will not open
   7     things with a .eml attachment, as they deem it 'unsafe'. Worse yet,
   8     they'll just give you an incomprehensible error message. For more 
   9     information, please see: 
  10 
  11     http://support.microsoft.com/default.aspx?scid=kb;EN-US;825803
  12 
  13     Their suggested work around is (excerpt):
  14 
  15      WORKAROUND
  16 
  17      To work around this behavior, rename the .EML file that the URL
  18      links to so that it has a .MHT file name extension, and then update
  19      the URL to reflect the change to the file name. To do this:
  20 
  21      1. In Windows Explorer, locate and then select the .EML file that
  22         the URL links.
  23      2. Right-click the .EML file, and then click Rename.
  24      3. Change the file name so that the .EML file uses a .MHT file name
  25         extension, and then press ENTER.
  26      4. Updated the URL that links to the file to reflect the new file
  27         name extension.
  28 
  29     So... we do that. :)'''
  30     if newvalues.get('type', '').lower() == "message/rfc822":
  31         if not newvalues.has_key('name'):
  32             newvalues['name'] = 'email.mht'
  33             return
  34         name = newvalues['name']
  35         if name.endswith('.eml'):
  36             name = name[:-4]
  37         newvalues['name'] = name + '.mht'
  38 
  39 def init(db):
  40     db.file.audit('create', eml_to_mht)


CategoryDetectors