git://git.onelab.eu
/
plcapi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
change the logic of clipping leases
[plcapi.git]
/
PLC
/
Config.py
diff --git
a/PLC/Config.py
b/PLC/Config.py
index
c1dbe70
..
690f9e3
100644
(file)
--- a/
PLC/Config.py
+++ b/
PLC/Config.py
@@
-1,4
+1,3
@@
-#!/usr/bin/python
#
# PLCAPI configuration store. Supports XML-based configuration file
# format exported by MyPLC.
#
# PLCAPI configuration store. Supports XML-based configuration file
# format exported by MyPLC.
@@
-29,11
+28,11
@@
class Config:
def __init__(self, file = "/etc/planetlab/plc_config"):
# Load plc_config
try:
def __init__(self, file = "/etc/planetlab/plc_config"):
# Load plc_config
try:
- exec
file(file
, self.__dict__)
+ exec
(compile(open(file).read(), file, 'exec')
, self.__dict__)
except:
# Try myplc directory
try:
except:
# Try myplc directory
try:
- exec
file(myplc + os.sep + "plc_config"
, self.__dict__)
+ exec
(compile(open(myplc + os.sep + "plc_config").read(), myplc + os.sep + "plc_config", 'exec')
, self.__dict__)
except:
raise PLCAPIError("Could not find plc_config in " + \
file + ", " + \
except:
raise PLCAPIError("Could not find plc_config in " + \
file + ", " + \
@@
-64,8
+63,8
@@
class XMLConfig:
file + ", " + \
myplc + os.sep + "plc_config.xml")
file + ", " + \
myplc + os.sep + "plc_config.xml")
- for (category, variablelist) in
cfg.variables().values(
):
- for variable in
variablelist.values(
):
+ for (category, variablelist) in
list(cfg.variables().values()
):
+ for variable in
list(variablelist.values()
):
# Try to cast each variable to an appropriate Python
# type.
if variable['type'] == "int":
# Try to cast each variable to an appropriate Python
# type.
if variable['type'] == "int":
@@
-91,4
+90,4
@@
class XMLConfig:
if __name__ == '__main__':
import pprint
pprint = pprint.PrettyPrinter()
if __name__ == '__main__':
import pprint
pprint = pprint.PrettyPrinter()
- pprint.pprint(
Config().__dict__.items(
))
+ pprint.pprint(
list(Config().__dict__.items()
))