Commit edfb3766 authored by Julien Muchembled's avatar Julien Muchembled

Allow an overriding section to unset 'url' in order to instead define 'inline'

Example:

foo.cfg:

  [foo]
  url = ...

bar.cfg:

  [buildout]
  extends = foo.cfg

  [foo]
  url =
  inline = blablah

Recipes must not distinguish the existence of an option from an empty
option value. It's a common mistake in recipes because that's natural
to do that in Python. However, buildout has no syntax to remove an
option when overriding a section.
parent 5d9fdf26
...@@ -76,19 +76,17 @@ class Recipe(object): ...@@ -76,19 +76,17 @@ class Recipe(object):
def _template(self, options): def _template(self, options):
inline = options.get('inline') inline = options.get('inline')
try: url = options.get('url')
url = options['url'] if url:
except KeyError: if inline:
if inline is None: raise UserError("options 'inline' & 'url' conflict")
raise return False, url
if inline:
if self.md5sum: if self.md5sum:
raise UserError("options 'inline' & 'md5sum' conflict") raise UserError("options 'inline' & 'md5sum' conflict")
self.md5sum = True # tell update() to do nothing self.md5sum = True # tell update() to do nothing
return True, inline return True, inline
else: raise UserError("one of the options 'inline' 'url' is required")
if inline:
raise UserError("options 'inline' & 'url' conflict")
return False, url
def _init(self, name, options): def _init(self, name, options):
self.output = options['output'] self.output = options['output']
......
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