Changeset View
Changeset View
Standalone View
Standalone View
pykolab/cli/cmd_set_quota.py
Show All 11 Lines | |||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
# GNU Library General Public License for more details. | # GNU Library 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, write to the Free Software | # along with this program; if not, write to the Free Software | ||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||||
# | # | ||||
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) | ||||
sys.exit(1) | sys.exit(1) | ||||
for _folder in imap.lm(imap.folder_utf7(folder)): | for _folder in imap.lm(imap.folder_utf7(folder)): | ||||
imap.set_quota(_folder, quota) | imap.set_quota(_folder, quota) | ||||
print >> sys.stdout, "Quota for folder '%s' set to %d" % (_folder, int(quota)) | print("Quota for folder '%s' set to %d" % (_folder, int(quota)), file=sys.stdout) | ||||