Changeset 5195 for ndgCommon/trunk


Ignore:
Timestamp:
15/04/09 10:41:56 (10 years ago)
Author:
cbyrom
Message:

Add additional check for empty link urls + add better error logging +
replace > escape characters with '>' values, since these don't need
to be escaped any more.

Location:
ndgCommon/trunk/ndg/common
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ndgCommon/trunk/ndg/common/src/lib/atomvalidator.py

    r5192 r5195  
    279279                    # unescape the link, just in case it has been encoded 
    280280                    url = unescape(link.href) 
     281                     
     282                    # NB, it is possible to specify links with only titles - catch these here 
     283                    if not url: 
     284                        self.__addError(self.BROKEN_LINKS, 
     285                                        "Missing URI for link with title, '%s'"%link.title) 
     286                        continue 
     287 
    281288                    # don't lookup link, if it has already been validated before 
    282289                    if url in self._validLinks: 
  • ndgCommon/trunk/ndg/common/src/lib/utilities.py

    r5192 r5195  
    200200        raise e 
    201201    except Exception, e: 
    202         logging.error("Exception thrown whilst verifying uri: '%s'" %e.message) 
     202        logging.error("Exception thrown whilst verifying uri: '%s'" %(e.message or e)) 
    203203 
    204204    logging.debug("- url appears to be invalid") 
  • ndgCommon/trunk/ndg/common/src/models/vocabtermdata.py

    r5192 r5195  
    148148                 LOGO_TERM:VocabTermItem('NOT YET SET UP', LOGO_TERM, title = 'Logo'), 
    149149                 NUM_SIM_TERM:VocabTermItem('http://vocab.ndg.nerc.ac.uk/term/N041', '7', title = 'NumSim description'), 
    150                  OPENDAP_TERM:VocabTermItem('http://vocab.ndg.nerc.ac.uk/term/P201', 'GCMDU010', title = 'GET DATA > OPENDAP DATA (DODS)'), 
    151                  THREDDS_TERM:VocabTermItem('http://vocab.ndg.nerc.ac.uk/term/P201', 'GCMDU013', title = 'GET DATA > THREDDS DATA'), 
    152                  WMS_TERM:VocabTermItem('http://vocab.ndg.nerc.ac.uk/term/P201', 'GCMDU026', title = 'GET SERVICE > GET WEB MAP SERVICE (WMS)'), 
    153                  WCS_TERM:VocabTermItem('http://vocab.ndg.nerc.ac.uk/term/P201', 'GCMDU024', title = 'GET SERVICE > GET WEB COVERAGE SERVICE (WCS)'), 
    154                  WFS_TERM:VocabTermItem('http://vocab.ndg.nerc.ac.uk/term/P201', 'GCMDU025', title = 'GET SERVICE > GET WEB FEATURE SERVICE (WFS)'), 
    155                  LAS_TERM:VocabTermItem('http://vocab.ndg.nerc.ac.uk/term/P201', 'GCMDU006', title = 'GET DATA > LAS'), 
     150                 OPENDAP_TERM:VocabTermItem('http://vocab.ndg.nerc.ac.uk/term/P201', 'GCMDU010', title = 'GET DATA > OPENDAP DATA (DODS)'), 
     151                 THREDDS_TERM:VocabTermItem('http://vocab.ndg.nerc.ac.uk/term/P201', 'GCMDU013', title = 'GET DATA > THREDDS DATA'), 
     152                 WMS_TERM:VocabTermItem('http://vocab.ndg.nerc.ac.uk/term/P201', 'GCMDU026', title = 'GET SERVICE > GET WEB MAP SERVICE (WMS)'), 
     153                 WCS_TERM:VocabTermItem('http://vocab.ndg.nerc.ac.uk/term/P201', 'GCMDU024', title = 'GET SERVICE > GET WEB COVERAGE SERVICE (WCS)'), 
     154                 WFS_TERM:VocabTermItem('http://vocab.ndg.nerc.ac.uk/term/P201', 'GCMDU025', title = 'GET SERVICE > GET WEB FEATURE SERVICE (WFS)'), 
     155                 LAS_TERM:VocabTermItem('http://vocab.ndg.nerc.ac.uk/term/P201', 'GCMDU006', title = 'GET DATA > LAS'), 
    156156                 DATA_EXTRACTOR_TERM:VocabTermItem('http://vocab.ndg.nerc.ac.uk/term/N041', '8', title = 'NDG DataExtractor'), 
    157157                 FILE_BROWSER_TERM:VocabTermItem('http://vocab.ndg.nerc.ac.uk/term/N041', '9', title = 'File Browser'), 
  • ndgCommon/trunk/ndg/common/unittests/models/testVocabTermData.py

    r4793 r5195  
    2323        vocab = self.vtd.getTermCurrentVocabURL(VTD.CSML_TERM) 
    2424        self.assertEquals(vocab, 'http://vocab.ndg.nerc.ac.uk/term/N021/2/1') 
     25 
     26    def testValidGetTermVocabURL2(self): 
     27        vocab = self.vtd.getTermCurrentVocabURL(VTD.LOGO_TERM) 
     28        self.assertEquals(vocab, 'NOT YET SET UP/None/LOGO') 
    2529         
    2630    def testGetLatestTermVersions(self): 
Note: See TracChangeset for help on using the changeset viewer.