app/soc/logic/models/base.py
changeset 671 2c02178037ff
parent 669 65b2475f1cc7
child 672 c8f9281f535b
equal deleted inserted replaced
670:d6a827adea26 671:2c02178037ff
    44 
    44 
    45   The BaseLogic class functions specific to Entity classes by relying
    45   The BaseLogic class functions specific to Entity classes by relying
    46   on arguments passed to __init__.
    46   on arguments passed to __init__.
    47   """
    47   """
    48 
    48 
    49   def __init__(self, model, base_model=None,
    49   def __init__(self, model, base_model=None, scope_logic=None,
    50                name=None, skip_properties=None):
    50                name=None, skip_properties=None):
    51     """Defines the name, key_name and model for this entity.
    51     """Defines the name, key_name and model for this entity.
    52     """
    52     """
    53 
    53 
    54     self._model = model
    54     self._model = model
    55     self._base_model = base_model
    55     self._base_model = base_model
       
    56     self._scope_logic = scope_logic
    56 
    57 
    57     if name:
    58     if name:
    58       self._name = name
    59       self._name = name
    59     else:
    60     else:
    60       self._name =  self._model.__name__
    61       self._name =  self._model.__name__
    67   def getModel(self):
    68   def getModel(self):
    68     """Returns the model this logic class uses
    69     """Returns the model this logic class uses
    69     """
    70     """
    70 
    71 
    71     return self._model
    72     return self._model
       
    73 
       
    74   def getScopeLogic(self):
       
    75     """Returns the logic of the enclosing scope
       
    76     """
       
    77 
       
    78     return self._scope_logic
    72 
    79 
    73   def _updateField(self, model, name, value):
    80   def _updateField(self, model, name, value):
    74     """Hook called when a field is updated.
    81     """Hook called when a field is updated.
    75 
    82 
    76     Base classes should override if any special actions need to be
    83     Base classes should override if any special actions need to be