author | Pawel Solyga <Pawel.Solyga@gmail.com> |
Thu, 20 Nov 2008 22:51:07 +0000 | |
changeset 524 | 774b379e058c |
parent 512 | aae25d2b4464 |
child 530 | 8d5adb2b8d48 |
permissions | -rw-r--r-- |
495
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/python2.5 |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
2 |
# |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
3 |
# Copyright 2008 the Melange authors. |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
4 |
# |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
6 |
# you may not use this file except in compliance with the License. |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
7 |
# You may obtain a copy of the License at |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
8 |
# |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
10 |
# |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
11 |
# Unless required by applicable law or agreed to in writing, software |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
14 |
# See the License for the specific language governing permissions and |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
15 |
# limitations under the License. |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
16 |
|
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
17 |
"""Host (Model) query functions. |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
18 |
""" |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
19 |
|
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
20 |
__authors__ = [ |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
21 |
'"Sverre Rabbelier" <sverer@rabbelier.nl>', |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
22 |
] |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
23 |
|
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
24 |
|
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
25 |
from soc.logic import key_name |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
26 |
from soc.logic.models import base |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
27 |
|
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
28 |
import soc.models.request |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
29 |
|
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
30 |
|
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
31 |
class Logic(base.Logic): |
499
d22e4fe8e64b
Fix missing dots in doc strings and some other doc string corrections.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
495
diff
changeset
|
32 |
"""Logic methods for the Request model. |
495
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
33 |
""" |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
34 |
|
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
35 |
def __init__(self): |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
36 |
"""Defines the name, key_name and model for this entity. |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
37 |
""" |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
38 |
|
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
39 |
base.Logic.__init__(self, soc.models.request.Request) |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
40 |
|
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
41 |
def getKeyValues(self, entity): |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
42 |
"""See base.Logic.getKeyNameValues. |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
43 |
""" |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
44 |
|
512
aae25d2b4464
Rename link_name to link_id everywhere, regardless of case (so LINK_NAME
Todd Larsen <tlarsen@google.com>
parents:
499
diff
changeset
|
45 |
return [entity.role, entity.to.link_id, entity.requester.link_id] |
495
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
46 |
|
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
47 |
def getKeyValuesFromFields(self, fields): |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
48 |
"""See base.Logic.getKeyValuesFromFields. |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
49 |
""" |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
50 |
|
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
51 |
return [fields['role'], fields['group_ln'], fields['user_ln']] |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
52 |
|
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
53 |
def getKeyFieldNames(self): |
499
d22e4fe8e64b
Fix missing dots in doc strings and some other doc string corrections.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
495
diff
changeset
|
54 |
"""See base.Logic.getKeyFieldNames. |
495
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
55 |
""" |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
56 |
|
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
57 |
return ['role', 'group_ln', 'user_ln'] |
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
58 |
|
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
59 |
|
87afae6e4c51
Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
60 |
logic = Logic() |