author | Sverre Rabbelier <srabbelier@gmail.com> |
Sat, 06 Dec 2008 14:25:24 +0000 | |
changeset 682 | 187f4d95fedb |
parent 655 | 9635cbaa2dcd |
child 702 | e3b91b6955ff |
permissions | -rw-r--r-- |
308
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/python2.5 |
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
2 |
# |
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
3 |
# Copyright 2008 the Melange authors. |
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
4 |
# |
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
6 |
# you may not use this file except in compliance with the License. |
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
7 |
# You may obtain a copy of the License at |
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
8 |
# |
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
10 |
# |
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
11 |
# Unless required by applicable law or agreed to in writing, software |
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
14 |
# See the License for the specific language governing permissions and |
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
15 |
# limitations under the License. |
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
16 |
|
534
c31cfbf1a20f
Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents:
530
diff
changeset
|
17 |
"""Site (Model) query functions. |
308
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
18 |
""" |
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
19 |
|
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
20 |
__authors__ = [ |
429
e50e18936f06
Fixed typo in e-mail address
Sverre Rabbelier <srabbelier@gmail.com>
parents:
347
diff
changeset
|
21 |
'"Sverre Rabbelier" <sverre@rabbelier.nl>', |
308
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
22 |
] |
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
23 |
|
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
24 |
|
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
25 |
from soc.logic.models import base |
534
c31cfbf1a20f
Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents:
530
diff
changeset
|
26 |
from soc.logic.models import presence |
316
9efdc7bc3565
Add missing blank lines between imports and sort all of the imports.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
308
diff
changeset
|
27 |
|
534
c31cfbf1a20f
Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents:
530
diff
changeset
|
28 |
import soc.models.presence |
c31cfbf1a20f
Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents:
530
diff
changeset
|
29 |
import soc.models.site |
308
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
30 |
|
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
31 |
|
534
c31cfbf1a20f
Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents:
530
diff
changeset
|
32 |
class Logic(presence.Logic): |
c31cfbf1a20f
Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents:
530
diff
changeset
|
33 |
"""Logic methods for the Site model. |
308
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
34 |
""" |
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
35 |
|
534
c31cfbf1a20f
Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents:
530
diff
changeset
|
36 |
DEF_SITE_SCOPE_PATH = 'site' |
c31cfbf1a20f
Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents:
530
diff
changeset
|
37 |
DEF_SITE_LINK_ID = 'home' |
512
aae25d2b4464
Rename link_name to link_id everywhere, regardless of case (so LINK_NAME
Todd Larsen <tlarsen@google.com>
parents:
499
diff
changeset
|
38 |
DEF_SITE_HOME_DOC_LINK_ID = 'home' |
347
52676c696cd4
First phase of making the / (site/home) view generic enough to use it for
Todd Larsen <tlarsen@google.com>
parents:
319
diff
changeset
|
39 |
|
535
9045b8888772
Refactor classes in soc/logic/models to make more use of inheritance. Add
Todd Larsen <tlarsen@google.com>
parents:
534
diff
changeset
|
40 |
def __init__(self, model=soc.models.site.Site, |
9045b8888772
Refactor classes in soc/logic/models to make more use of inheritance. Add
Todd Larsen <tlarsen@google.com>
parents:
534
diff
changeset
|
41 |
base_model=soc.models.presence.Presence): |
308
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
42 |
"""Defines the name, key_name and model for this entity. |
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
43 |
""" |
655
9635cbaa2dcd
Cleanups to the logic module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
537
diff
changeset
|
44 |
|
9635cbaa2dcd
Cleanups to the logic module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
537
diff
changeset
|
45 |
super(Logic, self).__init__(model=model, base_model=base_model) |
308
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
46 |
|
537
f2bd9c465a6d
Fix getKeyValues() method footprint mismatches in soc.logic.models.site.Logic
Todd Larsen <tlarsen@google.com>
parents:
535
diff
changeset
|
47 |
def getKeyValues(self, unused_entity): |
499
d22e4fe8e64b
Fix missing dots in doc strings and some other doc string corrections.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
481
diff
changeset
|
48 |
"""Returns the default key values for the site settings. |
535
9045b8888772
Refactor classes in soc/logic/models to make more use of inheritance. Add
Todd Larsen <tlarsen@google.com>
parents:
534
diff
changeset
|
49 |
|
9045b8888772
Refactor classes in soc/logic/models to make more use of inheritance. Add
Todd Larsen <tlarsen@google.com>
parents:
534
diff
changeset
|
50 |
The Site entity is always expected to be a singleton, so this method |
9045b8888772
Refactor classes in soc/logic/models to make more use of inheritance. Add
Todd Larsen <tlarsen@google.com>
parents:
534
diff
changeset
|
51 |
returns the hard-coded scope and link_id. |
499
d22e4fe8e64b
Fix missing dots in doc strings and some other doc string corrections.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
481
diff
changeset
|
52 |
""" |
446
0b479d573a4c
Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
445
diff
changeset
|
53 |
|
534
c31cfbf1a20f
Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents:
530
diff
changeset
|
54 |
return [self.DEF_SITE_SCOPE_PATH, |
c31cfbf1a20f
Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents:
530
diff
changeset
|
55 |
self.DEF_SITE_LINK_ID] |
446
0b479d573a4c
Refactoring of {site/home}_settings to make them use base.View
Sverre Rabbelier <srabbelier@gmail.com>
parents:
445
diff
changeset
|
56 |
|
308
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
57 |
|
740090cd17c9
Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
58 |
logic = Logic() |