author | Lennard de Rijk <ljvderijk@gmail.com> |
Sat, 24 Oct 2009 15:14:11 -0700 | |
changeset 3036 | c703f3802841 |
parent 1307 | 091a21cf3627 |
permissions | -rw-r--r-- |
882
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/python2.5 |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
2 |
# |
1307
091a21cf3627
Update the copyright notice for 2009.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1147
diff
changeset
|
3 |
# Copyright 2009 the Melange authors. |
882
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
4 |
# |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
6 |
# you may not use this file except in compliance with the License. |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
7 |
# You may obtain a copy of the License at |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
8 |
# |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
10 |
# |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
11 |
# Unless required by applicable law or agreed to in writing, software |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
14 |
# See the License for the specific language governing permissions and |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
15 |
# limitations under the License. |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
16 |
|
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
17 |
"""Club Application (Model) query functions. |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
18 |
""" |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
19 |
|
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
20 |
__authors__ = [ |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
21 |
'"Lennard de Rijk" <ljvderijk@gmail.com>', |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
22 |
] |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
23 |
|
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
24 |
|
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
25 |
from soc.logic.models import group_app |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
26 |
|
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
27 |
import soc.models.club_app |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
28 |
import soc.models.group_app |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
29 |
|
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
30 |
|
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
31 |
class Logic(group_app.Logic): |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
32 |
"""Logic methods for the Club Application model. |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
33 |
""" |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
34 |
|
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
35 |
def __init__(self, model=soc.models.club_app.ClubApplication, |
1147
5b5ce5056a2a
Changed group_app to use scope_logic in constructor.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1115
diff
changeset
|
36 |
base_model=soc.models.group_app.GroupApplication, |
5b5ce5056a2a
Changed group_app to use scope_logic in constructor.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1115
diff
changeset
|
37 |
scope_logic=None): |
882
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
38 |
"""Defines the name, key_name and model for this entity. |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
39 |
""" |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
40 |
|
1147
5b5ce5056a2a
Changed group_app to use scope_logic in constructor.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1115
diff
changeset
|
41 |
super(Logic, self).__init__(model=model, base_model=base_model, |
5b5ce5056a2a
Changed group_app to use scope_logic in constructor.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1115
diff
changeset
|
42 |
scope_logic=scope_logic) |
882
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
43 |
|
1115
0a723ff3d27c
Cleanups in base.Logic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1082
diff
changeset
|
44 |
def getKeyValuesFromEntity(self, entity): |
1082
946adb594793
Changed group_app logic to support scope_path.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
882
diff
changeset
|
45 |
"""See base.Logic.getKeyNameValues. |
946adb594793
Changed group_app logic to support scope_path.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
882
diff
changeset
|
46 |
""" |
946adb594793
Changed group_app logic to support scope_path.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
882
diff
changeset
|
47 |
|
946adb594793
Changed group_app logic to support scope_path.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
882
diff
changeset
|
48 |
return [entity.link_id] |
946adb594793
Changed group_app logic to support scope_path.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
882
diff
changeset
|
49 |
|
946adb594793
Changed group_app logic to support scope_path.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
882
diff
changeset
|
50 |
def getKeyValuesFromFields(self, fields): |
946adb594793
Changed group_app logic to support scope_path.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
882
diff
changeset
|
51 |
"""See base.Logic.getKeyValuesFromFields. |
946adb594793
Changed group_app logic to support scope_path.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
882
diff
changeset
|
52 |
""" |
946adb594793
Changed group_app logic to support scope_path.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
882
diff
changeset
|
53 |
|
946adb594793
Changed group_app logic to support scope_path.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
882
diff
changeset
|
54 |
return [fields['link_id']] |
946adb594793
Changed group_app logic to support scope_path.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
882
diff
changeset
|
55 |
|
946adb594793
Changed group_app logic to support scope_path.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
882
diff
changeset
|
56 |
def getKeyFieldNames(self): |
946adb594793
Changed group_app logic to support scope_path.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
882
diff
changeset
|
57 |
"""See base.Logic.getKeyFieldNames. |
946adb594793
Changed group_app logic to support scope_path.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
882
diff
changeset
|
58 |
""" |
946adb594793
Changed group_app logic to support scope_path.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
882
diff
changeset
|
59 |
|
946adb594793
Changed group_app logic to support scope_path.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
882
diff
changeset
|
60 |
return ['link_id'] |
946adb594793
Changed group_app logic to support scope_path.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
882
diff
changeset
|
61 |
|
882
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
62 |
|
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
63 |
logic = Logic() |