comparison libervia/pages/events/new/page_meta.py @ 1216:b2d067339de3

python 3 port: /!\ Python 3.6+ is now needed to use libervia /!\ instability may occur and features may not be working anymore, this will improve with time /!\ TxJSONRPC dependency has been removed The same procedure as in backend has been applied (check backend commit ab2696e34d29 logs for details). Removed now deprecated code (Pyjamas compiled browser part, legacy blog, JSON RPC related code). Adapted code to work without `html` and `themes` dirs.
author Goffi <goffi@goffi.org>
date Tue, 13 Aug 2019 19:12:31 +0200
parents 29eb15062416
children f511f8fbbf8a
comparison
equal deleted inserted replaced
1215:f14ab8a25e8b 1216:b2d067339de3
1 #!/usr/bin/env python2.7 1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*- 2 # -*- coding: utf-8 -*-
3 3
4 from libervia.server.constants import Const as C 4 from libervia.server.constants import Const as C
5 from twisted.internet import defer 5 from twisted.internet import defer
6 from sat.core.log import getLogger 6 from sat.core.log import getLogger
7 from sat.tools.common import date_utils 7 from sat.tools.common import date_utils
8 8
9 """creation of new events""" 9 """creation of new events"""
10 10
11 name = u"event_new" 11 name = "event_new"
12 access = C.PAGES_ACCESS_PROFILE 12 access = C.PAGES_ACCESS_PROFILE
13 template = u"event/create.html" 13 template = "event/create.html"
14 log = getLogger(__name__) 14 log = getLogger(__name__)
15 15
16 16
17 @defer.inlineCallbacks 17 @defer.inlineCallbacks
18 def on_data_post(self, request): 18 def on_data_post(self, request):
29 if not value: 29 if not value:
30 continue 30 continue
31 if not value.startswith("http"): 31 if not value.startswith("http"):
32 self.pageError(request, C.HTTP_BAD_REQUEST) 32 self.pageError(request, C.HTTP_BAD_REQUEST)
33 data[var] = value 33 data[var] = value
34 data[u"register"] = C.BOOL_TRUE 34 data["register"] = C.BOOL_TRUE
35 node = yield self.host.bridgeCall("eventCreate", timestamp, data, "", "", "", profile) 35 node = yield self.host.bridgeCall("eventCreate", timestamp, data, "", "", "", profile)
36 log.info(u"Event node created at {node}".format(node=node)) 36 log.info("Event node created at {node}".format(node=node))
37 37
38 request_data["post_redirect_page"] = (self.getPageByName(u"event_admin"), "@", node) 38 request_data["post_redirect_page"] = (self.getPageByName("event_admin"), "@", node)
39 defer.returnValue(C.POST_NO_CONFIRM) 39 defer.returnValue(C.POST_NO_CONFIRM)