Package install :: Package MoSTBioDat :: Package DataBase :: Package Connect :: Module MoSTBioDatDesc
[hide private]
[frames] | no frames]

Source Code for Module install.MoSTBioDat.DataBase.Connect.MoSTBioDatDesc

 1  #!/usr/bin/env python 
 2  ########################################## 
 3  # MoSTBioDatDesc.py:                     # 
 4  # Set descriptors for MoSTBioDatDB class # 
 5  ########################################## 
 6   
 7  ###################################################### 
 8  # Copyright (c) 2007-2008 Andrzej Bak                # 
 9  # ARC Seibersdorf & University of Silesia            # 
10  # Author: Andrzej Bak <Andrzej.Bak@us.edu.pl>        # 
11  # License: GNU General Public License, version: 3    # 
12  # URL: http://chemoinformatyka.us.edu.pl/mostbiodat/ # 
13  # Version: 1, 06.01.2010                             # 
14  ###################################################### 
15   
16 -class DescMostBioDat(object):
17 - def __init__(self,initial=None,name='var'):
18 self.val=initial 19 self.name=name
20 - def __set__(self,obj,value):pass
21 - def __get__(self,obj,objtype=None):pass
22 23
24 -class DescMoSTBioDat_host(DescMostBioDat):
25 - def __init__(self,initial=None,name='var'):
26 DescMostBioDat.__init__(self, initial, name)
27 - def __set__(self,obj,value):
28 self.val=value 29 values=['localhost','127.0.0.1'] 30 if self.val not in values: 31 print 'Correct %s value' %(self.name)
32 - def __get__(self,obj,objtype=None):
33 return self.val
34
35 -class DescMoSTBioDat_db(DescMostBioDat):
36 - def __init__(self,initial=None,name='var'):
37 DescMostBioDat.__init__(self, initial, name)
38 - def __set__(self,obj,value):
39 self.val=value 40 values=['Ligand','mysql','MacMol'] 41 if self.val not in values: 42 print 'Correct %s value' %(self.name)
43 - def __get__(self,obj,objtype=None):
44 return self.val
45
46 -class DescMoSTBioDat_port(DescMostBioDat):
47 - def __init__(self,initial=None,name='var'):
48 DescMostBioDat.__init__(self,initial,name)
49 - def __set__(self,obj,value):
50 try: 51 self.val=value 52 self.val=int(self.val) 53 if self.val !=3306: 54 print 'Warning: Connection on port %s' %self.val 55 except ValueError,e: 56 print e
57 - def __get__(self,obj,objtype=None):
58 return self.val
59 60 #################### MAIN ######################### 61 if __name__=='__main__': 62 pass 63