CryptoBoxLogger is obsolete; removed some RFCs we discussed via jabber
This commit is contained in:
parent
76ec1ee0ca
commit
04c2719c8e
3 changed files with 12 additions and 13 deletions
|
@ -7,7 +7,6 @@ progress. So things might be confusing here. Hopefully not for long.
|
|||
:)
|
||||
'''
|
||||
|
||||
import CryptoBoxLogger
|
||||
import CryptoBoxContainer
|
||||
import types
|
||||
import re
|
||||
|
@ -33,7 +32,6 @@ class CryptoBox:
|
|||
|
||||
def __initLogging(self):
|
||||
import logging
|
||||
# RFC: this import should be at the top of the file - or at least (for clarity) be there in a comment line [l]
|
||||
'''initialises the logging system
|
||||
|
||||
use it with: 'self.log.[debug|info|warning|error|critical](logmessage)'
|
||||
|
@ -59,7 +57,6 @@ class CryptoBox:
|
|||
|
||||
|
||||
def __initPreferences(self, config_file):
|
||||
# RFC: this try-except should happen at the top of the script - or? [l]
|
||||
try:
|
||||
import configobj ## needed for reading and writing of the config file
|
||||
except:
|
||||
|
@ -104,6 +101,7 @@ class CryptoBox:
|
|||
|
||||
|
||||
# RFC: what is this method useful for?
|
||||
# as it claims, just for demonstrating inheritance effects
|
||||
def cbx_inheritance_test(self):
|
||||
print "you lucky widow"
|
||||
|
||||
|
@ -125,11 +123,6 @@ class CryptoBoxProps(CryptoBox):
|
|||
#print self.cbxPrefs.items()
|
||||
####
|
||||
|
||||
self.debug = CryptoBoxLogger.CryptoBoxLogger(
|
||||
self.cbxPrefs["Log"]["Level"],
|
||||
self.cbxPrefs["Log"]["Facility"],
|
||||
self.cbxPrefs["Log"]["Destination"])
|
||||
self.debugMessage = self.debug.printMessage
|
||||
self.containers = []
|
||||
for device in self.__getAvailablePartitions():
|
||||
if self.isDeviceAllowed(device):
|
||||
|
@ -154,8 +147,7 @@ class CryptoBoxProps(CryptoBox):
|
|||
if filterType in range(len(CryptoBoxContainer.Types)):
|
||||
return [e for e in self.containers if e.getType() == filterType]
|
||||
else:
|
||||
self.logger.debugMessage(
|
||||
"info", "invalid filterType (%d)" % filterType)
|
||||
self.log.info("invalid filterType (%d)" % filterType)
|
||||
result.clear()
|
||||
if filterName != None:
|
||||
result = [e for e in self.containers if e.getName() == filterName]
|
||||
|
@ -223,7 +215,7 @@ class CryptoBoxProps(CryptoBox):
|
|||
fpart.close()
|
||||
return [self.__getAbsoluteDeviceName(e) for e in ret_list]
|
||||
except IOError:
|
||||
self.debugMessage("Could not read /proc/partitions", "warn")
|
||||
self.log.warning("Could not read /proc/partitions")
|
||||
return []
|
||||
|
||||
|
||||
|
@ -331,13 +323,15 @@ cryptsetup = /sbin/cryptsetup
|
|||
|
||||
def testConfigFile(self):
|
||||
# RFC: which 'age' did a commit with a broken unittest? [l]
|
||||
# the class has changed, it reads the formerly given
|
||||
# configfile now out of the parent class
|
||||
# unittest works for me [a]
|
||||
CryptoBoxProps()
|
||||
self.assertTrue(os.path.exists(self.nameDBFile))
|
||||
self.assertTrue(os.path.exists(self.logFile))
|
||||
|
||||
|
||||
def testDeviceCheck(self):
|
||||
# RFC: dito [l]
|
||||
cb = CryptoBoxProps()
|
||||
self.assertTrue(cb.isDeviceAllowed("/dev/loop"))
|
||||
self.assertTrue(cb.isDeviceAllowed("/dev/loop1"))
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
'''
|
||||
this class will not be used anymore and can be removed from svn
|
||||
|
||||
manages logging events of the CryptoBox
|
||||
'''
|
||||
|
||||
|
|
|
@ -4,11 +4,14 @@ Maybe we can add some notes here to get a consistent coding experience :)
|
|||
|
||||
comments:
|
||||
- should be usable for pydoc
|
||||
- ''' or """ at the beginning of every class/method
|
||||
- ## for longterm comments, that are useful for understanding
|
||||
- #blabla for codelines, that are out for experimenting and might be used later again
|
||||
|
||||
error handling:
|
||||
- unspecific error handling is evil (try: "grep -r except: .")
|
||||
|
||||
unit testing:
|
||||
- write a unittest and then write the relating code until the unittest stops failing :)
|
||||
- commits with broken unit tests are evil (options: fix or disable)
|
||||
- all classes should contain exhaustive unit tests prior to the first release
|
||||
|
||||
|
|
Loading…
Reference in a new issue