app/soc/logic/models/site.py
changeset 702 e3b91b6955ff
parent 655 9635cbaa2dcd
child 752 e9a45874fe37
equal deleted inserted replaced
701:d6f5d34cff5a 702:e3b91b6955ff
    31 
    31 
    32 class Logic(presence.Logic):
    32 class Logic(presence.Logic):
    33   """Logic methods for the Site model.
    33   """Logic methods for the Site model.
    34   """
    34   """
    35 
    35 
    36   DEF_SITE_SCOPE_PATH = 'site'
    36   DEF_SITE_LINK_ID = 'site'
    37   DEF_SITE_LINK_ID = 'home'
       
    38   DEF_SITE_HOME_DOC_LINK_ID = 'home'
       
    39 
    37 
    40   def __init__(self, model=soc.models.site.Site,
    38   def __init__(self, model=soc.models.site.Site,
    41                base_model=soc.models.presence.Presence):
    39                base_model=soc.models.presence.Presence):
    42     """Defines the name, key_name and model for this entity.
    40     """Defines the name, key_name and model for this entity.
    43     """
    41     """
    44 
    42 
    45     super(Logic, self).__init__(model=model, base_model=base_model)
    43     super(Logic, self).__init__(model=model, base_model=base_model)
    46 
    44 
    47   def getKeyValues(self, unused_entity):
    45   def getKeyValues(self, entity):
    48     """Returns the default key values for the site settings.
    46     """Returns the key values for the site settings.
    49 
    47 
    50     The Site entity is always expected to be a singleton, so this method
    48     The Site entity is a singleton, so this method returns a
    51     returns the hard-coded scope and link_id.
    49     hard-coded link_id.
       
    50 
       
    51     Args:
       
    52       entity: unused
    52     """
    53     """
    53 
    54 
    54     return [self.DEF_SITE_SCOPE_PATH, 
    55     return [self.DEF_SITE_LINK_ID]
    55             self.DEF_SITE_LINK_ID]
    56 
       
    57   def getKeyValuesFromFields(self, fields):
       
    58     """Extracts the key values from a dict and returns them.
       
    59 
       
    60     The Site entity is a singleton, so this method returns a
       
    61     hard-coded link_id.
       
    62 
       
    63     Args:
       
    64       fields: unused
       
    65     """
       
    66 
       
    67     return [self.DEF_SITE_LINK_ID]
       
    68 
       
    69   def getKeyFieldNames(self):
       
    70     """Returns an array with the names of the Key Fields.
       
    71 
       
    72     The Site entity is an unscoped singleton, it's key fields consist
       
    73     of just the link_id.
       
    74     """
       
    75 
       
    76     return ['link_id']
    56 
    77 
    57 
    78 
    58 logic = Logic()
    79 logic = Logic()