source: exist/trunk/python/ndgeXist/ndgXqueries.py @ 3110

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/exist/trunk/python/ndgeXist/ndgXqueries.py@3110
Revision 3110, 759 bytes checked in by lawrence, 12 years ago (diff)

Attempts to eggify the ndg exist interfaces continue

Line 
1import pkg_resources
2class ndgXqueries(object):
3    ''' Holds a set of ndg xqueries after having read them from disk (which is
4    done in order to share the xqueries amongst different applications and
5    programming languages '''
6    def __init__(self,directory='xquery'):
7        ''' Loads up xqueries from the internal package directory '''
8        files=pkg_resources.resource_listdir('ndgeXist',directory)
9        print files
10        self.xq=dict([(f.strip('.xq'),pkg_resources.resource_string(__name__,f)) for f in files])
11    def __setitem__(self,key,value):
12        ''' Add a new xquery to the xquery database '''
13        self.xq[key]=value
14    def __getitem__(self,key):
15        return self.xq[key]
16    def keys(self):
17        return self.xq.keys()
Note: See TracBrowser for help on using the repository browser.