Changeset 3611


Ignore:
Timestamp:
14/03/08 16:42:24 (11 years ago)
Author:
cbyrom
Message:

Add redirect in controller for viewItems if not items are currently selected - to avoid page crash.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/viewItems.py

    r3607 r3611  
    2828        #    selected items; 
    2929        # ii) or from the selections tab - which will already have set up the correct selected items 
    30          
    31         # firstly check if page has been visited before; if not display tab 
    32         if (Utilities.isTabRequired(c.pageTabs, 'View')): 
    33             c.pageTabs.append(('View', h.url_for(controller='viewItems',action='index'))) 
    3430             
    3531        # if ENDPOINT specified, we've reached the page via the WMC icon 
    3632        if ('ENDPOINT' in self.inputs): 
    3733            self.addViewItem(self.inputs['ENDPOINT']) 
    38                                      
     34         
     35        # avoid page crashing if we come here without view items defined 
     36        if 'viewItems' not in session: 
     37            h.redirect_to(h.url_for(controller='discovery')) 
     38                                         
    3939        session.save() 
     40         
     41        # check if page has been visited before; if not display tab 
     42        if (Utilities.isTabRequired(c.pageTabs, 'View')): 
     43            c.pageTabs.append(('View', h.url_for(controller='viewItems',action='index'))) 
     44 
    4045        return render('viewItems') 
    4146 
Note: See TracChangeset for help on using the changeset viewer.