This commit is contained in:
John Dennis committed 2007-12-04 10:08:08 -05:00
commit d53915954e
45 files changed
+370 -135

No files matched your search

+3
View File
@@ -17,6 +17,9 @@ clean:
distclean: clean
maintainer-clean: distclean
rm -rf build
.PHONY: test
test: $(subst .py,.tst,$(TESTS))
+15
View File
@@ -162,3 +162,18 @@ CONNECTION_UNWILLING = gen_error_code(
CONNECTION_CATEGORY,
0x0004,
"Account inactivated. Server is unwilling to perform.")
#
# Configuration errors
#
CONFIGURATION_CATEGORY = 0x0004
CONFIG_REQUIRED_GROUPS = gen_error_code(
CONFIGURATION_CATEGORY,
0x0001,
"The admins and editors groups are required.")
CONFIG_DEFAULT_GROUP = gen_error_code(
CONFIGURATION_CATEGORY,
0x0002,
"You cannot remove the default users group.")
+17 -1
View File
@@ -36,6 +36,22 @@ from string import lower
import re
import xmlrpclib
import datetime
try:
from subprocess import CalledProcessError
class CalledProcessError(subprocess.CalledProcessError):
def __init__(self, returncode, cmd):
super(CalledProcessError, self).__init__(returncode, cmd)
except ImportError:
# Python 2.4 doesn't implement CalledProcessError
class CalledProcessError(Exception):
"""This exception is raised when a process run by check_call() returns
a non-zero exit status. The exit status will be stored in the
returncode attribute."""
def __init__(self, returncode, cmd):
self.returncode = returncode
self.cmd = cmd
def __str__(self):
return "Command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode)
def realm_to_suffix(realm_name):
s = realm_name.split(".")
@@ -66,7 +82,7 @@ def run(args, stdin=None):
logging.info(stderr)
if p.returncode != 0:
raise subprocess.CalledProcessError(p.returncode, ' '.join(args))
raise self.CalledProcessError(p.returncode, ' '.join(args))
def file_exists(filename):
try: