summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-05-30 11:29:22 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-05-30 11:29:22 +0100
commit4530feff0597df2316df2a7f9cbf86b2855b4cb1 (patch)
treec98bd30aa7223fc3fbbba6e197f4912481ace2b1
parentfc0513b603e4e0c64cafd1e6b70f73f9096c5ad3 (diff)
parentad24c6538fc819dde8c99819e05ab546cc4023a7 (diff)
downloadpykolab-4530feff0597df2316df2a7f9cbf86b2855b4cb1.tar.gz
Merge branch 'master' of ssh://git.kolabsys.com/git/pykolab
-rw-r--r--pykolab/auth/ldap/__init__.py8
-rw-r--r--pykolab/xml/event.py76
-rw-r--r--tests/functional/user_add.py7
3 files changed, 84 insertions, 7 deletions
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 3101217..4df0aa2 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -2092,6 +2092,14 @@ class LDAP(pykolab.base.Base):
#
# server = self.imap.user_mailbox_server(folder)
+ log.debug(
+ _("Done with _synchronize_callback() for entry %r") % (
+ entry['id']
+ ),
+ level=9
+ )
+
+
def _unbind(self):
"""
Discard the current set of bind credentials.
diff --git a/pykolab/xml/event.py b/pykolab/xml/event.py
index 18eea3e..97a0511 100644
--- a/pykolab/xml/event.py
+++ b/pykolab/xml/event.py
@@ -32,6 +32,7 @@ class Event(object):
def __init__(self, from_ical="", from_string=""):
self._attendees = []
+ self._categories = []
if from_ical == "":
if from_string == "":
@@ -48,6 +49,53 @@ class Event(object):
self._attendees.append(attendee)
self.event.setAttendees(self._attendees)
+ def add_category(self, category):
+ self._categories.append(category)
+ self.event.setCategories(self._categories)
+
+ def add_exception_date(self, _datetime):
+ valid_datetime = False
+ if isinstance(_datetime, datetime.date):
+ valid_datetime = True
+
+ if isinstance(_datetime, datetime.datetime):
+ # If no timezone information is passed on, make it UTC
+ if _datetime.tzinfo == None:
+ _datetime = _datetime.replace(tzinfo=pytz.utc)
+
+ valid_datetime = True
+
+ if not valid_datetime:
+ raise InvalidEventDateError, _("Event start needs datetime.date or datetime.datetime instance")
+
+ (
+ year,
+ month,
+ day,
+ ) = (
+ _datetime.year,
+ _datetime.month,
+ _datetime.day,
+ )
+ if hasattr(_datetime, 'hour'):
+ (
+ hour,
+ minute,
+ second
+ ) = (
+ _datetime.hour,
+ _datetime.minute,
+ _datetime.second
+ )
+ _cdatetime = kolabformat.cDateTime(year, month, day, hour, minute, second)
+ else:
+ _cdatetime = kolabformat.cDateTime(year, month, day)
+
+ if hasattr(_datetime, "tzinfo"):
+ _cdatetime.setTimezone(_datetime.tzinfo.__str__())
+
+ self.event.addExceptionDate(_cdatetime)
+
def as_string_itip(self, method="REQUEST"):
cal = icalendar.Calendar()
cal.add(
@@ -194,6 +242,12 @@ class Event(object):
def get_attendees(self):
return self._attendees
+ def get_categories(self):
+ return self.event.categories()
+
+ def get_classification(self):
+ return self.classification()
+
def get_created(self):
_datetime = self.event.created()
@@ -218,6 +272,9 @@ class Event(object):
except ValueError:
result = datetime.datetime.now()
+ def get_description(self):
+ return self.event.description()
+
def get_end(self):
_datetime = self.event.end()
@@ -256,6 +313,9 @@ class Event(object):
else:
return datetime.datetime(year, month, day, hour, minute, second, tzinfo=_timezone)
+ def get_exception_dates(self):
+ return self.event.exceptionDates()
+
def get_ical_attendee(self):
# TODO: Formatting, aye? See also the example snippet:
#
@@ -477,6 +537,9 @@ class Event(object):
attendee.set_participant_status(status)
self.event.setAttendees(self._attendees)
+ def set_classification(self, classification):
+ self.event.setClassification(classification)
+
def set_created(self, _datetime=None):
if _datetime == None:
_datetime = datetime.datetime.now()
@@ -501,6 +564,9 @@ class Event(object):
kolabformat.cDateTime(year, month, day, hour, minute, second)
)
+ def set_description(self, description):
+ self.event.setDescription(description)
+
def set_dtstamp(self, _datetime):
(
year,
@@ -565,6 +631,10 @@ class Event(object):
self.event.setEnd(_cdatetime)
+ def set_exception_dates(self, _datetimes):
+ for _datetime in _datetimes:
+ self.add_exception_date(_datetime)
+
def set_from_ical(self, attr, value):
if attr == "dtend":
self.set_ical_dtend(value.dt)
@@ -698,6 +768,9 @@ class Event(object):
self.event.setLastModified(kolabformat.cDateTime(year, month, day, hour, minute, second))
+ def set_location(self, location):
+ self.event.setLocation(location)
+
def set_organizer(self, email, name=None):
contactreference = ContactReference(email)
if not name == None:
@@ -708,6 +781,9 @@ class Event(object):
def set_priority(self, priority):
self.event.setPriority(priority)
+ def set_recurrence(self, recurrence):
+ self.event.setRecurrenceRule(recurrence)
+
def set_start(self, _datetime):
valid_datetime = False
diff --git a/tests/functional/user_add.py b/tests/functional/user_add.py
index 2fc44cf..6af0419 100644
--- a/tests/functional/user_add.py
+++ b/tests/functional/user_add.py
@@ -59,12 +59,5 @@ def user_add(givenname, sn, preferredlanguage='en_US'):
fvg_params['type_id'] = user_type_id
fvg_params['attributes'] = [attr for attr in user_type_info['auto_form_fields'].keys() if not attr in params.keys()]
- exec("retval = wap_client.form_value_generate(%r)" % (params))
-
- for attribute in user_type_info['auto_form_fields'].keys():
- params[attribute] = retval[attribute]
-
- params['userpassword'] = user_details['userpassword']
-
result = wap_client.user_add(params)