app/soc/logic/models/mentor.py
author Sverre Rabbelier <srabbelier@gmail.com>
Thu, 26 Feb 2009 16:51:35 +0000
changeset 1516 8df06dc877aa
parent 1307 091a21cf3627
child 1955 06ed84dbb1ed
permissions -rw-r--r--
Do not update newly created model properties There is no real reason to favor old behavior over the current, plus the new behavior saves an extra disk write (which are expensive). Patch by: Sverre Rabbelier
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1121
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
77c602de9248 Added mentor and org_admin 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: 1121
diff changeset
     3
# Copyright 2009 the Melange authors.
1121
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     4
#
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     8
#
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    10
#
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    16
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    17
"""Mentor (Model) query functions.
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    18
"""
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    19
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    20
__authors__ = [
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    21
  '"Lennard de Rijk" <ljvderijk@gmail.com>',
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    22
  ]
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    23
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    24
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    25
from soc.logic.models import role
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    26
from soc.logic.models import organization as org_logic
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    27
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    28
import soc.models.mentor
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    29
import soc.models.role
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    30
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    31
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    32
class Logic(role.Logic):
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    33
  """Logic methods for the Mentor model.
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    34
  """
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    35
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    36
  def __init__(self, model=soc.models.mentor.Mentor,
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    37
               base_model=soc.models.role.Role, scope_logic=org_logic):
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    38
    """Defines the name, key_name and model for this entity.
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    39
    """
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    40
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    41
    super(Logic, self).__init__(model=model, base_model=base_model,
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    42
                                scope_logic=scope_logic)
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    43
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    44
77c602de9248 Added mentor and org_admin logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    45
logic = Logic()