Module EDUtilsTable
[hide private]
[frames] | no frames]

Source Code for Module EDUtilsTable

 1  # 
 2  #    Project: The EDNA Kernel 
 3  #             http://www.edna-site.org 
 4  # 
 5  #    File: "$Id$" 
 6  # 
 7  #    Copyright (C) 2008-2009 European Synchrotron Radiation Facility 
 8  #                            Grenoble, France 
 9  # 
10  #    Principal authors: Marie-Francoise Incardona (incardon@esrf.fr) 
11  #                       Olof Svensson (svensson@esrf.fr)  
12  # 
13  #    This program is free software: you can redistribute it and/or modify 
14  #    it under the terms of the GNU Lesser General Public License as published 
15  #    by the Free Software Foundation, either version 3 of the License, or 
16  #    (at your option) any later version. 
17  # 
18  #    This program is distributed in the hope that it will be useful, 
19  #    but WITHOUT ANY WARRANTY; without even the implied warranty of 
20  #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
21  #    GNU Lesser General Public License for more details. 
22  # 
23  #    You should have received a copy of the GNU General Public License 
24  #    and the GNU Lesser General Public License  along with this program.   
25  #    If not, see <http://www.gnu.org/licenses/>. 
26  # 
27   
28  __authors__ = [ "Marie-Francoise Incardona", "Olof Svensson" ] 
29  __contact__ = "svensson@esrf.fr" 
30  __license__ = "LGPLv3+" 
31  __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" 
32 33 34 35 -class EDUtilsTable:
36 """ 37 This class allows to handle "dna_tables" objects. 38 39 See http://www.edna-site.org/svn/trunk/edna/kernel/datamodel/XSDataDnaTables.xsd 40 for the definition of "dna_tables". 41 """ 42 43 @staticmethod
44 - def getTableListFromTables(_dna_table, _strTableName):
45 """ 46 Returns a list of "table" objects from a "dna_table" object which matches a given table name. 47 """ 48 listTables = [] 49 for table in _dna_table.getTable(): 50 if table.getName() == _strTableName: 51 listTables.append(table) 52 return listTables
53 54 55 @staticmethod
56 - def getTableFromTables(_dna_table, _strTableName):
57 """ 58 Returns the last "table" object of name "_strTableName" from a "dna_tables" object 59 """ 60 tableMatch = None 61 for table in _dna_table.getTable(): 62 if table.getName() == _strTableName: 63 tableMatch = table 64 return tableMatch
65 66 67 @staticmethod
68 - def getListsFromTable(_table, _strListName):
69 """ 70 Returns a list of "list" objects which matches "_strListName" in a give "table" object 71 """ 72 listOfListMatch = [] 73 # Here we use "dnalist" instead of "list" because "list" is a built-in Python keyword 74 for dnaList in _table.getList(): 75 if dnaList.getName() == _strListName: 76 listOfListMatch.append(dnaList) 77 return listOfListMatch
78 79 80 @staticmethod
81 - def getItemFromList(_list, _strItemName):
82 """ 83 Returns the last "item" object that matches _strItemName in a given "list" object 84 """ 85 itemMatch = None 86 for item in _list.getItem(): 87 if item.getName() == _strItemName: 88 itemMatch = item 89 return itemMatch
90