Mercurial > libervia-web
comparison libervia/pages/photos/new/page_meta.py @ 1509:106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 08 Apr 2023 13:44:11 +0200 |
parents | 39719ff4fcad |
children |
comparison
equal
deleted
inserted
replaced
1508:ec3ad9abf9f9 | 1509:106bae41f5c8 |
---|---|
14 template = "photo/create.html" | 14 template = "photo/create.html" |
15 log = getLogger(__name__) | 15 log = getLogger(__name__) |
16 | 16 |
17 | 17 |
18 async def on_data_post(self, request): | 18 async def on_data_post(self, request): |
19 request_data = self.getRData(request) | 19 request_data = self.get_r_data(request) |
20 profile = self.getProfile(request) | 20 profile = self.get_profile(request) |
21 name = self.getPostedData(request, "name").replace('/', '_') | 21 name = self.get_posted_data(request, "name").replace('/', '_') |
22 albums_path = "/albums" | 22 albums_path = "/albums" |
23 album_path = f"{albums_path}/{name}" | 23 album_path = f"{albums_path}/{name}" |
24 if profile is None: | 24 if profile is None: |
25 self.pageError(request, C.HTTP_BAD_REQUEST) | 25 self.page_error(request, C.HTTP_BAD_REQUEST) |
26 fis_ns = self.host.ns_map["fis"] | 26 fis_ns = self.host.ns_map["fis"] |
27 http_upload_ns = self.host.ns_map["http_upload"] | 27 http_upload_ns = self.host.ns_map["http_upload"] |
28 entities_services, __, __ = await self.host.bridgeCall( | 28 entities_services, __, __ = await self.host.bridge_call( |
29 "discoFindByFeatures", | 29 "disco_find_by_features", |
30 [fis_ns, http_upload_ns], | 30 [fis_ns, http_upload_ns], |
31 [], | 31 [], |
32 False, | 32 False, |
33 True, | 33 True, |
34 False, | 34 False, |
42 raise exceptions.DataError(D_( | 42 raise exceptions.DataError(D_( |
43 "You server has no service to create a photo album, please ask your server " | 43 "You server has no service to create a photo album, please ask your server " |
44 "administrator to add one")) | 44 "administrator to add one")) |
45 | 45 |
46 try: | 46 try: |
47 await self.host.bridgeCall( | 47 await self.host.bridge_call( |
48 "FISCreateDir", | 48 "fis_create_dir", |
49 fis_service, | 49 fis_service, |
50 "", | 50 "", |
51 albums_path, | 51 albums_path, |
52 {"access_model": "open"}, | 52 {"access_model": "open"}, |
53 profile | 53 profile |
58 else: | 58 else: |
59 log.error(f"Can't create {albums_path} path: {e}") | 59 log.error(f"Can't create {albums_path} path: {e}") |
60 raise e | 60 raise e |
61 | 61 |
62 try: | 62 try: |
63 await self.host.bridgeCall( | 63 await self.host.bridge_call( |
64 "FISCreateDir", | 64 "fis_create_dir", |
65 fis_service, | 65 fis_service, |
66 "", | 66 "", |
67 album_path, | 67 album_path, |
68 {"access_model": "whitelist"}, | 68 {"access_model": "whitelist"}, |
69 profile | 69 profile |
73 pass | 73 pass |
74 else: | 74 else: |
75 log.error(f"Can't create {album_path} path: {e}") | 75 log.error(f"Can't create {album_path} path: {e}") |
76 raise e | 76 raise e |
77 | 77 |
78 await self.host.bridgeCall( | 78 await self.host.bridge_call( |
79 "interestsRegisterFileSharing", | 79 "interests_file_sharing_register", |
80 fis_service, | 80 fis_service, |
81 "photos", | 81 "photos", |
82 "", | 82 "", |
83 album_path, | 83 album_path, |
84 name, | 84 name, |
85 "", | 85 "", |
86 profile | 86 profile |
87 ) | 87 ) |
88 log.info(f"album {name} created") | 88 log.info(f"album {name} created") |
89 request_data["post_redirect_page"] = self.getPageByName("photos") | 89 request_data["post_redirect_page"] = self.get_page_by_name("photos") |
90 defer.returnValue(C.POST_NO_CONFIRM) | 90 defer.returnValue(C.POST_NO_CONFIRM) |