comparison libervia/pages/blog/page_meta.py @ 1416:0554103ec700

pages (blog): new `edit` page: this page is used for new blog post and may be used for editing existing posts too. New `editor` module is using for autosave and tags editor. New `mbPreview` bridge method is used to generate preview when javascript is available.
author Goffi <goffi@goffi.org>
date Thu, 29 Apr 2021 16:55:07 +0200
parents 470c6cfdf4ce
children ce879da7fcf7
comparison
equal deleted inserted replaced
1415:8415d882b686 1416:0554103ec700
13 name = "blog" 13 name = "blog"
14 access = C.PAGES_ACCESS_PUBLIC 14 access = C.PAGES_ACCESS_PUBLIC
15 template = "blog/discover.html" 15 template = "blog/discover.html"
16 16
17 17
18 @defer.inlineCallbacks 18 async def prepare_render(self, request):
19 def prepare_render(self, request):
20 profile = self.getProfile(request) 19 profile = self.getProfile(request)
21 template_data = request.template_data 20 template_data = request.template_data
22 if profile is not None: 21 if profile is not None:
23 __, entities_own, entities_roster = yield self.host.bridgeCall( 22 __, entities_own, entities_roster = await self.host.bridgeCall(
24 "discoFindByFeatures", 23 "discoFindByFeatures",
25 [], 24 [],
26 [("pubsub", "pep")], 25 [("pubsub", "pep")],
27 True, 26 True,
28 False, 27 False,
48 "identityGet", 47 "identityGet",
49 entity_jid_s, 48 entity_jid_s,
50 [], 49 [],
51 True, 50 True,
52 profile) 51 profile)
53 identities_data = yield defer.DeferredList(d_list.values()) 52 identities_data = await defer.DeferredList(d_list.values())
54 entities_idx = list(d_list.keys()) 53 entities_idx = list(d_list.keys())
55 for idx, (success, identity_raw) in enumerate(identities_data): 54 for idx, (success, identity_raw) in enumerate(identities_data):
56 entity_jid_s = entities_idx[idx] 55 entity_jid_s = entities_idx[idx]
57 if not success: 56 if not success:
58 log.warning(_("Can't retrieve identity of {entity}") 57 log.warning(_("Can't retrieve identity of {entity}")
59 .format(entity=entity_jid_s)) 58 .format(entity=entity_jid_s))
60 else: 59 else:
61 identities[entity_jid_s] = data_format.deserialise(identity_raw) 60 identities[entity_jid_s] = data_format.deserialise(identity_raw)
61
62 template_data["url_blog_edit"] = self.getSubPageURL(request, "blog_edit")
62 63
63 64
64 def on_data_post(self, request): 65 def on_data_post(self, request):
65 jid_str = self.getPostedData(request, "jid") 66 jid_str = self.getPostedData(request, "jid")
66 try: 67 try: