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):
def _template(self, options):
inline = options.get('inline')
try:
url = options['url']
except KeyError:
if inline is None:
raise
url = options.get('url')
if url:
if inline:
raise UserError("options 'inline' & 'url' conflict")
return False, url
if inline:
if self.md5sum:
raise UserError("options 'inline' & 'md5sum' conflict")
self.md5sum = True # tell update() to do nothing
return True, inline
else:
if inline:
raise UserError("options 'inline' & 'url' conflict")
return False, url
raise UserError("one of the options 'inline' 'url' is required")
def _init(self, name, options):
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