author | Sverre Rabbelier <srabbelier@gmail.com> |
Sun, 25 Jan 2009 00:01:19 +0000 | |
changeset 971 | 1d852b58b182 |
parent 946 | db4134853d64 |
child 981 | 61a6a8d304dc |
permissions | -rw-r--r-- |
611
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/python2.5 |
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
2 |
# |
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
3 |
# Copyright 2008 the Melange authors. |
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
4 |
# |
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
6 |
# you may not use this file except in compliance with the License. |
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
7 |
# You may obtain a copy of the License at |
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
8 |
# |
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
10 |
# |
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
11 |
# Unless required by applicable law or agreed to in writing, software |
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
14 |
# See the License for the specific language governing permissions and |
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
15 |
# limitations under the License. |
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
16 |
|
639
1f92bd41b914
Some docstring fixes in few modules (soc.views.helper soc.views.models.base).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
620
diff
changeset
|
17 |
"""Redirect related methods. |
611
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
18 |
""" |
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
19 |
|
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
20 |
__authors__ = [ |
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
21 |
'"Sverre Rabbelier" <sverre@rabbelier.nl>', |
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
22 |
] |
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
23 |
|
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
24 |
|
891
3d40190f35b6
Move getToSLink() to soc.views.helper.redirects.getToSRedirect().
Todd Larsen <tlarsen@google.com>
parents:
885
diff
changeset
|
25 |
from google.appengine.ext import db |
3d40190f35b6
Move getToSLink() to soc.views.helper.redirects.getToSRedirect().
Todd Larsen <tlarsen@google.com>
parents:
885
diff
changeset
|
26 |
|
3d40190f35b6
Move getToSLink() to soc.views.helper.redirects.getToSRedirect().
Todd Larsen <tlarsen@google.com>
parents:
885
diff
changeset
|
27 |
|
654
68bafa9f719f
Fixed the 'New Host' link
Sverre Rabbelier <srabbelier@gmail.com>
parents:
652
diff
changeset
|
28 |
def getInviteRedirect(entity, params): |
667
f96095df1433
Some more import sorting fixes and docstring typos in program modules and soc.views.helper.redirects module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
654
diff
changeset
|
29 |
"""Returns the invitation redirect for the specified entity. |
654
68bafa9f719f
Fixed the 'New Host' link
Sverre Rabbelier <srabbelier@gmail.com>
parents:
652
diff
changeset
|
30 |
""" |
68bafa9f719f
Fixed the 'New Host' link
Sverre Rabbelier <srabbelier@gmail.com>
parents:
652
diff
changeset
|
31 |
|
68bafa9f719f
Fixed the 'New Host' link
Sverre Rabbelier <srabbelier@gmail.com>
parents:
652
diff
changeset
|
32 |
result ='/%s/invite/%s' % ( |
698
a953f0676699
Added a public redirect
Sverre Rabbelier <srabbelier@gmail.com>
parents:
676
diff
changeset
|
33 |
params['url_name'], entity.key().name()) |
654
68bafa9f719f
Fixed the 'New Host' link
Sverre Rabbelier <srabbelier@gmail.com>
parents:
652
diff
changeset
|
34 |
|
68bafa9f719f
Fixed the 'New Host' link
Sverre Rabbelier <srabbelier@gmail.com>
parents:
652
diff
changeset
|
35 |
return result |
68bafa9f719f
Fixed the 'New Host' link
Sverre Rabbelier <srabbelier@gmail.com>
parents:
652
diff
changeset
|
36 |
|
667
f96095df1433
Some more import sorting fixes and docstring typos in program modules and soc.views.helper.redirects module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
654
diff
changeset
|
37 |
|
652
02323664d532
Cleanups in preparation of general selector view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
643
diff
changeset
|
38 |
def getCreateRedirect(entity, params): |
643 | 39 |
"""Returns the create program redirect for the specified entity. |
40 |
""" |
|
41 |
||
42 |
result ='/%s/create/%s' % ( |
|
698
a953f0676699
Added a public redirect
Sverre Rabbelier <srabbelier@gmail.com>
parents:
676
diff
changeset
|
43 |
params['url_name'], entity.key().name()) |
643 | 44 |
|
45 |
return result |
|
620
e74e0b74625f
Put the redirects in the views/helper/redirects.py module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
611
diff
changeset
|
46 |
|
667
f96095df1433
Some more import sorting fixes and docstring typos in program modules and soc.views.helper.redirects module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
654
diff
changeset
|
47 |
|
611
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
48 |
def getEditRedirect(entity, params): |
620
e74e0b74625f
Put the redirects in the views/helper/redirects.py module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
611
diff
changeset
|
49 |
"""Returns the edit redirect for the specified entity. |
611
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
50 |
""" |
2ec30182e5f1
Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
51 |
|
698
a953f0676699
Added a public redirect
Sverre Rabbelier <srabbelier@gmail.com>
parents:
676
diff
changeset
|
52 |
return '/%s/edit/%s' % ( |
a953f0676699
Added a public redirect
Sverre Rabbelier <srabbelier@gmail.com>
parents:
676
diff
changeset
|
53 |
params['url_name'], entity.key().name()) |
a953f0676699
Added a public redirect
Sverre Rabbelier <srabbelier@gmail.com>
parents:
676
diff
changeset
|
54 |
|
a953f0676699
Added a public redirect
Sverre Rabbelier <srabbelier@gmail.com>
parents:
676
diff
changeset
|
55 |
|
a953f0676699
Added a public redirect
Sverre Rabbelier <srabbelier@gmail.com>
parents:
676
diff
changeset
|
56 |
def getPublicRedirect(entity, params): |
a953f0676699
Added a public redirect
Sverre Rabbelier <srabbelier@gmail.com>
parents:
676
diff
changeset
|
57 |
"""Returns the public redirect for the specified entity. |
a953f0676699
Added a public redirect
Sverre Rabbelier <srabbelier@gmail.com>
parents:
676
diff
changeset
|
58 |
""" |
a953f0676699
Added a public redirect
Sverre Rabbelier <srabbelier@gmail.com>
parents:
676
diff
changeset
|
59 |
|
a953f0676699
Added a public redirect
Sverre Rabbelier <srabbelier@gmail.com>
parents:
676
diff
changeset
|
60 |
return '/%s/show/%s' % ( |
a953f0676699
Added a public redirect
Sverre Rabbelier <srabbelier@gmail.com>
parents:
676
diff
changeset
|
61 |
params['url_name'], entity.key().name()) |
885
f46b689e19eb
Changed the redirect in club application overview to the correct page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
858
diff
changeset
|
62 |
|
f46b689e19eb
Changed the redirect in club application overview to the correct page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
858
diff
changeset
|
63 |
|
858
e79e7a22326f
Add an export() view, and implement it as text/text for Document.
Todd Larsen <tlarsen@google.com>
parents:
797
diff
changeset
|
64 |
def getExportRedirect(entity, params): |
e79e7a22326f
Add an export() view, and implement it as text/text for Document.
Todd Larsen <tlarsen@google.com>
parents:
797
diff
changeset
|
65 |
"""Returns the export redirect for the specified entity. |
e79e7a22326f
Add an export() view, and implement it as text/text for Document.
Todd Larsen <tlarsen@google.com>
parents:
797
diff
changeset
|
66 |
""" |
e79e7a22326f
Add an export() view, and implement it as text/text for Document.
Todd Larsen <tlarsen@google.com>
parents:
797
diff
changeset
|
67 |
|
e79e7a22326f
Add an export() view, and implement it as text/text for Document.
Todd Larsen <tlarsen@google.com>
parents:
797
diff
changeset
|
68 |
return '/%s/export/%s' % ( |
e79e7a22326f
Add an export() view, and implement it as text/text for Document.
Todd Larsen <tlarsen@google.com>
parents:
797
diff
changeset
|
69 |
params['url_name'], entity.key().name()) |
e79e7a22326f
Add an export() view, and implement it as text/text for Document.
Todd Larsen <tlarsen@google.com>
parents:
797
diff
changeset
|
70 |
|
885
f46b689e19eb
Changed the redirect in club application overview to the correct page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
858
diff
changeset
|
71 |
|
923
5a10f6db154b
Hook up the 'home' view for site and program
Sverre Rabbelier <srabbelier@gmail.com>
parents:
920
diff
changeset
|
72 |
def getHomeRedirect(entity, params): |
946
db4134853d64
Add missing dots in soc.views.helper.redirects module function docstrings.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
940
diff
changeset
|
73 |
"""Returns the home redirect for the specified entity. |
923
5a10f6db154b
Hook up the 'home' view for site and program
Sverre Rabbelier <srabbelier@gmail.com>
parents:
920
diff
changeset
|
74 |
""" |
5a10f6db154b
Hook up the 'home' view for site and program
Sverre Rabbelier <srabbelier@gmail.com>
parents:
920
diff
changeset
|
75 |
|
5a10f6db154b
Hook up the 'home' view for site and program
Sverre Rabbelier <srabbelier@gmail.com>
parents:
920
diff
changeset
|
76 |
return '/%s/home/%s' % ( |
5a10f6db154b
Hook up the 'home' view for site and program
Sverre Rabbelier <srabbelier@gmail.com>
parents:
920
diff
changeset
|
77 |
params['url_name'], entity.key().name()) |
5a10f6db154b
Hook up the 'home' view for site and program
Sverre Rabbelier <srabbelier@gmail.com>
parents:
920
diff
changeset
|
78 |
|
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
698
diff
changeset
|
79 |
def getReviewRedirect(entity, params): |
946
db4134853d64
Add missing dots in soc.views.helper.redirects module function docstrings.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
940
diff
changeset
|
80 |
"""Returns the redirect to review the specified entity. |
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
698
diff
changeset
|
81 |
""" |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
698
diff
changeset
|
82 |
|
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
698
diff
changeset
|
83 |
return '/%s/review/%s' % ( |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
698
diff
changeset
|
84 |
params['url_name'], entity.link_id) |
698
a953f0676699
Added a public redirect
Sverre Rabbelier <srabbelier@gmail.com>
parents:
676
diff
changeset
|
85 |
|
a953f0676699
Added a public redirect
Sverre Rabbelier <srabbelier@gmail.com>
parents:
676
diff
changeset
|
86 |
|
a953f0676699
Added a public redirect
Sverre Rabbelier <srabbelier@gmail.com>
parents:
676
diff
changeset
|
87 |
def getCreateRequestRedirect(entity, params): |
a953f0676699
Added a public redirect
Sverre Rabbelier <srabbelier@gmail.com>
parents:
676
diff
changeset
|
88 |
"""Returns the create request redirect for the specified entity. |
a953f0676699
Added a public redirect
Sverre Rabbelier <srabbelier@gmail.com>
parents:
676
diff
changeset
|
89 |
""" |
a953f0676699
Added a public redirect
Sverre Rabbelier <srabbelier@gmail.com>
parents:
676
diff
changeset
|
90 |
|
a953f0676699
Added a public redirect
Sverre Rabbelier <srabbelier@gmail.com>
parents:
676
diff
changeset
|
91 |
result ='/request/create/%s/%s/%s' % ( |
a953f0676699
Added a public redirect
Sverre Rabbelier <srabbelier@gmail.com>
parents:
676
diff
changeset
|
92 |
params['group_scope'], params['url_name'], entity.key().name()) |
a953f0676699
Added a public redirect
Sverre Rabbelier <srabbelier@gmail.com>
parents:
676
diff
changeset
|
93 |
|
a953f0676699
Added a public redirect
Sverre Rabbelier <srabbelier@gmail.com>
parents:
676
diff
changeset
|
94 |
return result |
620
e74e0b74625f
Put the redirects in the views/helper/redirects.py module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
611
diff
changeset
|
95 |
|
e74e0b74625f
Put the redirects in the views/helper/redirects.py module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
611
diff
changeset
|
96 |
|
932
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
97 |
def getSelectRedirect(entity, params): |
946
db4134853d64
Add missing dots in soc.views.helper.redirects module function docstrings.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
940
diff
changeset
|
98 |
"""Returns the pick redirect for the specified entity. |
932
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
99 |
""" |
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
100 |
|
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
101 |
if entity: |
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
102 |
result = '/%s/pick?scope_path=%s&field=%s&continue=%s' % ( |
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
103 |
params['url_name'], entity.key().name(), |
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
104 |
params['field_name'], params['return_url']) |
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
105 |
else: |
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
106 |
result = '/%s/pick?field=%s&continue=%s' % ( |
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
107 |
params['url_name'], params['field_name'], params['return_url']) |
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
108 |
|
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
109 |
return result |
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
110 |
|
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
111 |
|
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
112 |
def getReturnRedirect(return_url, field): |
946
db4134853d64
Add missing dots in soc.views.helper.redirects module function docstrings.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
940
diff
changeset
|
113 |
"""Returns a function that has return_url and field embedded. |
932
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
114 |
""" |
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
115 |
|
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
116 |
def wrapped(entity, params): |
946
db4134853d64
Add missing dots in soc.views.helper.redirects module function docstrings.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
940
diff
changeset
|
117 |
"""Returns the return redirect for the specified entity. |
932
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
118 |
""" |
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
119 |
|
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
120 |
result = '%s?field=%s&value=%s' % ( |
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
121 |
return_url, field, entity.link_id) |
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
122 |
return result |
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
123 |
|
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
124 |
return wrapped |
2b72d0315254
Add redirects for the new pick view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
930
diff
changeset
|
125 |
|
940
a40056afef83
Changed the access checks to comply with state in request.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
932
diff
changeset
|
126 |
def getInviteAcceptedRedirect(entity, _): |
620
e74e0b74625f
Put the redirects in the views/helper/redirects.py module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
611
diff
changeset
|
127 |
"""Returns the redirect for accepting an invite. |
e74e0b74625f
Put the redirects in the views/helper/redirects.py module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
611
diff
changeset
|
128 |
""" |
e74e0b74625f
Put the redirects in the views/helper/redirects.py module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
611
diff
changeset
|
129 |
|
920
39badbfb80be
Added the new way to process invites for club_admin only.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
891
diff
changeset
|
130 |
return '/%s/accept_invite/%s/%s' % ( |
620
e74e0b74625f
Put the redirects in the views/helper/redirects.py module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
611
diff
changeset
|
131 |
entity.role, entity.scope_path, entity.link_id) |
885
f46b689e19eb
Changed the redirect in club application overview to the correct page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
858
diff
changeset
|
132 |
|
929
7431d7770197
Renamed redirect methods to comply with the rest of the module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
923
diff
changeset
|
133 |
|
7431d7770197
Renamed redirect methods to comply with the rest of the module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
923
diff
changeset
|
134 |
def getInviteProcessRedirect(entity, _): |
930
7e88fba647b1
Added missing changes from r1522.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
929
diff
changeset
|
135 |
"""Returns the redirect for processing an invite. |
920
39badbfb80be
Added the new way to process invites for club_admin only.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
891
diff
changeset
|
136 |
""" |
39badbfb80be
Added the new way to process invites for club_admin only.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
891
diff
changeset
|
137 |
|
39badbfb80be
Added the new way to process invites for club_admin only.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
891
diff
changeset
|
138 |
return '/request/process_invite/%s/%s/%s' % ( |
39badbfb80be
Added the new way to process invites for club_admin only.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
891
diff
changeset
|
139 |
entity.scope_path, entity.role, entity.link_id) |
885
f46b689e19eb
Changed the redirect in club application overview to the correct page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
858
diff
changeset
|
140 |
|
929
7431d7770197
Renamed redirect methods to comply with the rest of the module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
923
diff
changeset
|
141 |
|
885
f46b689e19eb
Changed the redirect in club application overview to the correct page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
858
diff
changeset
|
142 |
def getApplicantRedirect(entity, params): |
f46b689e19eb
Changed the redirect in club application overview to the correct page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
858
diff
changeset
|
143 |
"""Returns the redirect for processing accepted Applications. |
f46b689e19eb
Changed the redirect in club application overview to the correct page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
858
diff
changeset
|
144 |
""" |
f46b689e19eb
Changed the redirect in club application overview to the correct page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
858
diff
changeset
|
145 |
|
f46b689e19eb
Changed the redirect in club application overview to the correct page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
858
diff
changeset
|
146 |
return '/%s/applicant/%s' % ( |
f46b689e19eb
Changed the redirect in club application overview to the correct page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
858
diff
changeset
|
147 |
params['url_name'], entity.link_id) |
f46b689e19eb
Changed the redirect in club application overview to the correct page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
858
diff
changeset
|
148 |
|
891
3d40190f35b6
Move getToSLink() to soc.views.helper.redirects.getToSRedirect().
Todd Larsen <tlarsen@google.com>
parents:
885
diff
changeset
|
149 |
|
3d40190f35b6
Move getToSLink() to soc.views.helper.redirects.getToSRedirect().
Todd Larsen <tlarsen@google.com>
parents:
885
diff
changeset
|
150 |
def getToSRedirect(presence): |
3d40190f35b6
Move getToSLink() to soc.views.helper.redirects.getToSRedirect().
Todd Larsen <tlarsen@google.com>
parents:
885
diff
changeset
|
151 |
"""Returns link to 'show' the ToS Document if it exists, None otherwise. |
3d40190f35b6
Move getToSLink() to soc.views.helper.redirects.getToSRedirect().
Todd Larsen <tlarsen@google.com>
parents:
885
diff
changeset
|
152 |
|
3d40190f35b6
Move getToSLink() to soc.views.helper.redirects.getToSRedirect().
Todd Larsen <tlarsen@google.com>
parents:
885
diff
changeset
|
153 |
Args: |
3d40190f35b6
Move getToSLink() to soc.views.helper.redirects.getToSRedirect().
Todd Larsen <tlarsen@google.com>
parents:
885
diff
changeset
|
154 |
presence: Presence entity that may or may not have a tos property |
3d40190f35b6
Move getToSLink() to soc.views.helper.redirects.getToSRedirect().
Todd Larsen <tlarsen@google.com>
parents:
885
diff
changeset
|
155 |
""" |
3d40190f35b6
Move getToSLink() to soc.views.helper.redirects.getToSRedirect().
Todd Larsen <tlarsen@google.com>
parents:
885
diff
changeset
|
156 |
if not presence: |
3d40190f35b6
Move getToSLink() to soc.views.helper.redirects.getToSRedirect().
Todd Larsen <tlarsen@google.com>
parents:
885
diff
changeset
|
157 |
return None |
3d40190f35b6
Move getToSLink() to soc.views.helper.redirects.getToSRedirect().
Todd Larsen <tlarsen@google.com>
parents:
885
diff
changeset
|
158 |
|
3d40190f35b6
Move getToSLink() to soc.views.helper.redirects.getToSRedirect().
Todd Larsen <tlarsen@google.com>
parents:
885
diff
changeset
|
159 |
try: |
3d40190f35b6
Move getToSLink() to soc.views.helper.redirects.getToSRedirect().
Todd Larsen <tlarsen@google.com>
parents:
885
diff
changeset
|
160 |
tos_doc = presence.tos |
3d40190f35b6
Move getToSLink() to soc.views.helper.redirects.getToSRedirect().
Todd Larsen <tlarsen@google.com>
parents:
885
diff
changeset
|
161 |
except db.Error: |
3d40190f35b6
Move getToSLink() to soc.views.helper.redirects.getToSRedirect().
Todd Larsen <tlarsen@google.com>
parents:
885
diff
changeset
|
162 |
return None |
3d40190f35b6
Move getToSLink() to soc.views.helper.redirects.getToSRedirect().
Todd Larsen <tlarsen@google.com>
parents:
885
diff
changeset
|
163 |
|
3d40190f35b6
Move getToSLink() to soc.views.helper.redirects.getToSRedirect().
Todd Larsen <tlarsen@google.com>
parents:
885
diff
changeset
|
164 |
if not tos_doc: |
3d40190f35b6
Move getToSLink() to soc.views.helper.redirects.getToSRedirect().
Todd Larsen <tlarsen@google.com>
parents:
885
diff
changeset
|
165 |
return None |
3d40190f35b6
Move getToSLink() to soc.views.helper.redirects.getToSRedirect().
Todd Larsen <tlarsen@google.com>
parents:
885
diff
changeset
|
166 |
|
3d40190f35b6
Move getToSLink() to soc.views.helper.redirects.getToSRedirect().
Todd Larsen <tlarsen@google.com>
parents:
885
diff
changeset
|
167 |
return getPublicRedirect(tos_doc, {'url_name': 'document'}) |