Changeset 647 for trunk/tcl/scripts
- Timestamp:
- Mar 28, 2007, 2:16:50 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tcl/scripts/library.tcl
r115 r647 447 447 return "" 448 448 } 449 return [string trim [ $node text]]450 } 451 452 # ---------------------------------------------------------------------- 453 # USAGE: put ?-append yes? ?-id num? ? <path>? <string>449 return [string trim [Rappture::encoding::decode [$node text]]] 450 } 451 452 # ---------------------------------------------------------------------- 453 # USAGE: put ?-append yes? ?-id num? ?-type string|file? ?-compress no? ?<path>? <string> 454 454 # 455 455 # Clients use this to set the value of a node. If the path is not … … 469 469 -id "" 470 470 -append no 471 -type string 472 -compress no 471 473 } 472 474 while {[llength $args] > 1} { … … 484 486 } 485 487 if {[llength $args] > 2} { 486 error "wrong # args: should be \"put ?-append bval? ?-id num? ? path? string\""488 error "wrong # args: should be \"put ?-append bval? ?-id num? ?-type string|file? ?-compress bval? ?path? string\"" 487 489 } 488 490 if {[llength $args] == 2} { … … 493 495 set str [lindex $args 0] 494 496 } 497 498 if {$params(-type) == "file"} { 499 set fileName $str 500 set fid [open $fileName r] 501 fconfigure $fid -translation binary 502 set str [read $fid] 503 close $fid 504 } 505 506 if {$params(-compress) || [Rappture::encoding::is binary $str]} { 507 set str [Rappture::encoding::encode $str] 508 } 509 495 510 set node [find -create $path] 496 511
Note: See TracChangeset
for help on using the changeset viewer.