Index: openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl,v diff -u -r1.17.2.3 -r1.17.2.4 --- openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl 16 Dec 2002 12:03:40 -0000 1.17.2.3 +++ openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl 2 Feb 2003 21:19:26 -0000 1.17.2.4 @@ -142,9 +142,15 @@ ad_proc -public get_from_url { {-url:required} + {-exact:boolean} } { - returns an array representing the site node that matches the given url + Returns an array representing the site node that matches the given url.

+ A trailing '/' will be appended to $url if required and not present.

+ + If the '-exact' switch is not present and $url is not found, returns the + first match found by successively removing the trailing $url path component.

+ @see site_node::get } { # attempt an exact match @@ -162,18 +168,20 @@ } # chomp off part of the url and re-attempt - while {![empty_string_p $url]} { - set url [string trimright $url /] - set url [string range $url 0 [string last / $url]] + if {!$exact_p} { + while {![empty_string_p $url]} { + set url [string trimright $url /] + set url [string range $url 0 [string last / $url]] - if {[nsv_exists site_nodes $url]} { - array set node [nsv_get site_nodes $url] + if {[nsv_exists site_nodes $url]} { + array set node [nsv_get site_nodes $url] - if {[string equal $node(pattern_p) t] && ![empty_string_p $node(object_id)]} { - return [array get node] - } - } - } + if {[string equal $node(pattern_p) t] && ![empty_string_p $node(object_id)]} { + return [array get node] + } + } + } + } error "site node not found at url $url" }