This patch splits get_transport into:
- get_transport: Basic transport loading that does not depend
on a request.
- get_transport_for: Transport loading based on a request object.
Partially-Implements blueprint python-marconiclient-v1
Change-Id: Id1adfb3fc3d2914bf81e4b204ca3eae82a42b94d
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
# Copyright 2013 Red Hat, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
__all__ = ['MarconiError', 'InvalidOperation']
|
|
|
|
|
|
class MarconiError(Exception):
|
|
"""Base class for errors."""
|
|
|
|
|
|
class DriverLoadFailure(MarconiError):
|
|
"""Raised if a transport driver can't be loaded."""
|
|
|
|
def __init__(self, driver, ex):
|
|
msg = 'Failed to load transport driver "%s": %s' % (driver, ex)
|
|
super(DriverLoadFailure, self).__init__(msg)
|
|
self.driver = driver
|
|
self.ex = ex
|
|
|
|
|
|
class InvalidOperation(MarconiError):
|
|
"""Raised when attempted a non existent operation."""
|