rev 1820 - in trunk/Email-Store-Pristine: lib/Email/Store t

[prev] [thread] [next] [lurker] [Date index for 2005/02/06]

From: richardc
Subject: rev 1820 - in trunk/Email-Store-Pristine: lib/Email/Store t
Date: 16:43 on 06 Feb 2005
Author: richardc
Date: 2005-02-06 16:43:52 +0000 (Sun, 06 Feb 2005)
New Revision: 1820

Added:
   trunk/Email-Store-Pristine/t/mailman-test2
Removed:
   trunk/Email-Store-Pristine/t/attach-test
Modified:
   trunk/Email-Store-Pristine/lib/Email/Store/Pristine.pm
   trunk/Email-Store-Pristine/t/pristine.t
Log:
test (and fix) duplicate handling

Modified: trunk/Email-Store-Pristine/lib/Email/Store/Pristine.pm
===================================================================
--- trunk/Email-Store-Pristine/lib/Email/Store/Pristine.pm	2005-02-04 12:57:24 UTC (rev 1819)
+++ trunk/Email-Store-Pristine/lib/Email/Store/Pristine.pm	2005-02-06 16:43:52 UTC (rev 1820)
@@ -59,7 +59,7 @@
 
 # I damn well want to be first
 sub on_store_order { -20000 }
