From eb25998e72d728b16d75f5d70cf930da16ec7cf0 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Fri, 16 Mar 2012 23:16:17 -0700 Subject: Update subscription event expiry value to use time objects. --- sleekxmpp/plugins/xep_0060/stanza/pubsub_event.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'sleekxmpp') diff --git a/sleekxmpp/plugins/xep_0060/stanza/pubsub_event.py b/sleekxmpp/plugins/xep_0060/stanza/pubsub_event.py index 2b69af0f..4b2012b4 100644 --- a/sleekxmpp/plugins/xep_0060/stanza/pubsub_event.py +++ b/sleekxmpp/plugins/xep_0060/stanza/pubsub_event.py @@ -6,9 +6,12 @@ See the file LICENSE for copying permission. """ +import datetime as dt + from sleekxmpp import Message from sleekxmpp.xmlstream import register_stanza_plugin, ElementBase, ET, JID from sleekxmpp.plugins.xep_0004 import Form +from sleekxmpp.plugins import xep_0082 class Event(ElementBase): @@ -116,6 +119,15 @@ class EventSubscription(ElementBase): plugin_attrib = name interfaces = set(('node', 'expiry', 'jid', 'subid', 'subscription')) + def get_expiry(self): + expiry = self._get_attr('expiry') + return xep_0082.parse(expiry) + + def set_expiry(self, value): + if isinstance(value, dt.datetime): + value = xep_0082.format_datetime(value) + self._set_attr('expiry', value) + def set_jid(self, value): self._set_attr('jid', str(value)) -- cgit v1.2.3