Commit 6009e5ac authored by Nicolas Wavrant's avatar Nicolas Wavrant

librecipe: better implementation of getValueFromPreviousRun using buildout API

The API call is made on a function existing both in buildout 1.7 and buildout 2.X
parent 2cbf8a1b
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# #
############################################################################## ##############################################################################
import ConfigParser
import io import io
import logging import logging
import os import os
...@@ -287,12 +286,7 @@ class GenericBaseRecipe(object): ...@@ -287,12 +286,7 @@ class GenericBaseRecipe(object):
Returns the value of a parameter from a previous run, if it exists. Returns the value of a parameter from a previous run, if it exists.
Otherwise, returns None Otherwise, returns None
""" """
if os.path.exists(self.buildout['buildout']['installed']): try:
with open(self.buildout['buildout']['installed']) as config_file: return self.buildout._read_installed_part_options()[section].get(parameter, None)
try: except KeyError:
parser = ConfigParser.RawConfigParser() return None
parser.readfp(config_file) \ No newline at end of file
return parser.get(section, parameter)
except:
pass
return None
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment