@@ -226,7 +226,7 @@ def serviceClassToConfigKeys(serviceClassName: str) -> list[str]:
226226 candidates = []
227227
228228 # remove namespaces (namespaces are not part of any candidate)
229- try : serviceClassName = serviceClassName [: serviceClassName .index ('::' )]
229+ try : serviceClassName = serviceClassName [serviceClassName .rindex ('::' )+ 2 : ]
230230 except ValueError : pass # no namespace
231231
232232 if not serviceClassName : return [] # ?!
@@ -284,10 +284,10 @@ def readServiceConfig(getConfig, configKey, returnConfigKey = True):
284284 = tuple (base + suffix for base in serviceClassToConfigKeys (configKey ))
285285
286286 Logger .debug ("Configuration from candidates: '%s'" , "', '" .join (configKeys ))
287- for configKey in configKeys :
288- try : config = getConfig (configKey )
287+ for candidateKey in configKeys :
288+ try : config = getConfig (candidateKey )
289289 except Exception : continue
290- return (config , configKey ) if returnConfigKey else config
290+ return (config , candidateKey ) if returnConfigKey else config
291291 raise RuntimeError (f"No configuration for service key '{ configKey } '" )
292292# readServiceConfig()
293293
@@ -701,6 +701,8 @@ def fullConfig(self): return self.serviceTable is None
701701 def isValid (self ): return self .configPath is not None
702702 def hasExtraConfig (self ): return bool (self .extraConfig )
703703 def needsCustom (self ): return not self .fullConfig () or self .hasExtraConfig ()
704+ def serviceTableName (self ):
705+ return 'services' if self .fullConfig () else self .serviceTable
704706
705707 def addExtraConfig (self , extra ): self .extraConfig += "\n " + extra
706708
@@ -743,7 +745,15 @@ def get(self, serviceKey, interfaceClass = None):
743745 # get()
744746
745747
746- def defaultConfiguration (self ): return None
748+ def defaultConfiguration (self ):
749+ """Returns the default configuration.
750+
751+ The configuration is delivered as a ServiceManagerInstance.ConfigurationInfo object.
752+ This configuration is used when the service manager is not explicitly
753+ configured with `setConfiguration()`.
754+ """
755+ return ServiceManagerInstance .ConfigurationInfo ()
756+ # defaultConfiguration()
747757
748758 def setConfiguration (self , configFile , serviceTable = None , extra = "" ):
749759 """Sets which configuration to use for setup.
@@ -811,7 +821,7 @@ def loadConfiguration(self):
811821 '\n # ==============================='
812822 .format (
813823 configPath = configurationInfo .configPath ,
814- serviceTable = configurationInfo .serviceTable ,
824+ serviceTable = configurationInfo .serviceTableName () ,
815825 extraConfig = configurationInfo .extraConfig ,
816826 )
817827 )
0 commit comments