[Uludag-commits] r14653 - in trunk/staj-projeleri/zorg: comar zorg
uludag-commits at pardus.org.tr
uludag-commits at pardus.org.tr
2 Tem 2007 Pzt 16:05:58 EEST
Author: fatih
Date: Mon Jul 2 16:05:57 2007
New Revision: 14653
Added:
trunk/staj-projeleri/zorg/zorg/config.py
trunk/staj-projeleri/zorg/zorg/probe.py
Modified:
trunk/staj-projeleri/zorg/comar/xman.py
trunk/staj-projeleri/zorg/zorg/__init__.py
trunk/staj-projeleri/zorg/zorg/parser.py
Log:
Move some parts into zorg module
Modified: trunk/staj-projeleri/zorg/comar/xman.py
=================================================================
Suppressed!
Too long (more than 250 lines) diff output suppressed...
Modified: trunk/staj-projeleri/zorg/zorg/__init__.py
=================================================================
--- trunk/staj-projeleri/zorg/zorg/__init__.py (original)
+++ trunk/staj-projeleri/zorg/zorg/__init__.py Mon Jul 2 16:05:57 2007
@@ -12,10 +12,12 @@
__version__ = "0.1"
-__all__ = ["parser",
- "utils",
+__all__ = ["config",
"ddc",
- "modeline"]
+ "modeline",
+ "parser",
+ "probe",
+ "utils"]
def versionString():
Modified: trunk/staj-projeleri/zorg/zorg/parser.py
=================================================================
--- trunk/staj-projeleri/zorg/zorg/parser.py (original)
+++ trunk/staj-projeleri/zorg/zorg/parser.py Mon Jul 2 16:05:57 2007
@@ -1,10 +1,5 @@
# -*- coding: utf-8 -*-
-from ConfigParser import RawConfigParser, ParsingError
-
-zorgConfigDir = "/var/lib/zorg"
-zorgConfig = "config"
-
trueList = ("1", "on", "true", "yes", "enable")
falseList = ("0", "off", "false", "no", "disable")
@@ -205,68 +200,3 @@
s += "EndSection\n\n"
return s
-
-class ZorgConfig:
- def __init__(self):
- import os
-
- if not os.path.exists(zorgConfigDir):
- os.mkdir(zorgConfigDir, 0755)
-
- self.configFile = os.path.join(zorgConfigDir, zorgConfig)
-
- self.cp = RawConfigParser()
- try:
- self.cp.read(self.configFile)
- except ParsingError:
- pass
-
- self.setSection("General")
-
- def setSection(self, name):
- if not self.cp.has_section(name):
- self.cp.add_section(name)
-
- self.currentSection = name
-
- def hasSection(self, name):
- return self.cp.has_section(name)
-
- def hasOption(self, option, section=None):
- if section is None:
- section = self.currentSection
- return self.cp.has_option(section, option)
-
- def get(self, option, default = "", section=None):
- if section is None:
- section = self.currentSection
- if not self.cp.has_option(section, option):
- return default
-
- return self.cp.get(self.currentSection, option)
-
- def getBool(self, option, default = False, section=None):
- if section is None:
- section = self.currentSection
- if not self.cp.has_option(section, option):
- return default
-
- return self.cp.getboolean(self.currentSection, option)
-
- def getFloat(self, option, default = 0.0, section=None):
- if section is None:
- section = self.currentSection
- if not self.cp.has_option(section, option):
- return default
-
- return self.cp.getfloat(self.currentSection, option)
-
- def set(self, option, value, section=None):
- if section is None:
- section = self.currentSection
- self.cp.set(section, option, value)
-
- def write(self):
- f = file(self.configFile, "w")
- self.cp.write(f)
- f.close()
Uludag-commits mesaj listesiyle ilgili
daha fazla bilgi