Ignore:
Timestamp:
13/06/06 20:45:04 (14 years ago)
Author:
lawrence
Message:

Handling selection and browse history better ...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI07-MOLES/trunk/StubB/XSLT/browse/portal/cgi/browse/Utilities.py

    r1164 r1173  
    11from collections import deque # python 2.4 
     2import ElementTree as ET 
    23import ConfigParser 
    34import os 
     
    7980        result[item]=cgiFieldStorage[item].value 
    8081    return result 
    81  
     82## 
     83### convert the followign two methods into one class that can handle 
     84## xml directly too if necessary 
     85## 
     86def DIFid2NDGid(string): 
     87    ''' takes a dif thing parses it and produces an ET ndg element id ... 
     88    and use this in dif ... ''' 
     89    s=string.split(':') 
     90    try: 
     91        r='''<DIFid><schemeIdentifier>%s</schemeIdentifier> 
     92         <repositoryIdentifier>%s</repositoryIdentifier> 
     93         <localIdentifier>%s</localIdentifier></DIFid>'''%(s[1],s[0],s[2]) 
     94        return ET.fromstring(r) 
     95    except: 
     96        r='''<DIFid><schemeIdentifier>DIF</schemeIdentifier> 
     97        <repositoryIdentifier>Unknown</repositoryIdentifier> 
     98        <localIdentifier>%s</localIdentifier></DIFid>'''%string 
     99        return ET.fromstring(r) 
     100def idconvert(e): 
     101    ''' Converts an XML ndg identifier into a uri version ''' 
     102    s='%s:%s:%s'%(wrapGetText(e,'repositoryIdentifier'), 
     103                    wrapGetText(e,'schemeIdentifier'), 
     104                    wrapGetText(e,'localIdentifier')) 
     105    return s 
    82106 
    83107if __name__=="__main__": 
Note: See TracChangeset for help on using the changeset viewer.