set_behavior#
method
- classmethod Service.set_behavior(instance_mode: str = 'session', instance_creator: Callable | None = None) None[source]#
Sets the Pyro5 behavior for the class (modified in place).
Equivalent to using the
behaviordecorator on the class, but can be used dynamically during runtime. Services that specify some default behavior in the source code can be overridden using this function.- Parameters:
- instance_modestr
One of “session”, “single”, or “percall” (see manual for differences).
- instance_creatorcallable
A callable that creates a new instance of the class (see manual for more details).
- Raises:
- ValueError
If
instance_modeis not one of “session”, “single”, or “percall”.- TypeError
If
instance_modeis not a string orinstance_creatoris defined but is not callable.