CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
dbsFileQuery Namespace Reference

Functions

def dbsFileQuery
 

Function Documentation

def dbsFileQuery.dbsFileQuery (   query)

Definition at line 1 of file dbsFileQuery.py.

References parseString().

1 def dbsFileQuery(query):
2  # load the DBS API
3  import sys, os
4  dbsapipath = os.environ['DBSCMD_HOME']
5  if dbsapipath not in sys.path:
6  sys.path.append(dbsapipath)
7 
8  from dbsApi import DbsApi
9  api = DbsApi()
10 
11  # run the query, which should be of the form 'find file where ...'
12  results = api.executeQuery(query)
13 
14  # parse the results in XML format, and extract the list of files
15  from xml.dom.minidom import parseString
16  xml = parseString(results)
17 
18  files = []
19 
20  for results in xml.getElementsByTagName('results'):
21  for row in results.getElementsByTagName('row'):
22  for file in row.getElementsByTagName('file'):
23  files.append( file.firstChild.data )
24 
25  return files
26 
void parseString(std::string &title)
def dbsFileQuery
Definition: dbsFileQuery.py:1