Ignore:
Timestamp:
Jun 10, 2008, 6:52:04 PM (16 years ago)
Author:
mmc
Message:

Fixed the Rappture::encoding::encode and decode operations to honor "--".
This is handy when the string may start with a dash, as in:

Rappture::encoding::encode -- -hi

Fixed the library.tcl code to guard against encode/decode problem by
using the "--" in front of strings obtained from the xml.

Cleaned up the tests for the Rappture::LibraryObj? class. Everything
works properly now, except for units. Some of the tests are failing
because the units code reports "length" instead of "area" (test finds
this problem). This should be fixed in the units code.

File:
1 edited

Legend:

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

    r1018 r1042  
    347347    }
    348348    set node [$node parentNode]
     349    if {$node == ""} {
     350        return ""
     351    }
    349352
    350353    switch -- $params(-as) {
     
    453456      }
    454457      default {
    455           error "bad flavor \"$params(-as)\": should be component, id, object, type"
     458          error "bad flavor \"$params(-as)\": should be component, id, object, path, type"
    456459      }
    457460    }
     
    502505    }
    503506    if {$params(-decode) == "yes"} {
    504         return [Rappture::encoding::decode [string trim [$node text]]]
     507        return [Rappture::encoding::decode -- [string trim [$node text]]]
    505508    } else {
    506509        return [string trim [$node text]]
     
    543546        }
    544547    }
    545     if {[llength $args] > 2} {
     548    if {[llength $args] < 1 || [llength $args] > 2} {
    546549        error "wrong # args: should be \"put ?-append bval? ?-id num? ?-type string|file? ?-compress bval? ?path? string\""
    547550    }
     
    563566
    564567    if {$params(-compress) || [Rappture::encoding::is binary $str]} {
    565         set str [Rappture::encoding::encode $str]
     568        set str [Rappture::encoding::encode -- $str]
    566569    }
    567570
Note: See TracChangeset for help on using the changeset viewer.