changeset 2415:59100136f07a

plugin XEP-0277: minor id generation change
author Goffi <goffi@goffi.org>
date Sat, 04 Nov 2017 22:10:01 +0100
parents 8b37a62336c3
children e2cbd449c002
files src/plugins/plugin_xep_0277.py
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0277.py	Fri Nov 03 14:31:42 2017 +0100
+++ b/src/plugins/plugin_xep_0277.py	Sat Nov 04 22:10:01 2017 +0100
@@ -349,11 +349,8 @@
 
         @param data: data dict as given by bridge method.
         @param item_id(unicode, None): id of the item to use
-            if None the id will be generated randomly
         @return: deferred which fire domish.Element
         """
-        if item_id is None:
-            item_id = unicode(uuid.uuid4())
         client = self.host.getClient(profile)
         entry_elt = domish.Element((NS_ATOM, 'entry'))
 
@@ -444,7 +441,7 @@
             category_elt['term'] = tag
 
         ## id ##
-        entry_id = data.get('id', item_id) # FIXME: use a proper id (see XEP-0277 §7.1)
+        entry_id = data.get('id', item_id or unicode(uuid.uuid4())) # FIXME: use a proper id (see XEP-0277 §7.1)
         entry_elt.addElement('id', content=entry_id) #
 
         ## comments ##