app/soc/logic/models/base.py
changeset 535 9045b8888772
parent 534 c31cfbf1a20f
child 543 280a1ac6bcc1
equal deleted inserted replaced
534:c31cfbf1a20f 535:9045b8888772
   107     """Returns fully-qualified model module.class name string.
   107     """Returns fully-qualified model module.class name string.
   108     """ 
   108     """ 
   109     return '%s.%s' % (self._model.__module__, self._model.__name__)
   109     return '%s.%s' % (self._model.__module__, self._model.__name__)
   110 
   110 
   111   def getKeyValues(self, entity):
   111   def getKeyValues(self, entity):
   112     """Exctracts the key values from entity and returns them.
   112     """Extracts the key values from entity and returns them.
       
   113 
       
   114     The default implementation uses the scope and link_id as key values.
   113 
   115 
   114     Args:
   116     Args:
   115       entity: the entity from which to extract the key values
   117       entity: the entity from which to extract the key values
   116     """
   118     """
   117 
   119 
   118     raise NotImplementedError
   120     return [entity.scope_path, entity.link_id]
   119 
   121 
   120   def getSuffixValues(self, entity):
   122   def getSuffixValues(self, entity):
   121     """Returns an array with the public values of the Key Fields.
   123     """Returns an array with the public values of the Key Fields.
   122 
   124 
   123     Defaults to getKeyValues
   125     Defaults to getKeyValues
   129     """
   131     """
   130 
   132 
   131     return self.getKeyValues(entity)
   133     return self.getKeyValues(entity)
   132 
   134 
   133   def getKeyValuesFromFields(self, fields):
   135   def getKeyValuesFromFields(self, fields):
   134     """Exctracts the key values from a dict and returns them.
   136     """Extracts the key values from a dict and returns them.
       
   137 
       
   138     The default implementation uses the scope and link_id as key values.
   135 
   139 
   136     Args:
   140     Args:
   137       fields: the dict from which to extract the key values
   141       fields: the dict from which to extract the key values
   138     """
   142     """
   139 
   143 
   140     raise NotImplementedError
   144     return [fields['scope_path'], fields['link_id']]
   141 
   145 
   142   def getKeyFieldNames(self):
   146   def getKeyFieldNames(self):
   143     """Returns an array with the names of the Key Fields.
   147     """Returns an array with the names of the Key Fields.
   144     """
   148 
   145 
   149     The default implementation uses the scope and link_id as key values.
   146     raise NotImplementedError
   150     """
       
   151 
       
   152     return ['scope_path', 'link_id']
   147 
   153 
   148   def getKeySuffix(self, entity):
   154   def getKeySuffix(self, entity):
   149     """Returns a suffix for the specified entity or None if no entity specified.
   155     """Returns a suffix for the specified entity or None if no entity specified.
   150 
   156 
   151     Args:
   157     Args: