changeset 1072:7dc20bacd3b6

pages (common/blog): added xmpp_uri in template_data
author Goffi <goffi@goffi.org>
date Wed, 21 Mar 2018 19:11:37 +0100
parents 8f77e36cd51d
children 09a5e824dd42
files src/pages/common/blog/page_meta.py
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/pages/common/blog/page_meta.py	Wed Mar 21 19:11:22 2018 +0100
+++ b/src/pages/common/blog/page_meta.py	Wed Mar 21 19:11:37 2018 +0100
@@ -7,6 +7,7 @@
 from libervia.server import session_iface
 from sat.core.i18n import _
 from sat.tools.common.template import safe
+from sat.tools.common import uri
 from libervia.server import utils
 import unicodedata
 import re
@@ -264,6 +265,14 @@
     # if True, page should display a comment box
     template_data[u'allow_commenting'] = data.get(u'allow_commenting', False)
 
+    # last but not least, we add a xmpp: link to the node
+    uri_args = {u'path': service.full()}
+    if node:
+        uri_args[u'node'] = node
+    if item_id:
+        uri_args[u'item'] = item_id
+    template_data[u'xmpp_uri'] = uri.buildXMPPUri(u'pubsub', subtype='microblog', **uri_args)
+
 
 @defer.inlineCallbacks
 def on_data_post(self, request):