Ignore:
Timestamp:
05/05/09 15:51:16 (10 years ago)
Author:
cbyrom
Message:

Add new field to provider info - email - to allow mailing of results
of document ingest results - since this needs to be done asynchronously

  • since it can take a considerable amount of time. Adjust controllers

and templates for this new field and add new tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI01-discovery/trunk/OAIInfoEditor/oai_info_editor/model/providerinfo.py

    r5242 r5251  
    1515PI_ROOT_EL_NAME = "providerInfo" 
    1616NAME_ATT_NAME = "name" 
     17EMAIL_ADDRESS_NAME = "email" 
    1718 
    1819 
    19 def createProviderInfoWithData(providerName, repositoryInfos): 
     20def createProviderInfoWithData(providerName, repositoryInfos, providerEmail = None): 
    2021    ''' 
    2122    Factory method to create ProviderInfo object with set values 
    2223    @param providerName: Name of the provider - NB, this should equal their login ID 
    2324    @param repositoryInfos:  RepositoryInfo objects with data on the providers repositories 
     25    @keyword providerEmail: email address for provider 
     26    @return ProviderInfo with specified data  
    2427    ''' 
    25     cr = ProviderInfo() 
    26     cr.setData(providerName, repositoryInfos) 
    27     return cr 
     28    pi = ProviderInfo() 
     29    pi.setData(providerName, repositoryInfos, providerEmail = providerEmail) 
     30    return pi 
    2831 
    2932 
     
    3336    # NB, 'oldName' is used when the provider name is being updated - so the 
    3437    # old record can be effectively updated 
    35     __slots__ = [NAME_ATT_NAME, 'repositoryInfos', 'oldName'] 
     38    __slots__ = [NAME_ATT_NAME, EMAIL_ADDRESS_NAME, 'repositoryInfos', 'oldName'] 
    3639 
    3740    def __init__(self, et = None): 
     
    5053 
    5154 
    52     def setData(self, providerName, repositoryInfos): 
     55    def setData(self, providerName, repositoryInfos, providerEmail = None): 
    5356        ''' 
    5457        Simple method to set data on object 
    5558        @param providerName: Name of the provider - NB, this should equal their login ID 
    5659        @param repositoryInfos:  RepositoryInfo objects with data on the providers repositories 
     60        @keyword providerEmail: email address for provider. Default = None 
    5761        ''' 
    5862        logging.debug("Setting data on ProviderInfo document object") 
     
    6064        self.oldName = self.name 
    6165        self.repositoryInfos = repositoryInfos 
     66        self.email = providerEmail 
    6267        logging.debug("ProviderInfo data set") 
    6368 
     
    7479 
    7580        self.name = et.attrib.get(NAME_ATT_NAME) 
     81        self.email = et.findtext(EMAIL_ADDRESS_NAME) or '' 
    7682        self.oldName = self.name 
    7783         
     
    96102        root = ET.Element(PI_ROOT_EL_NAME) 
    97103        root.attrib[NAME_ATT_NAME] = self.name 
     104 
     105        if self.email: 
     106            emailElement = ET.SubElement(root, EMAIL_ADDRESS_NAME) 
     107            emailElement.text = self.email 
    98108         
    99109        if self.repositoryInfos: 
Note: See TracChangeset for help on using the changeset viewer.