# HG changeset patch # User RhodeCode Admin # Date 2023-03-10 09:08:05 # Node ID 70c118757292950034671a9d50bad096ec833425 # Parent 52946ecccae0b166fc135219e4937c0b517f3104 vcs-connection: report problems more explicitly if connections are not established and we want to use it diff --git a/rhodecode/lib/vcs/connection.py b/rhodecode/lib/vcs/connection.py --- a/rhodecode/lib/vcs/connection.py +++ b/rhodecode/lib/vcs/connection.py @@ -23,15 +23,23 @@ Holds connection for remote server. """ -def _not_initialized(*args, **kwargs): +class NotInitializedConnection(object): """Placeholder for objects which have to be initialized first.""" - raise Exception( - "rhodecode.lib.vcs is not yet initialized. " - "Make sure `vcs.server` is enabled in your configuration.") + + def _raise_exc(self): + raise Exception( + "rhodecode.lib.vcs is not yet initialized. " + "Make sure `vcs.server` is enabled in your configuration.") + + def __getattr__(self, item): + self._raise_exc() + + def __call__(self, *args, **kwargs): + self._raise_exc() # TODO: figure out a nice default value for these things -Service = _not_initialized +Service = NotInitializedConnection() -Git = _not_initialized -Hg = _not_initialized -Svn = _not_initialized +Git = NotInitializedConnection() +Hg = NotInitializedConnection() +Svn = NotInitializedConnection()