Mercurial > libervia-web
comparison libervia/pages/events/new/page_meta.py @ 1124:28e3eb3bb217
files reorganisation and installation rework:
- files have been reorganised to follow other SàT projects and usual Python organisation (no more "/src" directory)
- VERSION file is now used, as for other SàT projects
- replace the overcomplicated setup.py be a more sane one. Pyjamas part is not compiled anymore by setup.py, it must be done separatly
- removed check for data_dir if it's empty
- installation tested working in virtual env
- libervia launching script is now in bin/libervia
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 25 Aug 2018 17:59:48 +0200 |
parents | src/pages/events/new/page_meta.py@cdd389ef97bc |
children | 29eb15062416 |
comparison
equal
deleted
inserted
replaced
1123:63a4b8fe9782 | 1124:28e3eb3bb217 |
---|---|
1 #!/usr/bin/env python2.7 | |
2 # -*- coding: utf-8 -*- | |
3 | |
4 from libervia.server.constants import Const as C | |
5 from twisted.internet import defer | |
6 from sat.core.log import getLogger | |
7 from sat.tools.common import date_utils | |
8 | |
9 """creation of new events""" | |
10 | |
11 name = u"event_new" | |
12 access = C.PAGES_ACCESS_PROFILE | |
13 template = u"event/create.html" | |
14 log = getLogger(u"pages/" + name) | |
15 | |
16 | |
17 @defer.inlineCallbacks | |
18 def on_data_post(self, request): | |
19 request_data = self.getRData(request) | |
20 profile = self.getProfile(request) | |
21 title, location, body, date, main_img, bg_img = self.getPostedData( | |
22 request, ("name", "location", "body", "date", "main_image", "bg_image") | |
23 ) | |
24 timestamp = date_utils.date_parse(date) | |
25 data = {"name": title, "description": body, "location": location} | |
26 | |
27 for value, var in ((main_img, "image"), (bg_img, "background-image")): | |
28 value = value.strip() | |
29 if not value: | |
30 continue | |
31 if not value.startswith("http"): | |
32 self.pageError(request, C.HTTP_BAD_REQUEST) | |
33 data[var] = value | |
34 data[u"register"] = C.BOOL_TRUE | |
35 node = yield self.host.bridgeCall("eventCreate", timestamp, data, "", "", "", profile) | |
36 log.info(u"Event node created at {node}".format(node=node)) | |
37 | |
38 request_data["post_redirect_page"] = (self.getPageByName(u"event_admin"), "@", node) | |
39 defer.returnValue(C.POST_NO_CONFIRM) |