#! /usr/bin/env python3
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
from SALOME_utilities import *
#=============================================================================
-class SALOME_NamingServicePy_i(object):
+class SALOME_NamingServicePy_i:
"""
A class to manage SALOME naming service from python code
"""
#-------------------------------------------------------------------------
- def __init__(self, orb=None):
+ def __init__(self, orb=None, steps=240, spy=False):
"""
Standard Constructor, with ORB reference.
self._orb = orb
# initialize root context and current context
ok = 0
- steps = 240
while steps > 0 and ok == 0:
try:
obj =self._orb.resolve_initial_references("NameService")
steps = steps - 1
if steps == 0 and self._root_context is None:
MESSAGE ( "Name Service Reference is invalid" )
- sys.exit(1)
+ if spy:
+ raise ValueError("Name Service Reference is invalid")
+ else:
+ sys.exit(1)
#-------------------------------------------------------------------------