[open-ils-commits] r793 - constrictor/trunk/constrictor (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Feb 23 21:35:52 EST 2010
Author: erickson
Date: 2010-02-23 21:35:50 -0500 (Tue, 23 Feb 2010)
New Revision: 793
Modified:
constrictor/trunk/constrictor/properties.py
Log:
missed some pythonification updates
Modified: constrictor/trunk/constrictor/properties.py
===================================================================
--- constrictor/trunk/constrictor/properties.py 2010-02-23 03:43:33 UTC (rev 792)
+++ constrictor/trunk/constrictor/properties.py 2010-02-24 02:35:50 UTC (rev 793)
@@ -5,7 +5,7 @@
Created - Anand B Pillai <abpillai at gmail.com>
Edited by Bill Erickson <billserickson at gmail.com>
- - 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 @@
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 @@
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 @@
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 @@
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 @@
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
More information about the open-ils-commits
mailing list