Mercurial > libervia-web
annotate libervia/pages/blog/edit/page_meta.py @ 1471:83dce05226ac
pages: workaround to expose variables coming from python-dbus
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 15 Oct 2021 21:13:35 +0200 |
parents | 925a7c498cda |
children | 081b4f8a63d8 |
rev | line source |
---|---|
1416 | 1 #!/usr/bin/env python3 |
2 | |
3 from libervia.server.constants import Const as C | |
4 from sat.core.log import getLogger | |
5 from sat.tools.common import data_format | |
6 | |
7 log = getLogger(__name__) | |
8 | |
9 name = "blog_edit" | |
10 access = C.PAGES_ACCESS_PROFILE | |
11 template = "blog/publish.html" | |
12 | |
13 | |
14 async def on_data_post(self, request): | |
15 profile = self.getProfile(request) | |
16 if profile is None: | |
17 self.pageError(request, C.HTTP_FORBIDDEN) | |
18 request_data = self.getRData(request) | |
19 title, tags, body = self.getPostedData(request, ('title', 'tags', 'body')) | |
20 mb_data = {"content_rich": body} | |
21 title = title.strip() | |
22 if title: | |
23 mb_data["title_rich"] = title | |
24 tags = [t.strip() for t in tags.split(',') if t.strip()] | |
25 if tags: | |
26 mb_data["tags"] = tags | |
27 | |
28 await self.host.bridgeCall( | |
29 'mbSend', | |
30 "", | |
31 "", | |
32 data_format.serialise(mb_data), | |
33 profile | |
34 ) | |
1420
925a7c498cda
pages (blog/edit): move preview code to new `BlogEditor` class in `editor` module
Goffi <goffi@goffi.org>
parents:
1416
diff
changeset
|
35 |
925a7c498cda
pages (blog/edit): move preview code to new `BlogEditor` class in `editor` module
Goffi <goffi@goffi.org>
parents:
1416
diff
changeset
|
36 request_data["post_redirect_page"] = self.getPageByName("blog") |