Skip Menu |

This queue is for tickets about the Bryar CPAN distribution.

Report information
The Basics
Id: 6326
Status: new
Priority: 0/
Queue: Bryar

People
Owner: Nobody in particular
Requestors: bsmith [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.6
Fixed in: (no value)



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 );
Date: Mon, 17 May 2004 13:37:19 +0100
From: Simon Cozens <simon [...] simon-cozens.org>
To: via RT <bug-Bryar [...] rt.cpan.org>
Subject: Re: [cpan #6326] Comments don't appear when using default templates
RT-Send-Cc:
via RT: Show quoted text
> Symptoms: A fresh blog install using the CGI frontend fails to display the enter comment form when viewing with ?comment=1 in the URL. >
This is known bug. Show quoted text
> 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).
Correct. Show quoted text
> 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.
The *real* fix is to have the calendar use a separate Bryar object, which will be in the next release. -- CLUELESSNESS: There are No Stupid Questions, But There Are a LOT of Inquisitive Idiots http://www.despair.com
From: mvz [...] xs4all.nl
[simon@simon-cozens.org - Mon May 17 08:37:36 2004]: Show quoted text
> The *real* fix is to have the calendar use a separate Bryar object, > which will be in the next release.
It can also be fixed by not letting the Bryar::Collector object modify fields of the Bryar object. I've attached a patch that lets the Bryar object set its own arguments field. It then passes the contents of that field to the Collector object. I think this solution is simpler and more elegant than giving the calendar a separate Bryar object.
diff -ru Bryar-2.6/lib/Bryar/Collector.pm working/lib/Bryar/Collector.pm --- Bryar-2.6/lib/Bryar/Collector.pm 2004-01-23 13:29:01.000000000 +0100 +++ working/lib/Bryar/Collector.pm 2004-12-05 16:39:10.886538851 +0100 @@ -36,7 +36,6 @@ my $bryar = shift; croak "Must pass in a Bryar object" unless UNIVERSAL::isa($bryar, "Bryar"); my %args = @_; - $bryar->{arguments} = \%args; delete $args{format}; # Not interesting if (! keys %args) { # Default operation return $class->collect_current($bryar); diff -ru Bryar-2.6/lib/Bryar.pm working/lib/Bryar.pm --- Bryar-2.6/lib/Bryar.pm 2004-02-11 12:36:00.000000000 +0100 +++ working/lib/Bryar.pm 2004-12-05 16:40:22.994692159 +0100 @@ -204,6 +204,8 @@ my %args = $self->{config}->frontend()->parse_args($self); my @documents = $self->{config}->collector()->collect($self, %args); + $self->{arguments} = \%args; + $args{format} ||= "html"; $self->{config}->frontend()->output(