prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  nikola bootswatch_theme paper installs slate
  I seem to be getting an issue when I try to install the [paper](https://bootswatch.com/paper/) theme from bootswatch by running `nikola bootswatch_theme paper`, it seems to install slate instead. 
  
  The output is as follows:
  
  ```
  $ nikola bootswatch_theme paper
  [2015-04-16T00:24:34Z] WARNING: Nikola: Your BASE_URL doesn't end in / -- adding it, but please fix it in your config file!
  [2015-04-16T00:24:34Z] WARNING: Nikola: In order to USE_BUNDLES, you must install the "webassets" Python package.
  [2015-04-16T00:24:34Z] WARNING: bundles: Setting USE_BUNDLES to False.
  [2015-04-16T00:24:34Z] INFO: bootswatch_theme: Creating 'custom' theme from 'slate' and 'bootstrap3'
  [2015-04-16T00:24:34Z] INFO: bootswatch_theme: Downloading: http://bootswatch.com/slate/bootstrap.min.css
  INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): bootswatch.com
  [2015-04-16T00:24:34Z] INFO: bootswatch_theme: Downloading: http://bootswatch.com/slate/bootstrap.css
  INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): bootswatch.com
  [2015-04-16T00:24:34Z] NOTICE: bootswatch_theme: Theme created.  Change the THEME setting to "custom" to use it.
  ```
  
  If you notice it says `Creating 'custom' theme from 'slate' and 'bootstrap3'` and installs slate instead. 
  
  This is on osx but I was able replicate it on my friends box as well which is running fedora.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `nikola/plugins/command/bootswatch_theme.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 
  3 # Copyright © 2012-2015 Roberto Alsina and others.
  4 
  5 # Permission is hereby granted, free of charge, to any
  6 # person obtaining a copy of this software and associated
  7 # documentation files (the "Software"), to deal in the
  8 # Software without restriction, including without limitation
  9 # the rights to use, copy, modify, merge, publish,
  10 # distribute, sublicense, and/or sell copies of the
  11 # Software, and to permit persons to whom the Software is
  12 # furnished to do so, subject to the following conditions:
  13 #
  14 # The above copyright notice and this permission notice
  15 # shall be included in all copies or substantial portions of
  16 # the Software.
  17 #
  18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
  19 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  20 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  21 # PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
  22 # OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  23 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  24 # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  25 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26 
  27 from __future__ import print_function
  28 import os
  29 
  30 try:
  31     import requests
  32 except ImportError:
  33     requests = None  # NOQA
  34 
  35 from nikola.plugin_categories import Command
  36 from nikola import utils
  37 
  38 LOGGER = utils.get_logger('bootswatch_theme', utils.STDERR_HANDLER)
  39 
  40 
  41 class CommandBootswatchTheme(Command):
  42     """Given a swatch name from bootswatch.com and a parent theme, creates a custom theme."""
  43 
  44     name = "bootswatch_theme"
  45     doc_usage = "[options]"
  46     doc_purpose = "given a swatch name from bootswatch.com and a parent theme, creates a custom"\
  47         " theme"
  48     cmd_options = [
  49         {
  50             'name': 'name',
  51             'short': 'n',
  52             'long': 'name',
  53             'default': 'custom',
  54             'type': str,
  55             'help': 'New theme name (default: custom)',
  56         },
  57         {
  58             'name': 'swatch',
  59             'short': 's',
  60             'default': 'slate',
  61             'type': str,
  62             'help': 'Name of the swatch from bootswatch.com.'
  63         },
  64         {
  65             'name': 'parent',
  66             'short': 'p',
  67             'long': 'parent',
  68             'default': 'bootstrap3',
  69             'help': 'Parent theme name (default: bootstrap3)',
  70         },
  71     ]
  72 
  73     def _execute(self, options, args):
  74         """Given a swatch name and a parent theme, creates a custom theme."""
  75         if requests is None:
  76             utils.req_missing(['requests'], 'install Bootswatch themes')
  77 
  78         name = options['name']
  79         swatch = options['swatch']
  80         parent = options['parent']
  81         version = ''
  82 
  83         # See if we need bootswatch for bootstrap v2 or v3
  84         themes = utils.get_theme_chain(parent)
  85         if 'bootstrap3' not in themes and 'bootstrap3-jinja' not in themes:
  86             version = '2'
  87         elif 'bootstrap' not in themes and 'bootstrap-jinja' not in themes:
  88             LOGGER.warn('"bootswatch_theme" only makes sense for themes that use bootstrap')
  89         elif 'bootstrap3-gradients' in themes or 'bootstrap3-gradients-jinja' in themes:
  90             LOGGER.warn('"bootswatch_theme" doesn\'t work well with the bootstrap3-gradients family')
  91 
  92         LOGGER.info("Creating '{0}' theme from '{1}' and '{2}'".format(name, swatch, parent))
  93         utils.makedirs(os.path.join('themes', name, 'assets', 'css'))
  94         for fname in ('bootstrap.min.css', 'bootstrap.css'):
  95             url = 'http://bootswatch.com'
  96             if version:
  97                 url += '/' + version
  98             url = '/'.join((url, swatch, fname))
  99             LOGGER.info("Downloading: " + url)
  100             data = requests.get(url).text
  101             with open(os.path.join('themes', name, 'assets', 'css', fname),
  102                       'wb+') as output:
  103                 output.write(data.encode('utf-8'))
  104 
  105         with open(os.path.join('themes', name, 'parent'), 'wb+') as output:
  106             output.write(parent.encode('utf-8'))
  107         LOGGER.notice('Theme created.  Change the THEME setting to "{0}" to use it.'.format(name))
  108
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/nikola/plugins/command/bootswatch_theme.py b/nikola/plugins/command/bootswatch_theme.py
  --- a/nikola/plugins/command/bootswatch_theme.py
  +++ b/nikola/plugins/command/bootswatch_theme.py
  @@ -26,6 +26,7 @@
   
   from __future__ import print_function
   import os
  +import sys
   
   try:
       import requests
  @@ -57,7 +58,7 @@
           {
               'name': 'swatch',
               'short': 's',
  -            'default': 'slate',
  +            'default': '',
               'type': str,
               'help': 'Name of the swatch from bootswatch.com.'
           },
  @@ -77,6 +78,9 @@
   
           name = options['name']
           swatch = options['swatch']
  +        if not swatch:
  +            LOGGER.error('The -s option is mandatory')
  +            sys.exit(1)
           parent = options['parent']
           version = ''
  
verification_info: {"golden_diff": "diff --git a/nikola/plugins/command/bootswatch_theme.py b/nikola/plugins/command/bootswatch_theme.py\n--- a/nikola/plugins/command/bootswatch_theme.py\n+++ b/nikola/plugins/command/bootswatch_theme.py\n@@ -26,6 +26,7 @@\n \n from __future__ import print_function\n import os\n+import sys\n \n try:\n     import requests\n@@ -57,7 +58,7 @@\n         {\n             'name': 'swatch',\n             'short': 's',\n-            'default': 'slate',\n+            'default': '',\n             'type': str,\n             'help': 'Name of the swatch from bootswatch.com.'\n         },\n@@ -77,6 +78,9 @@\n \n         name = options['name']\n         swatch = options['swatch']\n+        if not swatch:\n+            LOGGER.error('The -s option is mandatory')\n+            sys.exit(1)\n         parent = options['parent']\n         version = ''\n", "issue": "nikola bootswatch_theme paper installs slate\nI seem to be getting an issue when I try to install the [paper](https://bootswatch.com/paper/) theme from bootswatch by running `nikola bootswatch_theme paper`, it seems to install slate instead. \n\nThe output is as follows:\n\n```\n$ nikola bootswatch_theme paper\n[2015-04-16T00:24:34Z] WARNING: Nikola: Your BASE_URL doesn't end in / -- adding it, but please fix it in your config file!\n[2015-04-16T00:24:34Z] WARNING: Nikola: In order to USE_BUNDLES, you must install the \"webassets\" Python package.\n[2015-04-16T00:24:34Z] WARNING: bundles: Setting USE_BUNDLES to False.\n[2015-04-16T00:24:34Z] INFO: bootswatch_theme: Creating 'custom' theme from 'slate' and 'bootstrap3'\n[2015-04-16T00:24:34Z] INFO: bootswatch_theme: Downloading: http://bootswatch.com/slate/bootstrap.min.css\nINFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): bootswatch.com\n[2015-04-16T00:24:34Z] INFO: bootswatch_theme: Downloading: http://bootswatch.com/slate/bootstrap.css\nINFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): bootswatch.com\n[2015-04-16T00:24:34Z] NOTICE: bootswatch_theme: Theme created.  Change the THEME setting to \"custom\" to use it.\n```\n\nIf you notice it says `Creating 'custom' theme from 'slate' and 'bootstrap3'` and installs slate instead. \n\nThis is on osx but I was able replicate it on my friends box as well which is running fedora.\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n# Copyright \u00a9 2012-2015 Roberto Alsina and others.\n\n# Permission is hereby granted, free of charge, to any\n# person obtaining a copy of this software and associated\n# documentation files (the \"Software\"), to deal in the\n# Software without restriction, including without limitation\n# the rights to use, copy, modify, merge, publish,\n# distribute, sublicense, and/or sell copies of the\n# Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice\n# shall be included in all copies or substantial portions of\n# the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY\n# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\n# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR\n# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\n# OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR\n# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfrom __future__ import print_function\nimport os\n\ntry:\n    import requests\nexcept ImportError:\n    requests = None  # NOQA\n\nfrom nikola.plugin_categories import Command\nfrom nikola import utils\n\nLOGGER = utils.get_logger('bootswatch_theme', utils.STDERR_HANDLER)\n\n\nclass CommandBootswatchTheme(Command):\n    \"\"\"Given a swatch name from bootswatch.com and a parent theme, creates a custom theme.\"\"\"\n\n    name = \"bootswatch_theme\"\n    doc_usage = \"[options]\"\n    doc_purpose = \"given a swatch name from bootswatch.com and a parent theme, creates a custom\"\\\n        \" theme\"\n    cmd_options = [\n        {\n            'name': 'name',\n            'short': 'n',\n            'long': 'name',\n            'default': 'custom',\n            'type': str,\n            'help': 'New theme name (default: custom)',\n        },\n        {\n            'name': 'swatch',\n            'short': 's',\n            'default': 'slate',\n            'type': str,\n            'help': 'Name of the swatch from bootswatch.com.'\n        },\n        {\n            'name': 'parent',\n            'short': 'p',\n            'long': 'parent',\n            'default': 'bootstrap3',\n            'help': 'Parent theme name (default: bootstrap3)',\n        },\n    ]\n\n    def _execute(self, options, args):\n        \"\"\"Given a swatch name and a parent theme, creates a custom theme.\"\"\"\n        if requests is None:\n            utils.req_missing(['requests'], 'install Bootswatch themes')\n\n        name = options['name']\n        swatch = options['swatch']\n        parent = options['parent']\n        version = ''\n\n        # See if we need bootswatch for bootstrap v2 or v3\n        themes = utils.get_theme_chain(parent)\n        if 'bootstrap3' not in themes and 'bootstrap3-jinja' not in themes:\n            version = '2'\n        elif 'bootstrap' not in themes and 'bootstrap-jinja' not in themes:\n            LOGGER.warn('\"bootswatch_theme\" only makes sense for themes that use bootstrap')\n        elif 'bootstrap3-gradients' in themes or 'bootstrap3-gradients-jinja' in themes:\n            LOGGER.warn('\"bootswatch_theme\" doesn\\'t work well with the bootstrap3-gradients family')\n\n        LOGGER.info(\"Creating '{0}' theme from '{1}' and '{2}'\".format(name, swatch, parent))\n        utils.makedirs(os.path.join('themes', name, 'assets', 'css'))\n        for fname in ('bootstrap.min.css', 'bootstrap.css'):\n            url = 'http://bootswatch.com'\n            if version:\n                url += '/' + version\n            url = '/'.join((url, swatch, fname))\n            LOGGER.info(\"Downloading: \" + url)\n            data = requests.get(url).text\n            with open(os.path.join('themes', name, 'assets', 'css', fname),\n                      'wb+') as output:\n                output.write(data.encode('utf-8'))\n\n        with open(os.path.join('themes', name, 'parent'), 'wb+') as output:\n            output.write(parent.encode('utf-8'))\n        LOGGER.notice('Theme created.  Change the THEME setting to \"{0}\" to use it.'.format(name))\n", "path": "nikola/plugins/command/bootswatch_theme.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\n# Copyright \u00a9 2012-2015 Roberto Alsina and others.\n\n# Permission is hereby granted, free of charge, to any\n# person obtaining a copy of this software and associated\n# documentation files (the \"Software\"), to deal in the\n# Software without restriction, including without limitation\n# the rights to use, copy, modify, merge, publish,\n# distribute, sublicense, and/or sell copies of the\n# Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice\n# shall be included in all copies or substantial portions of\n# the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY\n# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\n# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR\n# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\n# OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR\n# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfrom __future__ import print_function\nimport os\nimport sys\n\ntry:\n    import requests\nexcept ImportError:\n    requests = None  # NOQA\n\nfrom nikola.plugin_categories import Command\nfrom nikola import utils\n\nLOGGER = utils.get_logger('bootswatch_theme', utils.STDERR_HANDLER)\n\n\nclass CommandBootswatchTheme(Command):\n    \"\"\"Given a swatch name from bootswatch.com and a parent theme, creates a custom theme.\"\"\"\n\n    name = \"bootswatch_theme\"\n    doc_usage = \"[options]\"\n    doc_purpose = \"given a swatch name from bootswatch.com and a parent theme, creates a custom\"\\\n        \" theme\"\n    cmd_options = [\n        {\n            'name': 'name',\n            'short': 'n',\n            'long': 'name',\n            'default': 'custom',\n            'type': str,\n            'help': 'New theme name (default: custom)',\n        },\n        {\n            'name': 'swatch',\n            'short': 's',\n            'default': '',\n            'type': str,\n            'help': 'Name of the swatch from bootswatch.com.'\n        },\n        {\n            'name': 'parent',\n            'short': 'p',\n            'long': 'parent',\n            'default': 'bootstrap3',\n            'help': 'Parent theme name (default: bootstrap3)',\n        },\n    ]\n\n    def _execute(self, options, args):\n        \"\"\"Given a swatch name and a parent theme, creates a custom theme.\"\"\"\n        if requests is None:\n            utils.req_missing(['requests'], 'install Bootswatch themes')\n\n        name = options['name']\n        swatch = options['swatch']\n        if not swatch:\n            LOGGER.error('The -s option is mandatory')\n            sys.exit(1)\n        parent = options['parent']\n        version = ''\n\n        # See if we need bootswatch for bootstrap v2 or v3\n        themes = utils.get_theme_chain(parent)\n        if 'bootstrap3' not in themes and 'bootstrap3-jinja' not in themes:\n            version = '2'\n        elif 'bootstrap' not in themes and 'bootstrap-jinja' not in themes:\n            LOGGER.warn('\"bootswatch_theme\" only makes sense for themes that use bootstrap')\n        elif 'bootstrap3-gradients' in themes or 'bootstrap3-gradients-jinja' in themes:\n            LOGGER.warn('\"bootswatch_theme\" doesn\\'t work well with the bootstrap3-gradients family')\n\n        LOGGER.info(\"Creating '{0}' theme from '{1}' and '{2}'\".format(name, swatch, parent))\n        utils.makedirs(os.path.join('themes', name, 'assets', 'css'))\n        for fname in ('bootstrap.min.css', 'bootstrap.css'):\n            url = 'http://bootswatch.com'\n            if version:\n                url += '/' + version\n            url = '/'.join((url, swatch, fname))\n            LOGGER.info(\"Downloading: \" + url)\n            data = requests.get(url).text\n            with open(os.path.join('themes', name, 'assets', 'css', fname),\n                      'wb+') as output:\n                output.write(data.encode('utf-8'))\n\n        with open(os.path.join('themes', name, 'parent'), 'wb+') as output:\n            output.write(parent.encode('utf-8'))\n        LOGGER.notice('Theme created.  Change the THEME setting to \"{0}\" to use it.'.format(name))\n", "path": "nikola/plugins/command/bootswatch_theme.py"}]}