Changeset 226


Ignore:
Timestamp:
12/29/10 15:31:35 (13 years ago)
Author:
nanardon
Message:
  • another compatibility redirect
Location:
server/trunk/web
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • server/trunk/web/lib/Sophie/Controller/Compat.pm

    r224 r226  
    4848} 
    4949 
     50# /distrib/foo,bar,baz/RPM 
     51sub distrib :Private { 
     52    my ($self, $c, $distrib, $rpm) = @_; 
     53 
     54    my @args = split(',', $distrib); 
     55    if (@args == 2) { 
     56        unshift(@args, ''); 
     57    } 
     58    $c->res->redirect($c->uri_for('/distrib', @args, 'rpms', $rpm)); 
     59} 
     60 
    5061=head1 AUTHOR 
    5162 
  • server/trunk/web/lib/Sophie/Controller/Distrib.pm

    r196 r226  
    233233sub list_arch :Path :Args(2) { 
    234234    my ( $self, $c, $distribution, $release ) = @_; 
     235 
     236    # Compatability with Sophie1 
     237    if ($distribution =~ /^([^,]+,)?[^,]+,[^,]+$/) { 
     238        $c->go('/compat/distrib', [ $distribution, $release ]); 
     239    } 
     240 
    235241    $c->stash->{dist}{distribution} = $distribution; 
    236242    $c->stash->{dist}{release} = $release; 
  • server/trunk/web/t/controller_Compat.t

    r224 r226  
    88ok( request('/viewrpm')->is_redirect, 'Request should succeed' ); 
    99ok( request('/viewrpm/azerty')->is_redirect, 'Request should succeed' ); 
     10ok( request('/distrib/Mandriva,cooker,i586/azerty')->is_redirect, 'Request should succeed' ); 
    1011done_testing(); 
Note: See TracChangeset for help on using the changeset viewer.