Dear Maksym,

On 15.09.23 01:09, Maksym Zinchenko wrote:
Hello, I've been struggling with a problem for a few days now. First I thought it's something with my understanding of NX, but I think its has to do something with Naviserver.

actually, the problem is not with NaviServer, but it is rooted in the XOTcl/NX serializer. When a NaviServer blueprint is created, NaviServer performs "::Serializer all" to serialize the current workspace. Actually, it does not serialize the full workspace, since the workspace contains as well the NX internal class definitions. Therefore, the serializer has "ignore patterns", including everything from, e.g., the "::ns"f namespace [1].

When objects are created with "new", these are named by default "::nsf::__#1", "::nsf::__#2". These names match the ignore pattern, and therefore, these names are excluded from the blueprint.

If you create the objects in your code with the "-childof" flag (see below), you can place these outside the "::nsf" namespace, and everything should be fine

Hope this helps

-g


[1] https://github.com/gustafn/nsf/blob/master/library/serialize/serializer.tcl#L868


    nx::Class create B {
        :method init {} {
            ns_log notice "Im class [self]"
        }
    }

    nx::Class create C {
        :method init {} {
            ns_log notice "Im class [self]"
        }
    }

    nx::Class create A {
        :property -accessor public inBObj:object
        :property -accessor public inCObj:object

        :method init {} {
            set :inBObj [B new -childof [::nsf::current object]]
            set :inCObj [C new -childof [::nsf::current object]]
        }

        :public method myObjs {} {
            ns_log notice  "My B obj is: [${:inBObj} info name]"
            ns_log notice  "My C obj is: [${:inCObj} info name]"
        }
    }


_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to