author | Lennard de Rijk <ljvderijk@gmail.com> |
Thu, 05 Feb 2009 20:19:17 +0000 | |
changeset 1218 | 569a3fe9cb88 |
parent 1140 | a8eaea0b268d |
child 1307 | 091a21cf3627 |
permissions | -rw-r--r-- |
802
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/python2.5 |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
2 |
# |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
3 |
# Copyright 2008 the Melange authors. |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
4 |
# |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
6 |
# you may not use this file except in compliance with the License. |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
7 |
# You may obtain a copy of the License at |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
8 |
# |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
10 |
# |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
11 |
# Unless required by applicable law or agreed to in writing, software |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
14 |
# See the License for the specific language governing permissions and |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
15 |
# limitations under the License. |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
16 |
|
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
17 |
"""Club Admin (Model) query functions. |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
18 |
""" |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
19 |
|
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
20 |
__authors__ = [ |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
21 |
'"Sverre Rabbelier" <sverre@rabbelier.nl>', |
916
f18c0a56da8b
Redid removeRequestForRole to completeRequestForRole.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
802
diff
changeset
|
22 |
'"Lennard de Rijk" <ljvderijk@gmail.com>', |
802
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
23 |
] |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
24 |
|
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
25 |
|
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
26 |
from soc.logic.models import role |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
27 |
from soc.logic.models import club as club_logic |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
28 |
|
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
29 |
import soc.models.club_admin |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
30 |
import soc.models.role |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
31 |
|
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
32 |
|
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
33 |
class Logic(role.Logic): |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
34 |
"""Logic methods for the Club Admin model. |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
35 |
""" |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
36 |
|
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
37 |
def __init__(self, model=soc.models.club_admin.ClubAdmin, |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
38 |
base_model=soc.models.role.Role, scope_logic=club_logic): |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
39 |
"""Defines the name, key_name and model for this entity. |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
40 |
""" |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
41 |
|
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
42 |
super(Logic, self).__init__(model=model, base_model=base_model, |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
43 |
scope_logic=scope_logic) |
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
44 |
|
1062
f7ee38ebfe1c
Creating a new host or club_admin will set the group state to active if it's new.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
944
diff
changeset
|
45 |
def _onCreate(self, entity): |
1085
0afbdd0905ef
Renamed state to status where appropriate.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1062
diff
changeset
|
46 |
"""Marks the Club for this Club Admin as active it's status is new. |
1062
f7ee38ebfe1c
Creating a new host or club_admin will set the group state to active if it's new.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
944
diff
changeset
|
47 |
""" |
f7ee38ebfe1c
Creating a new host or club_admin will set the group state to active if it's new.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
944
diff
changeset
|
48 |
|
f7ee38ebfe1c
Creating a new host or club_admin will set the group state to active if it's new.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
944
diff
changeset
|
49 |
club_entity = entity.scope |
f7ee38ebfe1c
Creating a new host or club_admin will set the group state to active if it's new.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
944
diff
changeset
|
50 |
|
1085
0afbdd0905ef
Renamed state to status where appropriate.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1062
diff
changeset
|
51 |
if club_entity.status == 'new': |
1062
f7ee38ebfe1c
Creating a new host or club_admin will set the group state to active if it's new.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
944
diff
changeset
|
52 |
# this club is new so mark as active |
1140
a8eaea0b268d
Style fixes in soc.logic.models modules (basically removing of extra whitespaces).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1085
diff
changeset
|
53 |
fields = {'status': 'active'} |
1062
f7ee38ebfe1c
Creating a new host or club_admin will set the group state to active if it's new.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
944
diff
changeset
|
54 |
club_logic.logic.updateEntityProperties(club_entity, fields) |
f7ee38ebfe1c
Creating a new host or club_admin will set the group state to active if it's new.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
944
diff
changeset
|
55 |
|
f7ee38ebfe1c
Creating a new host or club_admin will set the group state to active if it's new.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
944
diff
changeset
|
56 |
# call super |
f7ee38ebfe1c
Creating a new host or club_admin will set the group state to active if it's new.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
944
diff
changeset
|
57 |
super(Logic, self)._onCreate(entity) |
802
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
58 |
|
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
59 |
logic = Logic() |