app/soc/logic/models/site_settings.py
author Sverre Rabbelier <srabbelier@gmail.com>
Wed, 05 Nov 2008 23:36:28 +0000
changeset 445 31927f21970d
parent 443 94568ac6e3e1
child 446 0b479d573a4c
permissions -rw-r--r--
Major site restructuring, also deleting of many unused or obsolete documents The new structure is as follows: <entity>/list - list all <entitie>s <entity>/create - create a new <entity> <entity>/show/<key fields> - public page for <entity> <entity>/edit/<key fields> - edit a <entity> <entity>/delete/key fields> - delete a specific entity
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
318
e8eeccd7ef0f Fix typos in doc string in sponsor.py and settings.py
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 316
diff changeset
    17
"""SiteSettings (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 import key_name
740090cd17c9 Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    26
from soc.logic.models import base
443
94568ac6e3e1 Implements base.Logic functions in home_settings, site_settings and work
Sverre Rabbelier <srabbelier@gmail.com>
parents: 436
diff changeset
    27
from soc.logic.models import home_settings
316
9efdc7bc3565 Add missing blank lines between imports and sort all of the imports.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 308
diff changeset
    28
308
740090cd17c9 Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    29
import soc.models.site_settings
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
443
94568ac6e3e1 Implements base.Logic functions in home_settings, site_settings and work
Sverre Rabbelier <srabbelier@gmail.com>
parents: 436
diff changeset
    32
class Logic(home_settings.Logic):
318
e8eeccd7ef0f Fix typos in doc string in sponsor.py and settings.py
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 316
diff changeset
    33
  """Logic methods for the SiteSettings 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
445
31927f21970d Major site restructuring, also deleting of many unused or obsolete documents
Sverre Rabbelier <srabbelier@gmail.com>
parents: 443
diff changeset
    36
  DEF_SITE_SETTINGS_PARTIAL_PATH = 'site'
31927f21970d Major site restructuring, also deleting of many unused or obsolete documents
Sverre Rabbelier <srabbelier@gmail.com>
parents: 443
diff changeset
    37
  DEF_SITE_SETTINGS_LINK_NAME = '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
    38
  DEF_SITE_HOME_DOC_LINK_NAME = 'home'
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
308
740090cd17c9 Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    40
  def __init__(self):
740090cd17c9 Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    41
    """Defines the name, key_name and model for this entity.
740090cd17c9 Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    42
    """
740090cd17c9 Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    43
432
1851d67a1004 Add a generic method for getting a Keyname
Sverre Rabbelier <srabbelier@gmail.com>
parents: 429
diff changeset
    44
    self._name = "SiteSettings"
308
740090cd17c9 Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    45
    self._model = soc.models.site_settings.SiteSettings
436
f3c313d54aa4 Add missing TODOs to soc.logic.models classes. Fix comments format in base.Logic class. Changes based on comments to r972.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 432
diff changeset
    46
    # TODO: remove line below when SiteSettings is implemented using 
f3c313d54aa4 Add missing TODOs to soc.logic.models classes. Fix comments format in base.Logic class. Changes based on comments to r972.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 432
diff changeset
    47
    # views.models.base.View approach
308
740090cd17c9 Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    48
    self._keyName = key_name.nameSiteSettings
740090cd17c9 Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    49
    self._skip_properties = []
740090cd17c9 Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    50
740090cd17c9 Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    51
740090cd17c9 Added invididual model logic files
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    52
logic = Logic()