Changeset 2045 for TI07-MOLES/trunk


Ignore:
Timestamp:
24/01/07 17:23:41 (13 years ago)
Author:
lawrence
Message:

Sundry modes to wsgi browse/discovery on the road to deploying on
glue (mostly about the many possible locations of elementtree)

Location:
TI07-MOLES/trunk/PythonCode/wsgi
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • TI07-MOLES/trunk/PythonCode/wsgi/00deploy.sh

    r1905 r2045  
    1 paster serve ndg.ini 
     1# edit the following line to point to your python if it's not the default one. 
     2# if you do edit it, make sure it has a trailing /! 
     3# 
     4MYPYTHONBIN= 
     5export PYTHONPATH=$PWD 
     6echo $PYTHONPATH 
     7${MYPYTHONBIN}paster serve ndg.ini 
    28# need to modifiy to have shell magic number, and get environmentand 
    39# add to python path 
  • TI07-MOLES/trunk/PythonCode/wsgi/DC.py

    r1934 r2045  
    2222                    self[name].append(u[1]) 
    2323                else: 
    24                     self[name]=[u[1]] 
     24                    self[name]=[self[name],u[1]] 
    2525            else: 
    2626                self.order.append(name) 
     
    2828             
    2929    def toHTML(self): 
     30         
     31        def __nicelist(item): 
     32            k='' 
     33            if isinstance(item,list): 
     34                k+=item[0] 
     35                for i in item[1:]: k+=', %s'%i 
     36            else: 
     37                k+=item 
     38            return k 
     39             
    3040        m='<div class="metadata">' 
    3141        h="%s<p>"%m 
     
    3343            h+=span(self['title'],'title')+'<br/>' 
    3444        if 'creator' in self.keys(): 
    35             h+=span(self['creator'],'title')+'<br/>' 
     45            h+=span(__nicelist(self['creator']),'title')+'<br/>' 
    3646        h+=m 
    3747        if 'description' in self.keys(): 
     
    4050            if key not in ['title','creator','description']: 
    4151                k=span(key,'keywords')+': ' 
    42                 if isinstance(self[key],list): 
    43                     k+=self[key][0] 
    44                     for i in self[key][1:]: k+=', %s'%i 
    45                 else: 
    46                     print key 
    47                     k+=self[key] 
     52                k+=__nicelist(self[key]) 
    4853                h+=span(k,'metaentry')+'<br/>' 
    4954        h+='</div></div>' 
     
    6469            http://www.openarchives.org/OAI/2.0/oai_dc.xsd">  
    6570            <dc:title> A test title</dc:title> 
     71            <dc:creator>Bryan</dc:creator> 
     72            <dc:creator>Anne</dc:creator> 
    6673            <dc:subject>A</dc:subject><dc:subject>B</dc:subject></oai_dc:dc>''' 
    6774        y=DC(x) 
     
    6976        print z 
    7077        a=y.toHTML() 
     78        print a 
    7179         
    7280if __name__=="__main__": 
  • TI07-MOLES/trunk/PythonCode/wsgi/DIF.py

    r1958 r2045  
    22# renderEntity etc ... 
    33# 
    4 from xml.etree import ElementTree as ET 
    54from Utilities import * 
    65from geoUtilities import * 
     
    98from ETxmlView import loadET, nsdumb 
    109from renderEntity import renderEntity 
     10try: #python 2.5 
     11    from xml.etree import ElementTree as ET 
     12except ImportError: 
     13    try: 
     14        # if you've installed it yourself it comes this way 
     15        import ElementTree as ET 
     16    except ImportError: 
     17        # if you've egged it this is the way it comes 
     18        from elementtree import ElementTree as ET 
    1119 
    1220class DIFService: 
  • TI07-MOLES/trunk/PythonCode/wsgi/DocumentRetrieve.py

    r1991 r2045  
    1111    xquery=xquery.replace('LocalID',localID,1) 
    1212    xquery=xquery.replace('/db/ndg_B_metadata', targetCollection) 
    13      
    1413    return xquery 
    1514     
     
    4847            id,summary=self.executeQuery(xquery) 
    4948            hits=summary['hits'] 
     49            print 'bnl',targetCollection,xquery 
    5050             
    5151            if hits!=1: raise ValueError,'%s documents returned for uri %s:%s:%s'%(hits,repository,'NDG-B0',localID) 
  • TI07-MOLES/trunk/PythonCode/wsgi/ETxmlView.py

    r1958 r2045  
    55# 
    66# Code to support xml and elementTree viewing as text and html 
    7  
    87try: #python 2.5 
    9     import xml.etree.ElementTree as ET 
    10 except: 
    11     import ElementTree as ET 
     8    from xml.etree import ElementTree as ET 
     9except ImportError: 
     10    try: 
     11        # if you've installed it yourself it comes this way 
     12        import ElementTree as ET 
     13    except ImportError: 
     14        # if you've egged it this is the way it comes 
     15        from elementtree import ElementTree as ET 
    1216import re 
    1317 
  • TI07-MOLES/trunk/PythonCode/wsgi/Utilities.py

    r1958 r2045  
    22try: #python 2.5 
    33    from xml.etree import ElementTree as ET 
    4 except: 
    5     import ElementTree as ET 
     4except ImportError: 
     5    try: 
     6        # if you've installed it yourself it comes this way 
     7        import ElementTree as ET 
     8    except ImportError: 
     9        # if you've egged it this is the way it comes 
     10        from elementtree import ElementTree as ET 
    611from ETxmlView import * 
    712import ConfigParser 
  • TI07-MOLES/trunk/PythonCode/wsgi/ndg.ini

    r1933 r2045  
    55# 
    66 
     7#[exe] 
     8#command=server 
     9#daemon=true 
     10#user=bnl 
     11#group=webuser 
     12 
    713[server:main] 
    814use = egg:PasteScript#wsgiutils 
    915host = localhost.localdomain 
    1016port = 8001 
     17#use = egg:PasteScript#flup_fcgi_thread 
     18#socket = /tmp/ndg.fastcgi.soc 
     19 
    1120 
    1221[DEFAULT] 
  • TI07-MOLES/trunk/PythonCode/wsgi/ndgSearch.py

    r1989 r2045  
    66import sys, time 
    77try: #python 2.5 
    8     import xml.etree.ElementTree as ET 
    9 except: 
    10     import ElementTree as ET 
     8    from xml.etree import ElementTree as ET 
     9except ImportError: 
     10    try: 
     11        # if you've installed it yourself it comes this way 
     12        import ElementTree as ET 
     13    except ImportError: 
     14        # if you've egged it this is the way it comes 
     15        from elementtree import ElementTree as ET 
    1116     
    1217from ETxmlView import loadET,et2text 
  • TI07-MOLES/trunk/PythonCode/wsgi/stubB.py

    r1925 r2045  
    55# BNL April 2006 
    66#  
    7 from xml.etree import ElementTree as ET 
    87from renderEntity import renderEntity 
    98from Utilities import * 
     
    1211from geoUtilities import Bounding 
    1312from People import * 
     13try: #python 2.5 
     14    from xml.etree import ElementTree as ET 
     15except ImportError: 
     16    try: 
     17        # if you've installed it yourself it comes this way 
     18        import ElementTree as ET 
     19    except ImportError: 
     20        # if you've egged it this is the way it comes 
     21        from elementtree import ElementTree as ET 
    1422 
    1523class dataGranule: 
Note: See TracChangeset for help on using the changeset viewer.