Changeset 3249


Ignore:
Timestamp:
21/01/08 13:40:05 (12 years ago)
Author:
lawrence
Message:

These fixes make the semantic search crash a bit more
graceful ... (ticket:934)

Location:
TI05-delivery/ows_framework/trunk/ows_server/ows_server
Files:
3 edited

Legend:

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

    r3093 r3249  
    300300        vs=VS(proxyServer=self.cf.get('DEFAULT','proxyServer')) 
    301301        if 'searchString' in self.inputs: 
    302             [broader,narrower,synonyms]=vs.getRelated(self.inputs['searchString']) 
    303             #get a base string for the links to new searches 
    304             if 'start' in self.inputs: del self.inputs['start'] 
    305             if 'howmany' in self.inputs: del self.inputs['howmany'] 
    306             self.inputs['searchString']='###SEARCHSSTRING###' 
    307             q='%s/discovery?'%g.server 
    308             for i in self.inputs: q+='%s=%s&'%(i,self.inputs[i]) 
    309             url=q[0:-1] 
    310             # and now build the links  
    311             c.narrower=[] 
    312             c.broader=[] 
    313             c.synonyms=[] 
    314             for i in narrower: 
    315                 c.narrower.append((i,url.replace('###SEARCHSSTRING###',i))) 
    316             for i in broader: 
    317                 c.broader.append((i,url.replace('###SEARCHSSTRING###',i))) 
    318             for i in synonyms: 
    319                 c.synonyms.append((i,url.replace('###SEARCHSSTRING###',i))) 
    320             if c.narrower!=[] or c.broader!=[] or c.synonyms!=[]: c.semAvailable=1 
     302            try: 
     303                [broader,narrower,synonyms]=vs.getRelated(self.inputs['searchString']) 
     304                #get a base string for the links to new searches 
     305                if 'start' in self.inputs: del self.inputs['start'] 
     306                if 'howmany' in self.inputs: del self.inputs['howmany'] 
     307                self.inputs['searchString']='###SEARCHSSTRING###' 
     308                q='%s/discovery?'%g.server 
     309                for i in self.inputs: q+='%s=%s&'%(i,self.inputs[i]) 
     310                url=q[0:-1] 
     311                # and now build the links  
     312                c.narrower=[] 
     313                c.broader=[] 
     314                c.synonyms=[] 
     315                for i in narrower: 
     316                    c.narrower.append((i,url.replace('###SEARCHSSTRING###',i))) 
     317                for i in broader: 
     318                    c.broader.append((i,url.replace('###SEARCHSSTRING###',i))) 
     319                for i in synonyms: 
     320                    c.synonyms.append((i,url.replace('###SEARCHSSTRING###',i))) 
     321                if c.narrower!=[] or c.broader!=[] or c.synonyms!=[]: c.semAvailable=1 
     322            except IOError,e: 
     323                c.semAvailable=0 
     324                c.semError=' (No valid reply from vocabulary service)' 
     325                #This should go in a log file ... 
     326                print 'ERROR: Vocabulary Service: %s (for search [%s])'%(str(e),self.inputs['searchString']) 
    321327        else: 
    322328            broader,narrower,synonyms=[],[],[] 
    323329            c.semAvailable=0 
     330            c.semError='.' 
    324331         
    325332        return render_response('semantic',fragment=True) 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/models/DocumentRetrieve.py

    r3075 r3249  
    138138    def get(self,url): 
    139139        request=urllib2.Request(url) 
    140         response='Error obtaining remote file: ' 
     140        response='Cannot obtain remote file: ' 
    141141        try: 
    142142            f = self.opener.open(request) 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/semantic.kid

    r3073 r3249  
    1515                </span>. 
    1616            </span> 
    17             <span py:if="not c.semAvailable">No alternatives available.</span> 
     17            <span py:if="not c.semAvailable">No alternatives available$c.semError</span> 
    1818        </div> 
    1919    </body> 
Note: See TracChangeset for help on using the changeset viewer.