Ignore:
Timestamp:
2014-01-04T15:25:10+01:00 (11 years ago)
Author:
stoecker
Message:

try approving multiple times

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/i18n/launchpad.pl

    r28806 r30179  
    2626my $agent = "JOSM_Launchpad/1.$revision";
    2727
     28my $debugfile = 0;#1;
    2829my $cleanall = 0;#1;
     30
     31open TXTFILE,">","launchpad_debug.log" or die if $debugfile;
    2932
    3033if($#ARGV != 0)
     
    216219    chdir("po");
    217220    $mech->submit_form(with_fields => {"file" => "josm.pot"});
    218     sleep(10);
    219     print "Trying to approve upload.\n";
    220     $mech->get("https://translations.launchpad.net/josm/trunk/+imports?field.filter_status=NEEDS_REVIEW&field.filter_extension=pot");
    221     my @links;
    222     foreach my $line (split("\n", $mech->content()))
    223     {
    224       push (@links, $1) if $line =~ /href="(\/\+imports\/\d+)"/;
    225     }
    226     if(!@links)
    227     {
    228       warn "Upload not found in import list, upload possibly failed.";
    229     }
    230     elsif(@links > 1)
    231     {
    232       warn "More than one upload found in import list, cannot approve.";
    233     }
    234     else
    235     {
    236       $mech->get("https://translations.launchpad.net$links[0]");
    237       $mech->submit_form(form_name => "launchpadform", button => "field.actions.approve");
    238       if(!($mech->content() =~ /There are no entries that match this filtering/))
     221    print "Start approving of upload.\n";
     222    for(1..10)
     223    {
     224      eval
    239225      {
    240         warn "Approving possibly failed.";
    241       }
     226        sleep(10);
     227        print "Trying to approve upload.\n";
     228        $mech->get("https://translations.launchpad.net/josm/trunk/+imports?field.filter_status=NEEDS_REVIEW&field.filter_extension=pot");
     229        my @links;
     230        foreach my $line (split("\n", $mech->content()))
     231        {
     232          if($line =~ /href="(\/\+imports\/\d+)"/)
     233          {
     234            push (@links, $1);
     235            print TXTFILE $line if $debugfile;
     236          }
     237        }
     238        if(!@links)
     239        {
     240          print TXTFILE $mech->content() if $debugfile;
     241          die "Upload not found in import list, upload possibly failed.";
     242        }
     243        elsif(@links > 1)
     244        {
     245          die "More than one upload found in import list, cannot approve.";
     246        }
     247        else
     248        {
     249          $mech->get("https://translations.launchpad.net$links[0]");
     250          if($debugfile)
     251          {
     252            print TXTFILE "LINK: $links[0]\n";
     253            $mech->dump_headers(\*TXTFILE);
     254            print TXTFILE $mech->content();
     255            print TXTFILE $mech->status() ." - ". $mech->uri()."\n";
     256            $mech->dump_forms(\*TXTFILE);
     257          }
     258          $mech->submit_form(form_name => "launchpadform", button => "field.actions.approve");
     259          if(!($mech->content() =~ /There are no entries that match this filtering/))
     260          {
     261            die "Approving possibly failed.";
     262          }
     263        }
     264      };
     265      print $@ if $@;
     266      last if !$@;
    242267    }
    243268
Note: See TracChangeset for help on using the changeset viewer.