annotate test/mocknull.py @ 3945:1dd64778bc45

Mail improvements: - Implement new config option in mail-section "ignore_alternatives" to ignore alternatives in a multipart/alternative mail. The *last* text/plain part of the *first* multipart/alternative is used as the message, if ignore_alternatives is set all other alternative parts of the first multipart/alternative that contained a text/plain part are ignored. Other multipart/alternative or other multipart are attached as before. This fixes [SF#959811] "Multipart/alternative handling considered bad". Note that this also changes which text/plain part is attached as the message if there are several text/plain parts in a multipart: Previously the *first* text/plain would be attached. Now we attach the *last* one, this is more in line with rfc 2046, sec. 5.1.4. according to Philipp Gortan. - Fix bug in attachment of text parts: If there are multiple text/plain parts in a nested multipart, the previous code would attach the multipart serialisation instead of the text/plain serialisation as a file to the issue in some cases. - Add regression tests for the new config-option and bug-fixes above.
author Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
date Wed, 14 Nov 2007 14:57:47 +0000
parents 79fd8537ae3b
children 3757449e00c4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2532
24d3b25a9157 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
1
24d3b25a9157 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
2 class MockNull:
24d3b25a9157 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
3 def __init__(self, **kwargs):
24d3b25a9157 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
4 for key, value in kwargs.items():
24d3b25a9157 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
5 self.__dict__[key] = value
24d3b25a9157 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
6
24d3b25a9157 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
7 def __call__(self, *args, **kwargs): return MockNull()
24d3b25a9157 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
8 def __getattr__(self, name):
24d3b25a9157 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
9 # This allows assignments which assume all intermediate steps are Null
24d3b25a9157 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
10 # objects if they don't exist yet.
24d3b25a9157 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
11 #
24d3b25a9157 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
12 # For example (with just 'client' defined):
24d3b25a9157 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
13 #
24d3b25a9157 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
14 # client.db.config.TRACKER_WEB = 'BASE/'
24d3b25a9157 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
15 self.__dict__[name] = MockNull()
24d3b25a9157 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
16 return getattr(self, name)
24d3b25a9157 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
17
24d3b25a9157 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
18 def __getitem__(self, key): return self
24d3b25a9157 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
19 def __nonzero__(self): return 0
24d3b25a9157 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
20 def __str__(self): return ''
24d3b25a9157 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
21 def __repr__(self): return '<MockNull 0x%x>'%id(self)
2686
79fd8537ae3b .gettext() facility is vital for many roundup objects.
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2532
diff changeset
22 def gettext(self, str): return str
79fd8537ae3b .gettext() facility is vital for many roundup objects.
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2532
diff changeset
23 _ = gettext

Roundup Issue Tracker: http://roundup-tracker.org/