-sub on_seen_duplcate_order { -20000 }
+sub on_seen_duplicate_order { -20000 }
 
 sub _store {
     my ($self, $mail, $message) = @_;
@@ -79,6 +79,7 @@
 # same rfc2822 body for
 sub on_seen_duplicate {
     my ($self, $mail, $simple)  = @_;
+    print "duplicate checking\n";
     my $message = $simple->as_string;
     for my $check ($mail->pristine_copies) {
         return if $check->message eq $message;

Deleted: trunk/Email-Store-Pristine/t/attach-test
===================================================================
--- trunk/Email-Store-Pristine/t/attach-test	2005-02-04 12:57:24 UTC (rev 1819)
+++ trunk/Email-Store-Pristine/t/attach-test	2005-02-06 16:43:52 UTC (rev 1820)
@@ -1,115 +0,0 @@
-From: Simon Cozens <simon@xxxxxxxxxxxx.xxx>
-To: test@xxxx.xxx
-Bcc: lathos@xxxxx.xxx
-Subject: Test attachment
-Mime-Version: 1.0
-Content-Type: multipart/mixed; boundary="n8g4imXOkfNTN/H1"
-Content-Disposition: inline
-X-Mutt-Fcc: =outbox-200406
-Status: RO
-Content-Length: 6431
-Lines: 102
-
-
---n8g4imXOkfNTN/H1
-Content-Type: text/plain; charset=us-ascii
-Content-Disposition: inline
-
-I am attaching two pointless attachments for your pleasure.
-
---n8g4imXOkfNTN/H1
-Content-Type: application/x-tex
-Content-Disposition: attachment; filename="foo.tex"
-Content-Transfer-Encoding: quoted-printable
-
-Foo bar baz=0A
---n8g4imXOkfNTN/H1
-Content-Type: image/png
-Content-Disposition: attachment; filename="tree.png"
-Content-Transfer-Encoding: base64
-
-iVBORw0KGgoAAAANSUhEUgAAAcEAAAFrBAMAAABbEi9TAAAAJFBMVEX///4AAP//AABfX1+f
-n58fHx/f398/Pz9/f3+/v78AAAD////0RIvuAAAAAXRSTlMBN+Ho8AAAEMJJREFUeJztnU1z
-2zYax/sVfPbN15yTmcjHTicz9rHLNiGPrpMd8Rq7U+ucnWl8zHSctU67NqWauqwtkZaFL7cE
-+AaQAAiQAAWIeqa1KAoA8SMegCBe/vkB7Lj974dt50C37Qnttz2h/bYntN/2hPbbntB+2xOW
-ttGZDY0mQLgJCeshU0qtiTDBW5BnbIPkE26qeKlZxcgjZPBBs4iRQ8jma/7VIGMSbppKqTGA
-IcYi3AgUkR2IDEIxH7TCU+mEolm3AZFKKOKiqVngqDRCcUAbEGmEMrmWuRvbMQqhXBfb+A55
-nVC2VEz3UwqhZAqmF2KdULpiGV4Ta4TyRWJ4IdYIi2r1fcKJtroojw1vTmuERXbPeRmPA1oU
-I61KWBZIxM04Tmh2a1ojLI7ECc2uiFzCl4v3AHxx3mxC7zlA3+KLELheFIDgZj6txzHRuITj
-69vT5Wx1B65A7KFvz9MxGHtJLQz+PJnV45hoVcKyTiWEIxB5Sy/xyNvT1Sn6tjldgw08E4D1
-XR7S7MaUW4au43gAfAtANFkC9O35zs8J43k9jonGJUTNybvTpLxm/0wbl/jqzs8IwS4Quj7w
-1zNIc/cvgL6BlTvJy/CuHsdE4z4PR5fxMeIBX48B+rYG40VGuHrIQ9r1PCw7KNEMjEN3Gs1W
-gQ/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EtviQuypCph6tHza0Gd1PwYJvLs5fUQncvlVIuw
-FxWJYq6XwgRcRAhVRwnC1ee0DO9+aSaEF9xA9UwUOUtKlBDRlMcRFM4kCFM51TJsIEvoIEKo
-OkoQfvUzL/29mdD1UW4ywd0sKRoh4eT5taBOanndyEt8GSfM5VSLsGFjW4pfBgoiI0KoOkoQ
-Bnk9PJ/UU6vkfnQNpst7sLlOs5QmRSMkvuV1C+qk5scwkecHgnCD10MY9mra9DzEL+NeLydJ
-EXz1UtXR5LD8c/JL8hHN4rlPz2HJO77/bZo0gl98JGUKk3qe+fXbCSr+k14G6aRC1VR4DBN5
-CfzbtGps0rysAh8Pe/tLEqKeJKNf6n75GYC/fr39DFVHkRBp9gf8dHfzwQ2ROOmCFhP/CpVL
-wSfnTSplCpNa5beF3S/Nr4V0Uk8u02OYCLiZn7xNc4eUUd23F3/hYV+uPt9N67eZ8W7hAhmz
-5t2CkPRulVqeUGOMLb0f4mLJmEM3mj3v+ISUsERyfY7TONAaQzHHaXZ/rK238dL/vqKc7GW8
-VNWYd8Od2uaYd9d5i8weReYtqvaql3mLrnNPj+kc4KHI3FN1PyWcs+ph7qnj/OFjBig8f4hh
-ptNy+ucPgdQccPXMYzFVLTMHnFo2L6d/DhjIzOMTyyfA4+FjASgzj48KMpt6POpjHh9IrsVA
-SIfZcbmgQnYtxhG2Eln3WgzQeB+ZP2MrRmTX05ANj+71NGk81iU4F68s+6m+dEhVscblTkKB
-Wq5rY1plcr79urbMtK5rKy9RX5sobu3WJrKSUL02EbdOvQ11u0Q0rC+13vaE9tue0H7bE9pv
-e0L7bU9ov+0J7bf//R9ggMNMNGhCWAAAAABJRU5ErkJggg==
-
---n8g4imXOkfNTN/H1--
-

Copied: trunk/Email-Store-Pristine/t/mailman-test2 (from rev 1815, trunk/Email-Store-Pristine/t/mailman-test)
===================================================================
--- trunk/Email-Store-Pristine/t/mailman-test	2005-02-04 05:33:56 UTC (rev 1815)
+++ trunk/Email-Store-Pristine/t/mailman-test2	2005-02-06 16:43:52 UTC (rev 1820)
@@ -0,0 +1,77 @@
+From templates-admin@xxxxxxxxxxxxxxxx.xxx Tue Nov 28 21:17:30 2000
+Envelope-to: mstevens@xxxxxxxxx.xxx
+Received: from trinity.fluff.org [194.153.168.225] (mail)
+	by dayspring.firedrake.org with esmtp (Exim 3.12 #1 (Debian))
+	id 140s82-0007x1-00; Tue, 28 Nov 2000 21:17:30 +0000
+Received: from www.ourshack.com (dog.ourshack.com) [212.74.28.146] 
+	by trinity.fluff.org helo dog.ourshack.com with esmtp (Exim 3.12)
+	id 140s81-0003hh-00 for michael@xxxx.xxx
+	; Tue, 28 Nov 2000 21:17:29 +0000
+Received: from localhost.ourshack.com ([127.0.0.1] helo=dog.ourshack.com)
+	by dog.ourshack.com with esmtp (Exim 3.16 #1)
+	id 140t7Y-000KE6-00; Tue, 28 Nov 2000 22:21:04 +0000
+Received: from dayspring.firedrake.org ([195.82.105.251] ident=mail)
+	by dog.ourshack.com with esmtp (Exim 3.16 #1)
+	id 140t6i-000KDq-00
+	for templates@xxxxxxxxxxxxxxxx.xxx; Tue, 28 Nov 2000 22:20:12 +0000
+Received: from mstevens by dayspring.firedrake.org with local (Exim 3.12 #1 (Debian))
+	id 140s6M-0007sK-00; Tue, 28 Nov 2000 21:15:46 +0000
+From: Michael Stevens <michael@xxxx.xxx>
+To: templates@xxxxxxxxxxxxxxxx.xxx
+Message-ID: <20001128211546.A29664@xxxxxxxxx.xxx>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+User-Agent: Mutt/1.2.5i
+Subject: ttree problems - the sequel
+Date: Tue, 28 Nov 2000 21:15:46 +0000
+Status: RO
+
+Hi.
+  I finally had time to debug my problems with pre_process and ttree
+in more detail.
+
+It turned out that ttree thinks PRE_PROCESS and POST_PROCESS are
+multiple value fields, so it returns the values supplied for them as arrays,
+eg
+
+  pre_process = foo:bar
+
+is sent to Template as PRE_PROCESS => [ 'foo:bar' ]. The delimiter splitting
+routines in Template::Service only split up if values are scalars rather
+than array references, so it wasn't getting split, and therefore it tried
+to pre_process the file 'foo:bar'.
+
+ttree learnt that those two fields were arrays sometime between beta5 and
+rc2, I'm not sure why.
+
+One fix, as far as I can tell, is to apply this patch:
+
+--cut here for patch--
+diff -urN Template-Toolkit-2.00-rc2.orig/bin/ttree Template-Toolkit-2.00-rc2/bin/ttree
+--- Template-Toolkit-2.00-rc2.orig/bin/ttree	Tue Nov 28 20:56:28 2000
++++ Template-Toolkit-2.00-rc2/bin/ttree	Tue Nov 28 20:57:18 2000
+@@ -324,8 +324,8 @@
+ 	'template_pre_chomp|pre_chomp|prechomp',
+ 	'template_post_chomp|post_chomp|postchomp',
+ 	'template_trim|trim',
+-        'template_pre_process|pre_process|preprocess=s@',
+-        'template_post_process|post_process|postprocess=s@',
++        'template_pre_process|pre_process|preprocess=s',
++        'template_post_process|post_process|postprocess=s',
+         'template_process|process=s',
+         'template_default|default=s',
+         'template_error|error=s',
+--cut here for patch--
+
+Which reverts this change. However, if this was originally done for a good
+reason, it's not the end of the story. The modified version passes all tests
+still, but I can't see that they actually exercise ttree.
+
+Michael
+
+_______________________________________________
+templates mailing list
+templates@xxxxxxxxxxxxxxxx.xxx
+http://www.template-toolkit.org/mailman/listinfo/templates
+

Modified: trunk/Email-Store-Pristine/t/pristine.t
===================================================================
--- trunk/Email-Store-Pristine/t/pristine.t	2005-02-04 12:57:24 UTC (rev 1819)
+++ trunk/Email-Store-Pristine/t/pristine.t	2005-02-06 16:43:52 UTC (rev 1820)
@@ -1,5 +1,5 @@
 # -*- cperl -*-
-use Test::More tests => 7;
+use Test::More tests => 11;
 use File::Slurp;
 BEGIN { unlink("t/test.db"); }
 use Email::Store { only => [qw( Mail List Pristine )] },
@@ -27,6 +27,21 @@
    '[Templates] ttree problems - the sequel',
   "but the pristine copy doesn't");
 
-
 # to test.  getting one copy to you, one to the list - expect 1 mail
 # and 2 pristine
+# plug in a duplicate message
+$data = read_file("t/mailman-test2");
+Email::Store::Mail->store($data);
+
+@mails = Email::Store::Mail->retrieve_all;
+is(@mails, 1, "Only one mail");
+my @copies = $mails[0]->pristine_copies;
+is(@copies, 2, "two pristine copies" );
+
+is($copies[0]->simple->header('subject'),
+   '[Templates] ttree problems - the sequel',
+  "first via list");
+
+is($copies[1]->simple->header('subject'),
+   'ttree problems - the sequel',
+   "second not");

Generated at 17:00 on 06 Feb 2005 by mariachi 0.52