view roundup/support.py @ 3151:6feac4fcf883

Various bug fixes. - fix handling of invalid date input [SF#1102165] - retain Boolean selections in edit error handling [SF#1101492] - fix bug in date editing in Metakit - fixed up date spec usage string - note python 2.3 requirement in announcement and installation docs
author Richard Jones <richard@users.sourceforge.net>
date Mon, 14 Feb 2005 00:06:55 +0000
parents 293a17149765
children a2ae11191968
line wrap: on
line source

"""Implements various support classes and functions used in a number of
places in Roundup code.
"""

__docformat__ = 'restructuredtext'

import os

class TruthDict:
    '''Returns True for valid keys, False for others.
    '''
    def __init__(self, keys):
        if keys:
            self.keys = {}
            for col in keys:
                self.keys[col] = 1
        else:
            self.__getitem__ = lambda name: 1

    def __getitem__(self, name):
        return self.keys.has_key(name)

def ensureParentsExist(dest):
    if not os.path.exists(os.path.dirname(dest)):
        os.makedirs(os.path.dirname(dest))

# vim: set et sts=4 sw=4 :

Roundup Issue Tracker: http://roundup-tracker.org/