Changeset 5081 for ndgCommon


Ignore:
Timestamp:
09/03/09 10:12:38 (11 years ago)
Author:
cbyrom
Message:

Add helper method to get subtype in human readable form from atom model

  • to cut down on code in templates.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ndgCommon/trunk/ndg/common/src/models/Atom.py

    r5019 r5081  
    236236    # format to use for t1-t2 date range 
    237237    YEAR_FORMAT = '%Y-%m-%d' 
     238 
     239    # subtype name, when not defined 
     240    SUB_TYPE_NOT_DEFINED_NAME = "Not currently defined" 
    238241 
    239242    def __init__(self, atomType = None, vocabTermData = None, ndgObject = None, \ 
     
    13711374        logging.debug("Atom doesn't currently exist in eXist - return 'None'") 
    13721375        return None 
     1376     
     1377     
     1378    def getSubTypePrettyName(self): 
     1379        ''' 
     1380        Return the subtype of the atom in a human readable form 
     1381        @return: sub type of atom as a verbose string 
     1382        ''' 
     1383        logging.debug("Getting human readable version of atom subtype") 
     1384        subType = self.SUB_TYPE_NOT_DEFINED_NAME 
     1385        if self.subtypeID: 
     1386           subType = self.VTD.tidySubTypeTitle(self.subtypeID) 
     1387            
     1388        logging.debug("- returning subtype: '%s'" %subType) 
     1389        return subType 
Note: See TracChangeset for help on using the changeset viewer.