Changeset 790 for trunk/lib


Ignore:
Timestamp:
May 19, 2006, 12:08:19 PM (16 years ago)
Author:
nick
Message:

Pass the requested feed listing through all the feeds code, rather than just assuming it's recent_changes

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore set to
      .vimrc
      *.swp
  • trunk/lib/OpenGuides.pm

    r787 r790  
    646646  $guide->display_feed(
    647647                         feed_type          => 'rss',
     648                         feed_listing       => 'recent_changes',
    648649                         items              => 10,
    649650                         ignore_minor_edits => 1,
     
    653654  # All edits bob has made to pub pages in the last week in Atom format
    654655  $guide->display_feed(
    655                          feed_type => 'atom',
    656                          days      => 7,
    657                          username  => "bob",
    658                          category  => "Pubs",
     656                         feed_type    => 'atom',
     657                         feed_listing => 'recent_changes',
     658                         days         => 7,
     659                         username     => "bob",
     660                         category     => "Pubs",
    659661                     );
    660662
     
    662664"rss" and "atom".
    663665
     666C<feed_listing> is a mandatory parameter. Supported values at present
     667are "recent_changes". (More values are coming soon though!)
     668
    664669As with other methods, the C<return_output> parameter can be used to
    665670return the output instead of printing it to STDOUT.
     
    672677    my $feed_type = $args{feed_type};
    673678    croak "No feed type given" unless $feed_type;
     679
     680    my $feed_listing = $args{feed_listing};
     681    croak "No feed listing given" unless $feed_listing;
    674682   
    675683    my $return_output = $args{return_output} ? 1 : 0;
     
    686694                       ignore_minor_edits => $ignore_minor_edits,
    687695                       feed_type          => $feed_type,
     696                       feed_listing       => $feed_listing,
    688697                   );
    689698    my %filter;
  • trunk/lib/OpenGuides/Feed.pm

    r785 r790  
    6161   
    6262    my $feed_type = $args{feed_type};
     63    my $feed_listing = $args{feed_listing};
    6364   
    6465    my %known_types = (
     
    6667                          'atom' => 1,
    6768                      );
     69    my %known_listings = (
     70                          'recent_changes' => 1,
     71                         );
    6872                     
    6973    croak "No feed type specified" unless $feed_type;
    7074    croak "Unknown feed type: $feed_type" unless $known_types{$feed_type};
    7175
     76    croak "No feed listing specified" unless $feed_listing;
     77    croak "Unknown feed listing: $feed_listing" unless $known_listings{$feed_listing};
     78
    7279    if ($feed_type eq 'rss') {
    73         return $self->rss_maker->recent_changes(%args);
     80        if ($feed_listing eq 'recent_changes') {
     81            return $self->rss_maker->recent_changes(%args);
     82        }
    7483    }
    7584    elsif ($feed_type eq 'atom') {
    76         return $self->atom_maker->recent_changes(%args);
     85        if ($feed_listing eq 'recent_changes') {
     86            return $self->atom_maker->recent_changes(%args);
     87        }
    7788    }
    7889}
Note: See TracChangeset for help on using the changeset viewer.