Changeset 954


Ignore:
Timestamp:
Mar 12, 2008, 5:38:17 PM (16 years ago)
Author:
mmc
Message:

Fixed the test for "library isvalid" to avoid an error that Joe Ringgenberg
found: If a choice value had a word like "split", it was executed as a Tcl
command during the "library isvalid" test to see if it responded as a
LibraryObj? object. If so, then it would be grafted on as a tree; otherwise,
it is put as a single text element. With any other text, this test would
fail. But "split" is a command and does not fail, but produces a non-boolean
result and causes another error. It's fixed now to look at the command
name and make sure that it at least looks like libraryObj##.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tcl/scripts/library.tcl

    r842 r954  
    4141        }
    4242        set obj [lindex $args 1]
    43         if {[catch {$obj isa ::Rappture::LibraryObj} valid] == 0 && $valid} {
     43        #
     44        # BE CAREFUL with the object test:
     45        # The command should look like a LibraryObj formed by #auto.
     46        # We want to avoid things like "split" or "set", which are
     47        # valid Tcl commands but won't respond well to isa.
     48        #
     49        if {[regexp {libraryObj[0-9]+$} $obj]
     50              && [catch {$obj isa ::Rappture::LibraryObj} valid] == 0
     51              && $valid} {
    4452            return 1
    4553        }
Note: See TracChangeset for help on using the changeset viewer.