VirtualMailManager/pycompat.py
author Pascal Volk <neverseen@users.sourceforge.net>
Sat, 27 Feb 2010 21:36:55 +0000
branchv0.6.x
changeset 221 371ae0b4443d
parent 219 0b6ce895e1dc
child 224 7e9874a50d92
permissions -rw-r--r--
VMM/Alias: renamed Alias.add_destination() to add_destinations(). Now it's possible to add one ore more destinations to the alias with a single method call. VMM/Handler: adjusted Handler.aliasAdd() to the API changes of the Alias class. Also use get_gid from the Domain module to get the gid of a domain. We don't need complete Domain object, only the gid. Handler.getWarnings(): no longer return the __warnings list. Return a copy instead and empty the Handler.__warnings list.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
219
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     1
# -*- coding: UTF-8 -*-
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     2
# Copyright (c) 2010, Pascal Volk
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     3
# See COPYING for distribution information.
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     4
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     5
"""
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     6
    VirtualMailManager.pycompat
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     7
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     8
    VirtualMailManager's compatibility stuff for Python 2.4
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     9
"""
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    10
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    11
# http://docs.python.org/library/functions.html#all
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    12
try:
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    13
    all = all
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    14
except NameError:
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    15
    def all(iterable):
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    16
        """Return True if all elements of the *iterable* are true
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    17
        (or if the iterable is empty).
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    18
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    19
        """
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    20
        for element in iterable:
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    21
            if not element:
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    22
                return False
0b6ce895e1dc VMM/pycompat: added to the repository. Provides all() for Py24.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    23
        return True