From d454101db62b353022a773a19dba202809534770 Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 24 Feb 2010 02:35:50 +0000 Subject: [PATCH] missed some pythonification updates git-svn-id: svn://svn.open-ils.org/ILS-Contrib/constrictor/trunk@793 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- constrictor/properties.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/constrictor/properties.py b/constrictor/properties.py index eb7e6a501..c3ac41a10 100644 --- a/constrictor/properties.py +++ b/constrictor/properties.py @@ -5,7 +5,7 @@ This is modelled as closely as possible to the Java original. Created - Anand B Pillai Edited by Bill Erickson - - added getProperties to return a global properties object + - added get_properties to return a global properties object - added property name sorting to the store() method """ @@ -23,7 +23,7 @@ class IllegalArgumentException(Exception): s='Exception at line number %d => %s' % (self.lineno, self.msg) return s -globalProps = None +global_props = None class Properties(object): """ A Python replacement for java.util.Properties """ @@ -46,15 +46,15 @@ class Properties(object): self.othercharre2 = re.compile(r'(\s*\=)|(\s*\:)') self.bspacere = re.compile(r'\\(?!\s$)') - def getProperties(): - global globalProps - return globalProps - getProperties = staticmethod(getProperties) + def get_properties(): + global global_props + return global_props + get_properties = staticmethod(get_properties) - def setGlobalProperties(props): - global globalProps - globalProps = props - setGlobalProperties = staticmethod(setGlobalProperties) + def set_global_properties(props): + global global_props + global_props = props + set_global_properties = staticmethod(set_global_properties) def __str__(self): s='{' @@ -170,9 +170,9 @@ class Properties(object): else: key,value = line,'' - self.processPair(key, value) + self.process_pair(key, value) - def processPair(self, key, value): + def process_pair(self, key, value): """ Process a (key, value) pair """ oldkey = key @@ -246,20 +246,20 @@ class Properties(object): except IOError, e: raise - def getProperty(self, key): + def get_property(self, key): """ Return a property for the given key """ return self._props.get(key,'') - def setProperty(self, key, value): + def set_property(self, key, value): """ Set the property for the given key """ if type(key) is str and type(value) is str: - self.processPair(key, value) + self.process_pair(key, value) else: raise TypeError,'both key and value should be strings!' - def propertyNames(self): + def property_names(self): """ Return an iterator over all the keys of the property dictionary, i.e the names of the properties """ @@ -296,18 +296,18 @@ class Properties(object): except IOError, e: raise - def getPropertyDict(self): + def get_property_dict(self): return self._props def __getitem__(self, name): """ To support direct dictionary like access """ - return self.getProperty(name) + return self.get_property(name) def __setitem__(self, name, value): """ To support direct dictionary like access """ - self.setProperty(name, value) + self.set_property(name, value) def __getattr__(self, name): """ For attributes not found in self, redirect -- 2.11.0