Changeset 1592 for TI07-MOLES/trunk


Ignore:
Timestamp:
16/10/06 21:07:37 (13 years ago)
Author:
lawrence
Message:

Modifications to improve status of author information in DIF citation
group ...

Location:
TI07-MOLES/trunk/PythonCode/browse/portal/cgi/browse
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TI07-MOLES/trunk/PythonCode/browse/portal/cgi/browse/DIF.py

    r1577 r1592  
    7272        #Data Creators 
    7373        self.creators=[] 
     74        # use author here because a full dif entry for creator wont necessarily exist in citation ... 
     75        self.authors=helper.getText(self.tree,'Data_Set_Citation/Dataset_Creator') 
     76        self.date=dateParse(helper.getText(self.tree,'Data_Set_Citation/Dataset_Release_Date'),'YYYY') 
     77        self.title=helper.getText(self.tree,'Data_Set_Citation/Dataset_Title') 
     78        self.briefCitation=None 
     79        if (self.authors!='' and self.date!='' and self.title!=''): 
     80            self.briefCitation='%s (%s): %s'%(self.authors,self.date,self.title) 
    7481 
    7582        #services 
  • TI07-MOLES/trunk/PythonCode/browse/portal/cgi/browse/Utilities.py

    r1587 r1592  
    158158    if r==string: r=r+'1' 
    159159    return r 
     160 
     161def dateParse(string,instruction): 
     162    ''' Simple date manipulations on a string, if it is understood ...  
     163       if instruction = YYYY, return the year ''' 
     164    s=string.split('-') 
     165    if instruction=='YYYY': 
     166        if len(s)==3: # expecting year,mon,day or day,mon,year ...  
     167            if int(s[0])>int(s[2]):  
     168                return s[0] 
     169            else: 
     170                return s[2] 
     171        else: 
     172            return string # unknown format as yet ... 
     173    else: 
     174        return 'unknown instruction to dateParse %s'%instruction 
     175        
    160176if __name__=="__main__": 
    161177    s,t='abc12','def' 
  • TI07-MOLES/trunk/PythonCode/browse/portal/cgi/browse/renderDiscoverySet.py

    r1587 r1592  
    8585        else: 
    8686            ndg,slist=serviceList(d) 
    87             rlist=[abbreviate(d.name,60),] 
     87            rlist=['',] 
    8888            if summary: 
    89                 rlist[0]='%s: %s'%(span('Name','ndgem'),rlist[0]) 
     89                if d.briefCitation is not None: 
     90                    rlist[0]='%s: %s'%(span('Dataset','ndgem'),d.briefCitation) 
     91                else: 
     92                    rlist[0]='%s: %s'%(span('Title','ndgem'),abbreviate(d.name,60)) 
    9093                rlist[0]+='<br/>%s: %s'%(span('Summary','ndgem'),abbreviate(d.abstract,200)) 
    9194                rlist[0]+=' '+hyperlink('(more)',d.binding.url) 
Note: See TracChangeset for help on using the changeset viewer.