view test/mocknull.py @ 2631:2bbcfc80ba5b

MailGW.handle_message(): as config is used many times in this method, have a local variable instead of going through self.instance.config each time; change config attribute access to container (item) access; where possible, avoid duplicate computing of config settings; fix MAILGW_KEEP_QUOTED_TEXT and MAILGW_LEAVE_BODY_UNCHANGED - config values are boolean now; trim trailing spaces, fix vim modeline
author Alexander Smishlajev <a1s@users.sourceforge.net>
date Mon, 26 Jul 2004 09:29:22 +0000
parents 24d3b25a9157
children 79fd8537ae3b
line wrap: on
line source


class MockNull:
    def __init__(self, **kwargs):
        for key, value in kwargs.items():
            self.__dict__[key] = value

    def __call__(self, *args, **kwargs): return MockNull()
    def __getattr__(self, name):
        # This allows assignments which assume all intermediate steps are Null
        # objects if they don't exist yet.
        #
        # For example (with just 'client' defined):
        #
        # client.db.config.TRACKER_WEB = 'BASE/'
        self.__dict__[name] = MockNull()
        return getattr(self, name)

    def __getitem__(self, key): return self
    def __nonzero__(self): return 0
    def __str__(self): return ''
    def __repr__(self): return '<MockNull 0x%x>'%id(self)

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