author | Daniel Hans <Daniel.M.Hans@gmail.com> |
Fri, 30 Oct 2009 01:23:37 +0100 | |
changeset 3067 | 371e1979ee6a |
parent 3043 | 187c1709756b |
permissions | -rw-r--r-- |
3043 | 1 |
#!/usr/bin/python2.5 |
2 |
# |
|
3 |
# Copyright 2009 the Melange authors. |
|
4 |
# |
|
5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
|
6 |
# you may not use this file except in compliance with the License. |
|
7 |
# You may obtain a copy of the License at |
|
8 |
# |
|
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
|
10 |
# |
|
11 |
# Unless required by applicable law or agreed to in writing, software |
|
12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
|
13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
14 |
# See the License for the specific language governing permissions and |
|
15 |
# limitations under the License. |
|
16 |
||
17 |
"""Views for GSoCProgram. |
|
18 |
""" |
|
19 |
||
20 |
__authors__ = [ |
|
21 |
'"Sverre Rabbelier" <sverre@rabbelier.nl>', |
|
22 |
] |
|
23 |
||
24 |
||
25 |
from soc.logic import dicts |
|
26 |
from soc.views.helper import decorators |
|
27 |
from soc.views.helper import access # TODO |
|
28 |
from soc.views.models import program |
|
29 |
||
30 |
from soc.logic.models.host import logic as host_logic |
|
31 |
from soc.modules.gsoc.logic.models.program import logic as program_logic |
|
32 |
from soc.modules.gsoc.logic.models.org_admin import logic as org_admin_logic |
|
33 |
||
34 |
||
35 |
class View(program.View): |
|
36 |
"""View methods for the Program model. |
|
37 |
""" |
|
38 |
||
39 |
def __init__(self, params=None): |
|
40 |
"""Defines the fields and methods required for the base View class |
|
41 |
to provide the user with list, public, create, edit and delete views. |
|
42 |
||
43 |
Params: |
|
44 |
params: a dict with params for this View |
|
45 |
""" |
|
46 |
||
47 |
rights = access.Checker(params) |
|
48 |
rights['any_access'] = ['allow'] |
|
49 |
rights['show'] = ['allow'] |
|
50 |
rights['create'] = [('checkSeeded', ['checkHasActiveRoleForScope', |
|
51 |
host_logic])] |
|
3067
371e1979ee6a
checkIsHostForProgram function takes a new 'logic' argument.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents:
3043
diff
changeset
|
52 |
rights['edit'] = [('checkIsHostForProgram', [program_logic.logic])] |
3043 | 53 |
rights['delete'] = ['checkIsDeveloper'] |
3067
371e1979ee6a
checkIsHostForProgram function takes a new 'logic' argument.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents:
3043
diff
changeset
|
54 |
rights['assign_slots'] = [('checkIsHostForProgram', [program_logic.logic])] |
371e1979ee6a
checkIsHostForProgram function takes a new 'logic' argument.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents:
3043
diff
changeset
|
55 |
rights['slots'] = [('checkIsHostForProgram', [program_logic.logic])] |
371e1979ee6a
checkIsHostForProgram function takes a new 'logic' argument.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents:
3043
diff
changeset
|
56 |
rights['show_duplicates'] = [('checkIsHostForProgram', |
371e1979ee6a
checkIsHostForProgram function takes a new 'logic' argument.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents:
3043
diff
changeset
|
57 |
[program_logic.logic])] |
371e1979ee6a
checkIsHostForProgram function takes a new 'logic' argument.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents:
3043
diff
changeset
|
58 |
rights['assigned_proposals'] = [('checkIsHostForProgram', |
371e1979ee6a
checkIsHostForProgram function takes a new 'logic' argument.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents:
3043
diff
changeset
|
59 |
[program_logic.logic])] |
3043 | 60 |
rights['accepted_orgs'] = [('checkIsAfterEvent', |
61 |
['accepted_organization_announced_deadline', |
|
62 |
'__all__', program_logic])] |
|
63 |
rights['list_projects'] = [('checkIsAfterEvent', |
|
64 |
['accepted_students_announced_deadline', |
|
65 |
'__all__', program_logic])] |
|
66 |
||
67 |
new_params = {} |
|
68 |
new_params['logic'] = program_logic |
|
69 |
new_params['rights'] = rights |
|
70 |
||
71 |
new_params['name'] = "GSoC Program" |
|
72 |
new_params['module_name'] = "program" |
|
73 |
new_params['sidebar_grouping'] = 'Programs' |
|
74 |
||
75 |
new_params['module_package'] = 'soc.modules.gsoc.views.models' |
|
76 |
new_params['url_name'] = 'gsoc/program' |
|
77 |
||
78 |
params = dicts.merge(params, new_params, sub_merge=True) |
|
79 |
||
80 |
super(View, self).__init__(params) |
|
81 |
||
82 |
||
83 |
view = View() |
|
84 |
||
85 |
accepted_orgs = decorators.view(view.acceptedOrgs) |
|
86 |
list_projects = decorators.view(view.acceptedProjects) |
|
87 |
admin = decorators.view(view.admin) |
|
88 |
assign_slots = decorators.view(view.assignSlots) |
|
89 |
assigned_proposals = decorators.view(view.assignedProposals) |
|
90 |
create = decorators.view(view.create) |
|
91 |
delete = decorators.view(view.delete) |
|
92 |
edit = decorators.view(view.edit) |
|
93 |
list = decorators.view(view.list) |
|
94 |
public = decorators.view(view.public) |
|
95 |
export = decorators.view(view.export) |
|
96 |
show_duplicates = decorators.view(view.showDuplicates) |
|
97 |
slots = decorators.view(view.slots) |
|
98 |
home = decorators.view(view.home) |
|
99 |
pick = decorators.view(view.pick) |