summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/auth/ldap/auth_cache.py12
-rw-r--r--pykolab/cli/__init__.py6
-rw-r--r--pykolab/cli/cmd_delete_mailbox_acl.py4
-rw-r--r--pykolab/conf/__init__.py4
-rw-r--r--pykolab/imap/__init__.py12
-rw-r--r--pykolab/wap_client/__init__.py5
6 files changed, 31 insertions, 12 deletions
diff --git a/pykolab/auth/ldap/auth_cache.py b/pykolab/auth/ldap/auth_cache.py
index 41ef438..717d079 100644
--- a/pykolab/auth/ldap/auth_cache.py
+++ b/pykolab/auth/ldap/auth_cache.py
@@ -25,8 +25,8 @@ from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy import Integer
from sqlalchemy import MetaData
-from sqlalchemy import String
-from sqlalchemy import Text
+from sqlalchemy import Unicode
+from sqlalchemy import UnicodeText
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
@@ -62,9 +62,9 @@ class Entry(DeclarativeBase):
__tablename__ = 'entries'
id = Column(Integer, primary_key=True)
- domain = Column(String(256), index=True, nullable=True)
- key = Column(Text, index=True, nullable=False)
- value = Column(Text, nullable=False)
+ domain = Column(Unicode(256), index=True, nullable=True)
+ key = Column(UnicodeText, index=True, nullable=False)
+ value = Column(UnicodeText, nullable=False)
last_change = Column(DateTime, nullable=False, default=datetime.datetime.now())
def __init__(self, key, value):
@@ -134,7 +134,7 @@ def get_entry(key):
log.debug("Entry found: %r" % (__entries[0].__dict__))
log.debug("Returning: %r" % (__entries[0].value))
- return __entries[0].value.encode('utf-8', 'latin1')
+ return __entries[0].value
def set_entry(key, value):
diff --git a/pykolab/cli/__init__.py b/pykolab/cli/__init__.py
index 3aafd03..2b3c511 100644
--- a/pykolab/cli/__init__.py
+++ b/pykolab/cli/__init__.py
@@ -16,7 +16,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-
+try:
+ # Python 2: "reload" is built-in
+ reload
+except NameError:
+ from importlib import reload
import ldap
import ldif
import logging
diff --git a/pykolab/cli/cmd_delete_mailbox_acl.py b/pykolab/cli/cmd_delete_mailbox_acl.py
index c15f85b..e4c1d62 100644
--- a/pykolab/cli/cmd_delete_mailbox_acl.py
+++ b/pykolab/cli/cmd_delete_mailbox_acl.py
@@ -48,7 +48,7 @@ def execute(*args, **kw):
except IndexError:
folder = utils.ask_question(_("Folder name"))
- quota = utils.ask_question(_("ACI Subject"))
+ identifier = utils.ask_question(_("ACI Subject"))
if len(folder.split('@')) > 1:
domain = folder.split('@')[1]
@@ -65,7 +65,7 @@ def execute(*args, **kw):
folders = imap.list_folders(folder)
for folder in folders:
try:
- imap.set_acl(folder, identifier, '')
+ imap.del_acl(folder, identifier)
except:
# Mailbox no longer exists?
pass
diff --git a/pykolab/conf/__init__.py b/pykolab/conf/__init__.py
index 5628488..ca19ac9 100644
--- a/pykolab/conf/__init__.py
+++ b/pykolab/conf/__init__.py
@@ -109,8 +109,8 @@ class Conf(object):
for option in self.cli_keywords.__dict__:
retval = False
if hasattr(self, "check_setting_%s" % (option)):
- exec(
- "retval = self.check_setting_%s(%r)" % (
+ retval = eval(
+ "self.check_setting_%s(%r)" % (
option,
self.cli_keywords.__dict__[option]
)
diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index 171e4e5..a773bfc 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -435,6 +435,18 @@ class IMAP(object):
)
)
+ def del_acl(self, folder, identifier):
+ try:
+ self.imap.dam(self.folder_utf7(folder), identifier)
+ except Exception as errmsg:
+ log.error(
+ _("Could not delete ACL for %s on folder %s: %r") % (
+ identifier,
+ folder,
+ errmsg
+ )
+ )
+
def set_metadata(self, folder, metadata_path, metadata_value, shared=True):
"""
Set a metadata entry on a folder
diff --git a/pykolab/wap_client/__init__.py b/pykolab/wap_client/__init__.py
index f8427c0..176ac91 100644
--- a/pykolab/wap_client/__init__.py
+++ b/pykolab/wap_client/__init__.py
@@ -1,6 +1,9 @@
import json
-import httplib
+try:
+ import httplib
+except ImportError:
+ import http.client as httplib
import urllib
import sys
try: