IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27356


Ignore:
Timestamp:
Mar 19, 2010, 8:36:36 AM (16 years ago)
Author:
bills
Message:

make sure that ID values passed to byid and byidff are valid ids (number > 0)
Fix bug in MJD* validation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/scripts/pstampparse.pl

    r27260 r27356  
    258258
    259259    # Temporary hack so that MOPS can get at non-magicked data
    260     if ($product and ($product eq "mops-pstamp-results")) {
    261         $need_magic = 0;
    262     }
     260#    if ($product and ($product eq "mops-pstamp-results")) {
     261#        $need_magic = 0;
     262#    }
    263263
    264264    # For "stamp" and "list_uri" jobs collect rows with the same images of interest in a list so that they
     
    285285        if (!$skycenter) {
    286286            print STDERR "center must be specified in sky coordintes for bycoord" if $verbose;
     287            insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST);
     288            $num_jobs++;
     289            next;
     290        }
     291    }
     292    if (($req_type eq "byid") or ($req_type eq "bydiff")) {
     293        if (!validID($id)) {
     294            print STDERR "ID must be a positive integer for req_type $req_type\n" if $verbose;
    287295            insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST);
    288296            $num_jobs++;
     
    368376        if (($stage ne "stack") and ($need_magic and !$image->{magicked})) {
    369377            # XXX: should we add a faulted job so the client can know what happened if no images come back?
    370             # This test is made in locate_images now so this code never runs. This leads to no feedback
    371             # to users, but speeds up processing significatnly
     378            # The test for destreaked is made in locate_images now so this code never runs. This leads to no feedback
     379            # to users, but speeds up processing significantly
    372380            print STDERR "skipping non-magicked image $imagefile\n" if $verbose;
    373381
     
    859867    my $val = shift;
    860868
    861     return $val =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/;
     869    return 0 if !defined $val;
     870
     871    return ($val =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/);
     872}
     873sub validID
     874{
     875    my $val = shift;
     876
     877    return 0 if !$val;
     878
     879    return  ! ($val =~ /\D/);
    862880}
    863881
Note: See TracChangeset for help on using the changeset viewer.