view roundup/support.py @ 3441:5791c9e6ab24

Fixes for SourceForge tracker items. - favicon.ico image may be changed with server config option (patch [SF#1355661]) - Password objects initialized from plaintext remember plaintext value (rfe [SF#1379447]) - use quoted printable encoding for nosy attachments that have MIME type 'text/plain' but contain 8-bit characters [SF#1381559]
author Alexander Smishlajev <a1s@users.sourceforge.net>
date Sun, 25 Dec 2005 16:24:11 +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/