Changeset 8320


Ignore:
Timestamp:
17/05/12 14:56:11 (7 years ago)
Author:
jhorton
Message:

further exception handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/MolesManager/trunk/src/MolesManager/views/cedaBrowse.py

    r8319 r8320  
    2222    for v in record.identifier: 
    2323        if v.authority.title == 'ceda_title': 
    24             c['title'] = v.code 
     24            try: 
     25                c['title'] = v.code 
     26            except: 
     27                c['title'] = "" 
    2528        if v.authority.title == 'moles2url': 
    26             c['moles2url'] = v.code 
     29            try: 
     30                c['moles2url'] = v.code 
     31            except: 
     32                c['moles2url'] = "" 
    2733    for v in record.relatedParty: 
    2834        if v.role.name == 'cl_author': 
    29             c['author'] = v.party[0].name 
     35            try: 
     36                c['author'] = v.party[0].name 
     37            except: 
     38                c['author'] = "" 
    3039        if v.role.name == 'cl_pointofcontact': 
    3140            try: 
     
    4756    pubyear = record.resultTime.position.dateTime8601.year; 
    4857    c['citation'] = mark_safe(c['author'] + ";" + c['co_investigator'] + "(" + pubyear + ")" + c['title'] + " " + c['publisher'] + " Available from : <a href=\"http://www.ceda.ac.uk/datacat/" + c['guid'] + "\" target=\"_blank\">http://www.ceda.ac.uk/datacat/" + c['guid'] +"</a>"); 
    49     c['status'] = record.publicationState.value 
    50     c['last_update_year'] = record.resultTime.position.dateTime8601.year 
    51     c['last_update_month'] = record.resultTime.position.dateTime8601.month 
    52     c['last_update_day'] = record.resultTime.position.dateTime8601.day 
    53     c['phenomenon_begin_year'] = record.phenomenonTime.begin.position.date8601.year; 
    54     c['phenomenon_begin_month'] = record.phenomenonTime.begin.position.date8601.month; 
    55     c['phenomenon_begin_day'] = record.phenomenonTime.begin.position.date8601.day; 
    56     c['phenomenon_end_year'] = record.phenomenonTime.end.position.date8601.year; 
    57     c['phenomenon_end_month'] = record.phenomenonTime.end.position.date8601.month; 
    58     c['phenomenon_end_day'] = record.phenomenonTime.end.position.date8601.day; 
    59     c['vertical_extent'] = record.verticalExtent; 
    60     c['resolution'] = record.resolution; 
    61     c['observed_property'] = record.observedProperty; 
    62     c['parameters'] = record.parameter; 
    63     c['project_details'] = record.inSupportOf.relatedParty; 
    64     c['procedure'] = record.procedure; 
    65     c['lineage'] = record.dataLineage; 
    66     c['archive_no_files'] = record.result.numberOfFiles 
     58    try: 
     59        c['status'] = record.publicationState.value 
     60    except: 
     61        c['status'] = "" 
     62    try: 
     63        c['last_update_year'] = record.resultTime.position.dateTime8601.year 
     64    except: 
     65        c['last_update_year'] = "" 
     66    try: 
     67        c['last_update_month'] = record.resultTime.position.dateTime8601.month 
     68    except: 
     69        c['last_update_month'] = "" 
     70    try: 
     71        c['last_update_day'] = record.resultTime.position.dateTime8601.day 
     72    except: 
     73        c['last_update_day'] = "" 
     74    try: 
     75        c['phenomenon_begin_year'] = record.phenomenonTime.begin.position.date8601.year; 
     76    except: 
     77        c['phenomenon_begin_year'] = "" 
     78    try: 
     79        c['phenomenon_begin_month'] = record.phenomenonTime.begin.position.date8601.month; 
     80    except: 
     81        c['phenomenon_begin_month'] = "" 
     82    try: 
     83        c['phenomenon_begin_day'] = record.phenomenonTime.begin.position.date8601.day; 
     84    except: 
     85        c['phenomenon_begin_day'] = "" 
     86    try: 
     87        c['phenomenon_end_year'] = record.phenomenonTime.end.position.date8601.year; 
     88    except: 
     89        c['phenomenon_end_year'] = "" 
     90    try: 
     91        c['phenomenon_end_month'] = record.phenomenonTime.end.position.date8601.month; 
     92    except: 
     93        c['phenomenon_end_month'] = "" 
     94    try: 
     95        c['phenomenon_end_day'] = record.phenomenonTime.end.position.date8601.day; 
     96    except: 
     97        c['phenomenon_end_day'] = "" 
     98    try: 
     99        c['vertical_extent'] = record.verticalExtent; 
     100    except: 
     101        c['vertical_extent'] = "" 
     102    try: 
     103        c['resolution'] = record.resolution; 
     104    except: 
     105        c['resolution'] = "" 
     106    try: 
     107        c['observed_property'] = record.observedProperty; 
     108    except: 
     109        c['observed_property'] = "" 
     110    try: 
     111        c['parameters'] = record.parameter; 
     112    except: 
     113        c['parameters'] = "" 
     114    try: 
     115        c['project_details'] = record.inSupportOf.relatedParty; 
     116    except: 
     117        c['project_details'] = "" 
     118    try: 
     119        c['procedure'] = record.procedure; 
     120    except: 
     121        c['procedure'] = "" 
     122    try: 
     123        c['lineage'] = record.dataLineage; 
     124    except: 
     125        c['lineage'] = "" 
     126    try: 
     127        c['archive_no_files'] = record.result.numberOfFiles 
     128    except: 
     129        c['archive_no_files'] = "" 
    67130    try: 
    68131        c['geographic_extentE'] = record.geographicExtent[0].eastBoundLongitude 
     
    75138        c['geographic_extentN'] = 90 
    76139        c['geographic_extentS'] = -90 
    77     c['related_data'] = record.relatedObservation; 
    78     c['quality_statement'] = record.resultQuality 
    79     c['keywords'] = record.keywords[0].keyword[0]; 
    80     c['download_link'] = record.result.source[0].linkage 
    81     c['download_name'] = record.result.source[0].name 
     140    try: 
     141        c['related_data'] = record.relatedObservation; 
     142    except: 
     143        c['related_data'] = "" 
     144    try: 
     145        c['quality_statement'] = record.resultQuality 
     146    except: 
     147        c['quality_statement'] = "" 
     148    try: 
     149        c['keywords'] = record.keywords[0].keyword[0]; 
     150    except: 
     151        c['keywords'] = "" 
     152    try: 
     153        c['download_link'] = record.result.source[0].linkage 
     154    except: 
     155        c['download_link'] = "" 
     156    try: 
     157        c['download_name'] = record.result.source[0].name 
     158    except: 
     159        c['download_name'] =  "" 
    82160    try: 
    83161        if len(record.permission.useLimitation[0]) != 0: 
     
    94172          lk.append(ls) 
    95173    c['archive_linkage'] = lk 
    96     c['documentation'] = record.documentation 
     174    try: 
     175        c['documentation'] = record.documentation 
     176    except: 
     177        c['documentation'] = "" 
    97178    return render_to_response('cedaBrowse.html', c) 
    98179 
Note: See TracChangeset for help on using the changeset viewer.