Changeset 1755

Show
Ignore:
Timestamp:
10/15/06 17:43:07
Author:
miyagawa
Message:

don't use TZs if there's more than 3 timezones in the country.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Plugin/Filter/GuessTimeZoneByDomain.pm

    r1754 r1755  
    5050    if ($cctld) { 
    5151        my @names = DateTime::TimeZone->names_in_country($cctld); 
    52         $result{cc} = $names[0]; 
    53         $context->log(info => "guess by ccTLD ($cctld): " . ($names[0] || '(undef)')); 
     52        if (@names <= 3) { 
     53            $result{cc} = $names[0]; 
     54            $context->log(info => "guess by ccTLD ($cctld): " . ($names[0] || '(undef)')); 
     55        } 
    5456    } 
    5557 
     
    5860        if ($ccip) { 
    5961            my @names = DateTime::TimeZone->names_in_country($ccip); 
    60             $result{ip} = $names[0]; 
    61             $context->log(info => "guess by IP::Country ($ccip): " . ($names[0] || '(undef)')); 
     62            if (@names <= 3) { 
     63                $result{ip} = $names[0]; 
     64                $context->log(info => "guess by IP::Country ($ccip): " . ($names[0] || '(undef)')); 
     65            } 
    6266        } 
    6367    } 
  • trunk/plagger/t/plugins/Filter-GuessTimeZoneByDomain/base.t

    r1754 r1755  
    7575is $context->update->feeds->[0]->entries->[0]->date->time_zone->name, "Asia/Tokyo"; 
    7676 
    77 === Conflict: Use IP 
    78 --- SKIP 
    79 --- input config 
    80 plugins: 
    81   - module: CustomFeed::Debug 
    82     config: 
    83       title: Foo 
    84       entry: 
    85         - link: http://www.sixapart.jp/ 
    86           date: 2006/10/14 12:00:00 
    87   - module: Filter::GuessTimeZoneByDomain 
    88     config: 
    89       conflict_policy: ip 
    90 --- expected 
    91 is $context->update->feeds->[0]->entries->[0]->date->time_zone->name, "America/New_York"; 
    92  
    9377=== Force upgrade GMT 
    9478--- input config