prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Error while trying to generate a configuration file without subfolder with CLI.
  ```
  $ kinto --ini kinto.ini
  
  Traceback (most recent call last):
    File "~/.virtualenvs/kinto/bin/kinto", line 9, in <module>
      load_entry_point('kinto', 'console_scripts', 'kinto')()
    File "~/mozilla/kinto/kinto/__main__.py", line 72, in main
      init(config_file, backend)
    File "~/mozilla/kinto/kinto/config/__init__.py", line 50, in init
      render_template("kinto.tpl", config_file, **values)
    File "~/mozilla/kinto/kinto/config/__init__.py", line 14, in render_template
      os.makedirs(folder)
    File "~/.virtualenvs/kinto/lib/python2.7/os.py", line 157, in makedirs
      mkdir(name, mode)
  OSError: [Errno 2] No such file or directory: ''
  ```
  
  
  </issue>
  <code>
  [start of kinto/config/__init__.py]
  1 import os
  2 import codecs
  3 
  4 from cliquet import utils as cliquet_utils
  5 
  6 from kinto import logger
  7 
  8 HERE = os.path.abspath(os.path.dirname(__file__))
  9 
  10 
  11 def render_template(template, destination, **kwargs):
  12     template = os.path.join(HERE, template)
  13     folder = os.path.dirname(destination)
  14 
  15     if not os.path.exists(folder):
  16         os.makedirs(folder)
  17 
  18     logger.info("Created config {}".format(os.path.abspath(destination)))
  19 
  20     with codecs.open(template, 'r', encoding='utf-8') as f:
  21         raw_template = f.read()
  22         rendered = raw_template.format(**kwargs)
  23         with codecs.open(destination, 'w+', encoding='utf-8') as output:
  24             output.write(rendered)
  25 
  26 
  27 def init(config_file, backend):
  28     values = {}
  29 
  30     values['secret'] = cliquet_utils.random_bytes_hex(32)
  31 
  32     values['storage_backend'] = "cliquet.storage.%s" % backend
  33     values['cache_backend'] = "cliquet.cache.%s" % backend
  34     values['permission_backend'] = "cliquet.permission.%s" % backend
  35 
  36     if backend == 'postgresql':
  37         postgresql_url = "postgres://postgres:postgres@localhost/postgres"
  38         values['storage_url'] = postgresql_url
  39         values['cache_url'] = postgresql_url
  40         values['permission_url'] = postgresql_url
  41 
  42     elif backend == 'redis':
  43         redis_url = "redis://localhost:6379"
  44         values['storage_url'] = redis_url + "/1"
  45         values['cache_url'] = redis_url + "/2"
  46         values['permission_url'] = redis_url + "/3"
  47 
  48     else:
  49         values['storage_url'] = ''
  50         values['cache_url'] = ''
  51         values['permission_url'] = ''
  52 
  53     render_template("kinto.tpl", config_file, **values)
  54
  [end of kinto/config/__init__.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/kinto/config/__init__.py b/kinto/config/__init__.py
  --- a/kinto/config/__init__.py
  +++ b/kinto/config/__init__.py
  @@ -12,7 +12,7 @@
       template = os.path.join(HERE, template)
       folder = os.path.dirname(destination)
   
  -    if not os.path.exists(folder):
  +    if folder and not os.path.exists(folder):
           os.makedirs(folder)
   
       logger.info("Created config {}".format(os.path.abspath(destination)))
  
verification_info: {"golden_diff": "diff --git a/kinto/config/__init__.py b/kinto/config/__init__.py\n--- a/kinto/config/__init__.py\n+++ b/kinto/config/__init__.py\n@@ -12,7 +12,7 @@\n     template = os.path.join(HERE, template)\n     folder = os.path.dirname(destination)\n \n-    if not os.path.exists(folder):\n+    if folder and not os.path.exists(folder):\n         os.makedirs(folder)\n \n     logger.info(\"Created config {}\".format(os.path.abspath(destination)))\n", "issue": "Error while trying to generate a configuration file without subfolder with CLI.\n```\n$ kinto --ini kinto.ini\n\nTraceback (most recent call last):\n  File \"~/.virtualenvs/kinto/bin/kinto\", line 9, in <module>\n    load_entry_point('kinto', 'console_scripts', 'kinto')()\n  File \"~/mozilla/kinto/kinto/__main__.py\", line 72, in main\n    init(config_file, backend)\n  File \"~/mozilla/kinto/kinto/config/__init__.py\", line 50, in init\n    render_template(\"kinto.tpl\", config_file, **values)\n  File \"~/mozilla/kinto/kinto/config/__init__.py\", line 14, in render_template\n    os.makedirs(folder)\n  File \"~/.virtualenvs/kinto/lib/python2.7/os.py\", line 157, in makedirs\n    mkdir(name, mode)\nOSError: [Errno 2] No such file or directory: ''\n```\n\n", "before_files": [{"content": "import os\nimport codecs\n\nfrom cliquet import utils as cliquet_utils\n\nfrom kinto import logger\n\nHERE = os.path.abspath(os.path.dirname(__file__))\n\n\ndef render_template(template, destination, **kwargs):\n    template = os.path.join(HERE, template)\n    folder = os.path.dirname(destination)\n\n    if not os.path.exists(folder):\n        os.makedirs(folder)\n\n    logger.info(\"Created config {}\".format(os.path.abspath(destination)))\n\n    with codecs.open(template, 'r', encoding='utf-8') as f:\n        raw_template = f.read()\n        rendered = raw_template.format(**kwargs)\n        with codecs.open(destination, 'w+', encoding='utf-8') as output:\n            output.write(rendered)\n\n\ndef init(config_file, backend):\n    values = {}\n\n    values['secret'] = cliquet_utils.random_bytes_hex(32)\n\n    values['storage_backend'] = \"cliquet.storage.%s\" % backend\n    values['cache_backend'] = \"cliquet.cache.%s\" % backend\n    values['permission_backend'] = \"cliquet.permission.%s\" % backend\n\n    if backend == 'postgresql':\n        postgresql_url = \"postgres://postgres:postgres@localhost/postgres\"\n        values['storage_url'] = postgresql_url\n        values['cache_url'] = postgresql_url\n        values['permission_url'] = postgresql_url\n\n    elif backend == 'redis':\n        redis_url = \"redis://localhost:6379\"\n        values['storage_url'] = redis_url + \"/1\"\n        values['cache_url'] = redis_url + \"/2\"\n        values['permission_url'] = redis_url + \"/3\"\n\n    else:\n        values['storage_url'] = ''\n        values['cache_url'] = ''\n        values['permission_url'] = ''\n\n    render_template(\"kinto.tpl\", config_file, **values)\n", "path": "kinto/config/__init__.py"}]}