Revision: 1495 http://trac.macosforge.org/projects/calendarserver/changeset/1495 Author: dreid@apple.com Date: 2007-04-24 10:41:18 -0700 (Tue, 24 Apr 2007) Log Message: ----------- delete-trailing-whitespace Modified Paths: -------------- CalendarServer/trunk/twistedcaldav/tap.py Modified: CalendarServer/trunk/twistedcaldav/tap.py =================================================================== --- CalendarServer/trunk/twistedcaldav/tap.py 2007-04-23 23:36:02 UTC (rev 1494) +++ CalendarServer/trunk/twistedcaldav/tap.py 2007-04-24 17:41:18 UTC (rev 1495) @@ -99,9 +99,9 @@ def opt_option(self, option): """ - Set an option to override a value in the config file. True, False, int, + Set an option to override a value in the config file. True, False, int, and float options are supported, as well as comma seperated lists. Only - one option may be given for each --option flag, however multiple + one option may be given for each --option flag, however multiple --option flags may be specified. """ @@ -114,13 +114,13 @@ elif isinstance(defaultConfig[key], (int, float, long)): value = type(defaultConfig[key])(value) - + elif isinstance(defaultConfig[key], (list, tuple)): value = value.split(',') elif isinstance(defaultConfig[key], dict): raise UsageError("Dict options not supported on the command line") - + elif value == 'None': value = None @@ -142,7 +142,7 @@ uid, gid = None, None if self.parent['uid'] or self.parent['gid']: - uid, gid = getid(self.parent['uid'], + uid, gid = getid(self.parent['uid'], self.parent['gid']) if uid: @@ -176,7 +176,7 @@ #uname=config.UserName, #gname=config.GroupName ) - + # Verify that ssl certs exist if needed if config.SSLPort: self.checkFile( @@ -204,11 +204,11 @@ if oldmask != config.umask: log.msg("WARNING: changing umask from: 0%03o to 0%03o" % ( oldmask, config.umask,)) - + # Generate a shared secret that will be passed to any slave processes if not config.SharedSecret: c = tuple([random.randrange(sys.maxint) for _ in range(3)]) - config.SharedSecret = sha1('%d%d%d' % c).hexdigest() + config.SharedSecret = sha1('%d%d%d' % c).hexdigest() def checkDirectory(self, dirpath, description, access=None, fail=False, permissions=None, uname=None, gname=None): if not os.path.exists(dirpath): @@ -218,7 +218,7 @@ elif access and not os.access(dirpath, access): raise ConfigurationError("Insufficient permissions for server on %s directory: %s" % (description, dirpath,)) self.securityCheck(dirpath, description, fail=fail, permissions=permissions, uname=uname, gname=gname) - + def checkFile(self, filepath, description, access=None, fail=False, permissions=None, uname=None, gname=None): if not os.path.exists(filepath): raise ConfigurationError("%s does not exist: %s" % (description, filepath,)) @@ -250,7 +250,7 @@ except KeyError: raiseOrPrint("The owner of %s directory %s is unknown (%s) and does not match the expected owner: %s" % (description, path, pathstat[stat.ST_UID], uname)) - + if gname: import grp try: @@ -261,8 +261,8 @@ except KeyError: raiseOrPrint("The group of %s directory %s is unknown (%s) and does not match the expected group: %s" % (description, path, pathstat[stat.ST_GID], gname)) - + class CalDAVServiceMaker(object): implements(IPlugin, service.IServiceMaker) @@ -285,12 +285,12 @@ # Setup the Directory # directories = [] - + directoryClass = namedClass(config.DirectoryService['type']) - + log.msg("Configuring directory service of type: %s" % (config.DirectoryService['type'],)) - + baseDirectory = directoryClass(**config.DirectoryService['params']) directories.append(baseDirectory) @@ -300,7 +300,7 @@ if config.SudoersFile and os.path.exists(config.SudoersFile): log.msg("Configuring SudoDirectoryService with file: %s" % (config.SudoersFile,)) - + sudoDirectory = SudoDirectoryService(config.SudoersFile) sudoDirectory.realmName = baseDirectory.realmName @@ -321,7 +321,7 @@ # log.msg("Setting up document root at: %s" % (config.DocumentRoot,)) - + log.msg("Setting up principal collection: %r" % (self.principalResourceClass,)) principalCollection = self.principalResourceClass( @@ -337,11 +337,11 @@ directory, '/calendars/' ) - + log.msg("Setting up root resource: %r" % (self.rootResourceClass,)) - + root = self.rootResourceClass( - config.DocumentRoot, + config.DocumentRoot, principalCollections=(principalCollection,) ) @@ -358,12 +358,12 @@ davxml.Grant(davxml.Privilege(davxml.Read())), ), ] - + log.msg("Setting up AdminPrincipals") for principal in config.AdminPrincipals: log.msg("Added %s as admin principal" % (principal,)) - + rootACEs.append( davxml.ACE( davxml.Principal(davxml.HRef(principal)), @@ -395,10 +395,10 @@ scheme = scheme.lower() credFactory = None - + if schemeConfig['Enabled']: log.msg("Setting up scheme: %s" % (scheme,)) - + if scheme == 'kerberos': if not NegotiateCredentialFactory: log.msg("Kerberos support not available") @@ -410,7 +410,7 @@ rest, kerbRealm = service.split('@', 1) else: kerbRealm = config.ServerHostName - + credFactory = NegotiateCredentialFactory( service, kerbRealm @@ -452,7 +452,7 @@ # # Configure the service - # + # log.msg("Setting up service") @@ -525,8 +525,8 @@ raise UsageError("Unknown server type %s. Please choose: Master, Slave or Combined" % (serverType,)) else: - service = serviceMethod(options) - + service = serviceMethod(options) + # Temporary hack to work around SIGHUP problem # If there is a stopped process in the same session as the calendar server # and the calendar server is the group leader then when twistd forks to drop