Changeset View
Changeset View
Standalone View
Standalone View
pykolab/cli/cmd_delete_mailbox_acl.py
Show All 11 Lines | |||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
# GNU General Public License for more details. | # GNU General Public License for more details. | ||||
# You should have received a copy of the GNU General Public License | # You should have received a copy of the GNU General Public License | ||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
# | # | ||||
from __future__ import print_function | |||||
import sys | import sys | ||||
import commands | import commands | ||||
import pykolab | import pykolab | ||||
from pykolab.imap import IMAP | from pykolab.imap import IMAP | ||||
from pykolab.translate import _ | from pykolab.translate import _ | ||||
Show All 24 Lines | if len(folder.split('@')) > 1: | ||||
domain = folder.split('@')[1] | domain = folder.split('@')[1] | ||||
else: | else: | ||||
domain = conf.get('kolab', 'primary_domain') | domain = conf.get('kolab', 'primary_domain') | ||||
imap = IMAP() | imap = IMAP() | ||||
imap.connect(domain=domain) | imap.connect(domain=domain) | ||||
if not imap.has_folder(folder): | if not imap.has_folder(folder): | ||||
print >> sys.stderr, _("No such folder %r") % (folder) | print(_("No such folder %r") % (folder), file=sys.stderr) | ||||
else: | else: | ||||
folders = imap.list_folders(folder) | folders = imap.list_folders(folder) | ||||
for folder in folders: | for folder in folders: | ||||
try: | try: | ||||
imap.set_acl(folder, identifier, '') | imap.set_acl(folder, identifier, '') | ||||
except: | except: | ||||
# Mailbox no longer exists? | # Mailbox no longer exists? | ||||
pass | pass |