Skip to content

Commit 719f2af

Browse files
author
Richard Jones
committed
make the reactor an auditor, clean up docstring
1 parent a23824c commit 719f2af

File tree

2 files changed

+41
-39
lines changed

2 files changed

+41
-39
lines changed

detectors/fileauditor.py

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

detectors/filereactor.py

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)