[Xotcl] Default-value substitution using substdefault
Maksym Zinchenko
siqsuruq at gmail.com
Fri Aug 12 16:25:22 CEST 2022
Hello, I'm having trouble to define "srv" property in my superclass with
default value from Naviserver command, may be Im doing smth wrong, would be
so kind to help:
nx::Class create dz_superclass {
> :property identifier
> :property {srv,substdefault=0b111: {[ns_info server]}}
> :method init {} {
> set :uuid ""
> if {[[current object] info vars identifier] eq ""} {
> set :identifier ""
> } else {
> if {[is_uuid ${:identifier}] == 1} {
> set :uuid ${:identifier}
> }
> }
> }
> }
nx::Class create dz_class -superclass dz_superclass {
> :method init {} {
> if {${:identifier} ne ""} {
> set :obj_data [dict getnull [select_all client *
> uuid_client=\'${:identifier}\'] 0]
> }
> }
> }
>
When I create object:
> dz_class create o1 -identifier 67720c6d-d00f-479b-85cf-4edaa5a9cb1a
>
o1 cget -srv
>
Im getting literal "[ns_info server]" instead of my virtual server name
> [ns_info server]
>
Thank you
More information about the Xotcl
mailing list