Mercurial > libervia-web
annotate libervia/pages/g/page_meta.py @ 1422:027f5059e1e2
pages (lists/view_item): browser part was not in the repository
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 01 May 2021 19:05:05 +0200 |
parents | 6f342b36871c |
children | ce879da7fcf7 |
rev | line source |
---|---|
1216 | 1 #!/usr/bin/env python3 |
1239 | 2 |
930
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 from libervia.server.constants import Const as C |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
5 from sat.core.i18n import _ |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 from libervia.server import session_iface |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 from sat.core.log import getLogger |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
8 |
1145
29eb15062416
pages: set __name__ for imported pages
Goffi <goffi@goffi.org>
parents:
1124
diff
changeset
|
9 log = getLogger(__name__) |
930
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 access = C.PAGES_ACCESS_PUBLIC |
1216 | 12 template = "invitation/welcome.html" |
930
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 |
1355
6f342b36871c
pages (g): set `interests_map` even in case of errors
Goffi <goffi@goffi.org>
parents:
1239
diff
changeset
|
15 async def parse_url(self, request): |
930
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 """check invitation id in URL and start session if needed |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 if a session already exists for an other guest/profile, it will be purged |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 """ |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 try: |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 invitation_id = self.nextPath(request) |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 except IndexError: |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
23 self.pageError(request) |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
25 sat_session, guest_session = self.host.getSessionData( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
26 request, session_iface.ISATSession, session_iface.ISATGuestSession |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
27 ) |
930
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 current_id = guest_session.id |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 if current_id is not None and current_id != invitation_id: |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
31 log.info( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
32 _( |
1216 | 33 "killing guest session [{old_id}] because it is connecting with an other ID [{new_id}]" |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
34 ).format(old_id=current_id, new_id=invitation_id) |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
35 ) |
930
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
36 self.host.purgeSession(request) |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
37 sat_session, guest_session = self.host.getSessionData( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
38 request, session_iface.ISATSession, session_iface.ISATGuestSession |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
39 ) |
1179
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
40 current_id = None # FIXME: id not reset here |
930
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
41 profile = None |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
43 profile = sat_session.profile |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
44 if profile is not None and current_id is None: |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
45 log.info( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
46 _( |
1216 | 47 "killing current profile session [{profile}] because a guest id is used" |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
48 ).format(profile=profile) |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
49 ) |
930
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
50 self.host.purgeSession(request) |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
51 sat_session, guest_session = self.host.getSessionData( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
52 request, session_iface.ISATSession, session_iface.ISATGuestSession |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
53 ) |
930
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
54 profile = None |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
55 |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
56 if current_id is None: |
1216 | 57 log.debug(_("checking invitation [{id}]").format(id=invitation_id)) |
930
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
58 try: |
1355
6f342b36871c
pages (g): set `interests_map` even in case of errors
Goffi <goffi@goffi.org>
parents:
1239
diff
changeset
|
59 data = await self.host.bridgeCall("invitationGet", invitation_id) |
930
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
60 except Exception: |
1173
0f37b65fe7c2
server: replaced wrong usage of C.HTTP_UNAUTHORIZED by C.HTTP_FORBIDDEN
Goffi <goffi@goffi.org>
parents:
1145
diff
changeset
|
61 self.pageError(request, C.HTTP_FORBIDDEN) |
930
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
62 else: |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
63 guest_session.id = invitation_id |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
64 guest_session.data = data |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
65 else: |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
66 data = guest_session.data |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
67 |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
68 if profile is None: |
1216 | 69 log.debug(_("connecting profile [{}]").format(profile)) |
930
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
70 # we need to connect the profile |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
71 profile = data["guest_profile"] |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
72 password = data["password"] |
930
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
73 try: |
1355
6f342b36871c
pages (g): set `interests_map` even in case of errors
Goffi <goffi@goffi.org>
parents:
1239
diff
changeset
|
74 await self.host.connect(request, profile, password) |
930
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
75 except Exception as e: |
1216 | 76 log.warning(_("Can't connect profile: {msg}").format(msg=e)) |
930
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
77 # FIXME: no good error code correspond |
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
78 # maybe use a custom one? |
938 | 79 self.pageError(request, code=C.HTTP_SERVICE_UNAVAILABLE) |
930
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
80 |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
81 log.info( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
82 _( |
1216 | 83 "guest session started, connected with profile [{profile}]".format( |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
84 profile=profile |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
85 ) |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
86 ) |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
87 ) |
930
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
88 |
941
aba7208d9d50
pages (g): guest name is added to template data
Goffi <goffi@goffi.org>
parents:
938
diff
changeset
|
89 # we copy data useful in templates |
aba7208d9d50
pages (g): guest name is added to template data
Goffi <goffi@goffi.org>
parents:
938
diff
changeset
|
90 template_data = request.template_data |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1100
diff
changeset
|
91 template_data["norobots"] = True |
1216 | 92 if "name" in data: |
93 template_data["name"] = data["name"] | |
94 if "language" in data: | |
95 template_data["locale"] = data["language"] | |
941
aba7208d9d50
pages (g): guest name is added to template data
Goffi <goffi@goffi.org>
parents:
938
diff
changeset
|
96 |
1179
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
97 def handleEventInterest(self, interest): |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
98 if C.bool(interest.get("creator", C.BOOL_FALSE)): |
1216 | 99 page_name = "event_admin" |
1179
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
100 else: |
1216 | 101 page_name = "event_rsvp" |
930
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
102 |
1179
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
103 interest["url"] = self.getPageByName(page_name).getURL( |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
104 interest.get("service", ""), |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
105 interest.get("node", ""), |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
106 interest.get("item"), |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
107 ) |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
108 |
1216 | 109 if "thumb_url" not in interest and "image" in interest: |
110 interest["thumb_url"] = interest["image"] | |
1179
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
111 |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
112 def handleFISInterest(self, interest): |
1216 | 113 path = interest.get('path', '') |
114 path_args = [p for p in path.split('/') if p] | |
115 subtype = interest.get('subtype') | |
1179
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
116 |
1216 | 117 if subtype == 'files': |
118 page_name = "files_view" | |
119 elif interest.get('subtype') == 'photos': | |
120 page_name = "photos_album" | |
1179
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
121 else: |
1216 | 122 log.warning("unknown interest subtype: {subtype}".format(subtype=subtype)) |
1179
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
123 return False |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
124 |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
125 interest["url"] = self.getPageByName(page_name).getURL( |
1216 | 126 interest['service'], *path_args) |
1179
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
127 |
1355
6f342b36871c
pages (g): set `interests_map` even in case of errors
Goffi <goffi@goffi.org>
parents:
1239
diff
changeset
|
128 async def prepare_render(self, request): |
930
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
129 template_data = request.template_data |
1179
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
130 profile = self.getProfile(request) |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
131 |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
132 # interests |
1355
6f342b36871c
pages (g): set `interests_map` even in case of errors
Goffi <goffi@goffi.org>
parents:
1239
diff
changeset
|
133 template_data['interests_map'] = interests_map = {} |
1179
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
134 try: |
1355
6f342b36871c
pages (g): set `interests_map` even in case of errors
Goffi <goffi@goffi.org>
parents:
1239
diff
changeset
|
135 interests = await self.host.bridgeCall( |
1179
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
136 "interestsList", "", "", "", profile) |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
137 except Exception: |
1216 | 138 log.warning(_("Can't get interests list for {profile}").format( |
1179
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
139 profile=profile)) |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
140 else: |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
141 # we only want known interests (photos and events for now) |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
142 # this dict map namespaces of interest to a callback which can manipulate |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
143 # the data. If it returns False, the interest is skipped |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
144 ns_data = {} |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
145 |
1216 | 146 for short_name, cb in (('event', handleEventInterest), |
147 ('fis', handleFISInterest), | |
1179
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
148 ): |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
149 try: |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
150 namespace = self.host.ns_map[short_name] |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
151 except KeyError: |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
152 pass |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
153 else: |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
154 ns_data[namespace] = (cb, short_name) |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
155 |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
156 for interest in interests: |
1216 | 157 namespace = interest.get('namespace') |
1179
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
158 if namespace not in ns_data: |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
159 continue |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
160 cb, short_name = ns_data[namespace] |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
161 if cb(self, interest) == False: |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
162 continue |
1216 | 163 key = interest.get('subtype', short_name) |
1179
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
164 interests_map.setdefault(key, []).append(interest) |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
165 |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
166 # main URI |
930
b5490fa65348
pages (g): added g (for guest) page to handle invitations
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
167 guest_session = self.host.getSessionData(request, session_iface.ISATGuestSession) |
1179
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
168 main_uri = guest_session.data.get("event_uri") |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
169 if main_uri: |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
170 include_url = self.getPagePathFromURI(main_uri) |
bfbfe04209e9
pages (g): retrieve interests for events/photo albums/file sharing + only set "include_url" if "main_uri" is set
Goffi <goffi@goffi.org>
parents:
1173
diff
changeset
|
171 if include_url is not None: |
1216 | 172 template_data["include_url"] = include_url |