########################################################################
#
# This file contains actions for objects of the CosNaming::NamingContext
# type.
#
########################################################################

import NSTools

########################################################################
# lists the contain of a NamingContext
########################################################################

old_cat = cat

proc cat(aNamingContext)
{
  old_cat(aNamingContext)

  ns = NSTools.NSAdmin(aNamingContext)
  names=ns.ls("/")
  for n in names {
    print(n, "\n  ")
    applyAction("cat",ns.resolve(n))
  }
}

declareAction("cat", cat, "lists the contain")

########################################################################
# removes all the contain of a NamingContext
########################################################################

proc rm_all(aNamingContext)
{
  ns = NSTools.NSAdmin(aNamingContext)
  names=ns.ls("/")
  for n in names
    ns.rm(n)
}

declareAction("rm_all", rm_all, "removes all the contain")

########################################################################
