summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorChristoph Erhardt <kolab@sicherha.de>2022-03-13 20:31:19 +0100
committerChristoph Erhardt <kolab@sicherha.de>2022-03-13 20:31:38 +0100
commit1aeaee3ca41aa909bf994032ddae2d8d1592054e (patch)
treec8e518a3dee1a4405e1f041ed255f3fb6b18650e /pykolab
parent4284cf68711b43f5702c375951eb00ff98143f00 (diff)
downloadpykolab-1aeaee3ca41aa909bf994032ddae2d8d1592054e.tar.gz
[Python 3]basestring to six string_types
Summary: Using for compatibility from six import string_types and "string_types" for "basestring" as it is still used in pykolab/utils.py Reviewers: #pykolab, #pykolab_developers, sicherha Reviewed By: #pykolab_developers, sicherha Subscribers: sicherha Differential Revision: https://git.kolab.org/D3403
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/cli/cmd_add_alias.py3
-rw-r--r--pykolab/cli/cmd_remove_mailaddress.py3
-rw-r--r--pykolab/cli/commands.py3
-rw-r--r--pykolab/cli/sieve/cmd_refresh.py3
-rw-r--r--pykolab/imap/__init__.py4
-rw-r--r--pykolab/plugins/sievemgmt/__init__.py3
-rw-r--r--pykolab/setup/components.py3
-rw-r--r--pykolab/xml/contact.py6
-rw-r--r--pykolab/xml/event.py6
9 files changed, 22 insertions, 12 deletions
diff --git a/pykolab/cli/cmd_add_alias.py b/pykolab/cli/cmd_add_alias.py
index 16fa590..81ca005 100644
--- a/pykolab/cli/cmd_add_alias.py
+++ b/pykolab/cli/cmd_add_alias.py
@@ -18,6 +18,7 @@
#
from __future__ import print_function
+from six import string_types
import sys
@@ -110,7 +111,7 @@ def execute(*args, **kw):
if secondary_rcpt_attr not in primary_recipient:
auth.set_entry_attributes(primary_rcpt_domain, primary_recipient_dn, {secondary_rcpt_attr: [ secondary_rcpt_address ] })
else:
- if isinstance(primary_recipient[secondary_rcpt_attr], basestring):
+ if isinstance(primary_recipient[secondary_rcpt_attr], string_types):
new_secondary_rcpt_attrs = [
primary_recipient[secondary_rcpt_attr],
secondary_rcpt_address
diff --git a/pykolab/cli/cmd_remove_mailaddress.py b/pykolab/cli/cmd_remove_mailaddress.py
index 10d9a19..120c2d9 100644
--- a/pykolab/cli/cmd_remove_mailaddress.py
+++ b/pykolab/cli/cmd_remove_mailaddress.py
@@ -18,6 +18,7 @@
#
from __future__ import print_function
+from six import string_types
import sys
@@ -67,7 +68,7 @@ def execute(*args, **kw):
log.debug(_("Using the following mail attributes: %r") % (mail_attributes), level=8)
- if isinstance(recipients, basestring):
+ if isinstance(recipients, string_types):
recipient = recipients
# Only a single recipient found, remove the address
diff --git a/pykolab/cli/commands.py b/pykolab/cli/commands.py
index a1e9b0c..29e327d 100644
--- a/pykolab/cli/commands.py
+++ b/pykolab/cli/commands.py
@@ -16,6 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+from six import string_types
import os
import sys
@@ -160,7 +161,7 @@ def register(cmd_name, func, group=None, description=None, aliases=[]):
else:
command = cmd_name
- if isinstance(aliases, basestring):
+ if isinstance(aliases, string_types):
aliases = [aliases]
if command in commands:
diff --git a/pykolab/cli/sieve/cmd_refresh.py b/pykolab/cli/sieve/cmd_refresh.py
index ec0ac65..abb93ae 100644
--- a/pykolab/cli/sieve/cmd_refresh.py
+++ b/pykolab/cli/sieve/cmd_refresh.py
@@ -16,6 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+from six import string_types
import pykolab
@@ -215,7 +216,7 @@ def execute(*args, **kw):
if not forward_active == False:
forward_address_attr = conf.get('sieve', 'forward_address_attr')
if forward_address_attr in user:
- if isinstance(user[forward_address_attr], basestring):
+ if isinstance(user[forward_address_attr], string_types):
forward_addresses = [ user[forward_address_attr] ]
elif isinstance(user[forward_address_attr], str):
forward_addresses = [ user[forward_address_attr] ]
diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index 9cea0d9..e5ecfa8 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-
+from six import string_types
import logging
import re
@@ -906,7 +906,7 @@ class IMAP(object):
return
- if isinstance(acls, basestring):
+ if isinstance(acls, string_types):
acls = [ acls ]
old_acls = None
diff --git a/pykolab/plugins/sievemgmt/__init__.py b/pykolab/plugins/sievemgmt/__init__.py
index 02f5daa..772165d 100644
--- a/pykolab/plugins/sievemgmt/__init__.py
+++ b/pykolab/plugins/sievemgmt/__init__.py
@@ -16,6 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+from six import string_types
import pykolab
@@ -227,7 +228,7 @@ class KolabSievemgmt(object):
if not forward_active == False:
forward_address_attr = conf.get('sieve', 'forward_address_attr')
if forward_address_attr in user:
- if isinstance(user[forward_address_attr], basestring):
+ if isinstance(user[forward_address_attr], string_types):
forward_addresses = [ user[forward_address_attr] ]
elif isinstance(user[forward_address_attr], str):
forward_addresses = [ user[forward_address_attr] ]
diff --git a/pykolab/setup/components.py b/pykolab/setup/components.py
index 49a4f65..e865015 100644
--- a/pykolab/setup/components.py
+++ b/pykolab/setup/components.py
@@ -17,6 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+from six import string_types
import os
@@ -224,7 +225,7 @@ def register(component_name, func, group=None, description=None, aliases=[], aft
else:
component = component_name
- if isinstance(aliases, basestring):
+ if isinstance(aliases, string_types):
aliases = [aliases]
if component in components:
diff --git a/pykolab/xml/contact.py b/pykolab/xml/contact.py
index 7b0a2a7..9a6fd99 100644
--- a/pykolab/xml/contact.py
+++ b/pykolab/xml/contact.py
@@ -1,3 +1,5 @@
+from six import string_types
+
import kolabformat
import datetime
import pytz
@@ -133,13 +135,13 @@ class Contact(kolabformat.Contact):
return [x for x in self.emailAddresses()]
def set_email(self, email, preferred_index=0):
- if isinstance(email, basestring):
+ if isinstance(email, string_types):
self.setEmailAddresses([email], preferred_index)
else:
self.setEmailAddresses(email, preferred_index)
def add_email(self, email):
- if isinstance(email, basestring):
+ if isinstance(email, string_types):
self.add_emails([email])
elif isinstance(email, list):
self.add_emails(email)
diff --git a/pykolab/xml/event.py b/pykolab/xml/event.py
index a80fe20..3b4fb29 100644
--- a/pykolab/xml/event.py
+++ b/pykolab/xml/event.py
@@ -1,3 +1,5 @@
+from six import string_types
+
import datetime
import icalendar
import kolabformat
@@ -394,7 +396,7 @@ class Event(object):
return attendee.get_participant_status()
def get_attendee(self, attendee):
- if isinstance(attendee, basestring):
+ if isinstance(attendee, string_types):
if attendee in [x.get_email() for x in self.get_attendees()]:
attendee = self.get_attendee_by_email(attendee)
@@ -892,7 +894,7 @@ class Event(object):
getattr(self, default_setter)(value)
def set_ical_attendee(self, _attendee):
- if isinstance(_attendee, basestring):
+ if isinstance(_attendee, string_types):
_attendee = [_attendee]
if isinstance(_attendee, list):