summaryrefslogtreecommitdiffstats
path: root/ufo/gluster/swift/common/constraints.py
diff options
context:
space:
mode:
authorPeter Portante <peter.portante@redhat.com>2013-04-04 13:08:32 -0400
committerPeter Portante <peter.portante@redhat.com>2013-04-29 16:35:57 -0400
commitca97ef5f52640b734140fb273647b8fc03835554 (patch)
treedf600377a3f53c96e509d718e81adf696ba171b7 /ufo/gluster/swift/common/constraints.py
parent9d520a05baf91cdbed17e31a15dcbce0d35191d0 (diff)
object-storage: use tox for unit tests; fix em too
Add the ability to use tox for unit tests, since it helps us solve the problem of supporting multiple branches that require different versions of dependencies, and allows us to possibly support multiple versions of python in the future. Also fix the code to work with pre-grizzly environments, by not requiring the constraints backport. Also fixed the xattr support to work with both pyxattr and xattr modules. And fixed the ring tests to also work without a live /etc/swift directory. BUG: 948657 (https://bugzilla.redhat.com/show_bug.cgi?id=948657) Change-Id: I2be79c8ef8916bb6552ef957094f9186a963a068 Signed-off-by: Peter Portante <peter.portante@redhat.com> Reviewed-on: http://review.gluster.org/4781 Reviewed-by: Alex Wheeler <wheelear@gmail.com> Tested-by: Alex Wheeler <wheelear@gmail.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'ufo/gluster/swift/common/constraints.py')
-rw-r--r--ufo/gluster/swift/common/constraints.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/ufo/gluster/swift/common/constraints.py b/ufo/gluster/swift/common/constraints.py
index dd8662a..11f626b 100644
--- a/ufo/gluster/swift/common/constraints.py
+++ b/ufo/gluster/swift/common/constraints.py
@@ -13,15 +13,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from webob.exc import HTTPBadRequest
-
+try:
+ from webob.exc import HTTPBadRequest
+except ImportError:
+ from swift.common.swob import HTTPBadRequest
import swift.common.constraints
import swift.common.ring as _ring
from gluster.swift.common import Glusterfs, ring
-
-MAX_OBJECT_NAME_COMPONENT_LENGTH = swift.common.constraints.constraints_conf_int(
- 'max_object_name_component_length', 255)
+if hasattr(swift.common.constraints, 'constraints_conf_int'):
+ MAX_OBJECT_NAME_COMPONENT_LENGTH = \
+ swift.common.constraints.constraints_conf_int(
+ 'max_object_name_component_length', 255)
+else:
+ MAX_OBJECT_NAME_COMPONENT_LENGTH = 255
def validate_obj_name_component(obj):
if len(obj) > MAX_OBJECT_NAME_COMPONENT_LENGTH: