app/soc/logic/models/linkable.py
author Sverre Rabbelier <srabbelier@gmail.com>
Sun, 25 Jan 2009 16:25:17 +0000
changeset 986 e9611a2288ca
parent 689 46db8c4bbffc
child 1307 091a21cf3627
permissions -rw-r--r--
Rename ModelProperties to EntityProperties We use 'model' when referring to the db.Model, the context in which 'ModelProperties' was used we really mean 'entity', which refers to an instantiation of the model. Patch by: Sverre Rabbelier
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
334
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     2
#
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     3
# Copyright 2008 the Melange authors.
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     4
#
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     8
#
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    10
#
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    16
678
b982d9175605 Added a linkable logic module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 674
diff changeset
    17
"""Linkable (Model) query functions.
334
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    18
"""
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    19
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    20
__authors__ = [
429
e50e18936f06 Fixed typo in e-mail address
Sverre Rabbelier <srabbelier@gmail.com>
parents: 334
diff changeset
    21
  '"Sverre Rabbelier" <sverre@rabbelier.nl>',
334
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    22
  ]
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    23
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    24
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    25
from soc.logic.models import base
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    26
678
b982d9175605 Added a linkable logic module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 674
diff changeset
    27
import soc.models.linkable
334
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    28
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    29
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    30
class Logic(base.Logic):
678
b982d9175605 Added a linkable logic module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 674
diff changeset
    31
  """Logic methods for the Linkable model.
b982d9175605 Added a linkable logic module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 674
diff changeset
    32
b982d9175605 Added a linkable logic module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 674
diff changeset
    33
  Note: Logic classes should not inherit from this class, instead
b982d9175605 Added a linkable logic module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 674
diff changeset
    34
  it is meant to be referred to with scope_logic.
334
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    35
  """
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    36
678
b982d9175605 Added a linkable logic module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 674
diff changeset
    37
  def __init__(self):
334
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    38
    """Defines the name, key_name and model for this entity.
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    39
    """
655
9635cbaa2dcd Cleanups to the logic module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 535
diff changeset
    40
678
b982d9175605 Added a linkable logic module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 674
diff changeset
    41
    super(Logic, self).__init__(soc.models.linkable.Linkable)
b982d9175605 Added a linkable logic module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 674
diff changeset
    42
b982d9175605 Added a linkable logic module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 674
diff changeset
    43
  def getScopeDepth(self):
689
46db8c4bbffc Add missing dots in docstrings in modules.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 678
diff changeset
    44
    """Returns the scope depth for this entity.
678
b982d9175605 Added a linkable logic module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 674
diff changeset
    45
b982d9175605 Added a linkable logic module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 674
diff changeset
    46
    As it is impossible to determine the scope depth of a Linkable,
b982d9175605 Added a linkable logic module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 674
diff changeset
    47
    None is returned. This causes the scope regexp to match a scope
b982d9175605 Added a linkable logic module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 674
diff changeset
    48
    with an arbitrary depth. 
b982d9175605 Added a linkable logic module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 674
diff changeset
    49
    """
b982d9175605 Added a linkable logic module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 674
diff changeset
    50
b982d9175605 Added a linkable logic module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 674
diff changeset
    51
    return None
443
94568ac6e3e1 Implements base.Logic functions in home_settings, site_settings and work
Sverre Rabbelier <srabbelier@gmail.com>
parents: 436
diff changeset
    52
334
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    53
0d0e96b12551 Add nameHomeSettings function to key_name module. Add HomeSettings logic.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    54
logic = Logic()