Subject: | Comments don't appear when using default templates |
Symptoms: A fresh blog install using the CGI frontend fails to display the enter comment form when viewing with ?comment=1 in the URL.
Cause: comment => 1 is missing from $bryar->{parameters} when the template tests it
The only place where $bryar->{parameters} is set is in the Collector when ->collect is called. The first time collect is called during go(), everything is ok. It is when the calendar template is called that collect is called again overwriting the parameters that it stops working.
A temporary fix is to only call the calendar template once the parameters have been tested (which seems to be how blog.simon-cozens.org is unaffected).
A better fix is to modify the posts_calendar method to avoid this happening (or I suppose what would be better would be to not have the collector modifying the internals of another object). The attached patch (against CVS HEAD) localises $self->{arguments} in posts_calendar.
Index: lib/Bryar.pm
===================================================================
RCS file: /var/cvs/modules/Bryar/lib/Bryar.pm,v
retrieving revision 1.9
diff -u -r1.9 Bryar.pm
--- lib/Bryar.pm 12 Apr 2004 15:22:41 -0000 1.9
+++ lib/Bryar.pm 17 May 2004 12:31:57 -0000
@@ -227,6 +227,7 @@
$year ||= (localtime)[5];
my $this_month = timelocal(0, 0, 0, 1, $month, $year);
+ local $self->{arguments};
my @documents = $self->{config}->collector->collect($self,
since => $this_month
);