-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
executable file
·68 lines (53 loc) · 2.49 KB
/
Copy path__init__.py
File metadata and controls
executable file
·68 lines (53 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
##############################################################################
# Removal of the "__license__" line or content from "__license__", or removal
# of "__author__" in this or any constituent # component or file constitutes a
# violation of the licensing and copyright agreement.
__author__ = "Mike Rightmire"
__copyright__ = "BioCom Software"
__license__ = "Telemend"
__license_file__= "Clause1.PERPETUAL_AND_UNLIMITED_LICENSING_TO_THE_CLIENT.py"
__version__ = "0.9.7.0"
__maintainer__ = "Mike Rightmire"
__email__ = "Mike.Rightmire@BiocomSoftware.com"
__status__ = "Development"
##############################################################################
from ConfigParser import SafeConfigParser
import inspect
import ntpath
class MESSAGE(object):
"""
"""
# __exists = False
def __new__(cls, key, *args, **kwargs):
key = str(key).lower()
if not hasattr(cls, 'instance'):
# Create instance
cls.instance = super(MESSAGE, cls).__new__(cls)
print 'if cls.instance=', cls.instance #3333
_path = inspect.getfile(cls.instance.__class__)
print '_path=', _path #333
_path, file = ntpath.split(_path)
print '_path=', _path #333
config = SafeConfigParser()
print 'config=', config #3333
_file = _path + '/messages.conf'
print '_file=', _file #333
config.read(_file)
for section in config.sections():
# Check for specific section, otherwise assume table
options = config.options(section)
for option in options:
print 'option=', option #3333
cls.instance.__dict__[option] = str(config.get(section, option))
result = ''.join([cls.instance.__dict__[key], "(args: ", str(args), ", kwargs: ", str(kwargs), "). "])
#
return result
else:
print 'else cls.instance=', cls.instance #3333
# cls.instance.__exists = True
# print 'MESSAGES object already exists' #333
# cls.instance.__exists = True
result = ''.join([cls.instance.__dict__[key], "(args: ", str(args), ", kwargs: ", str(kwargs), "). "])
return result
if __name__ == '__main__':
print MESSAGE('XLSXHandlerValueError', 'arg1', kwargs1 = '1')