prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  new install - new_page fails
  steps to reproduce:
  
  1. install nikola.
  2. init a new project and cd to it's dir
  3. run "nikola new_page" throws an exception.
  4. however, run "nikola new_post -p" and it works just fine!??
  
  i am puzzled, why does "new_post -p" work and "new_page" fail???
  
  the exception trace i get is:
  Traceback (most recent call last):
    File "/home/smg/.virtualenvs_py3/nikola/lib/python3.5/site-packages/doit/doit_cmd.py", line 167, in run
      return command.parse_execute(args)
    File "/home/smg/.virtualenvs_py3/nikola/lib/python3.5/site-packages/doit/cmd_base.py", line 120, in parse_execute
      return self.execute(params, args)
    File "/home/smg/.virtualenvs_py3/nikola/lib/python3.5/site-packages/nikola/plugin_categories.py", line 130, in execute
      return self._execute(options, args)
    File "/home/smg/.virtualenvs_py3/nikola/lib/python3.5/site-packages/nikola/plugins/command/new_page.py", line 113, in _execute
      return p.execute(options, args)
    File "/home/smg/.virtualenvs_py3/nikola/lib/python3.5/site-packages/nikola/plugin_categories.py", line 130, in execute
      return self._execute(options, args)
    File "/home/smg/.virtualenvs_py3/nikola/lib/python3.5/site-packages/nikola/plugins/command/new_post.py", line 244, in _execute
      date_path_opt = options['date-path']
  KeyError: 'date-path'
  
  
  
  --- 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/new_page.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 
  3 # Copyright © 2012-2017 Roberto Alsina, Chris Warrick 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 """Create a new page."""
  28 
  29 from __future__ import unicode_literals, print_function
  30 
  31 from nikola.plugin_categories import Command
  32 
  33 
  34 class CommandNewPage(Command):
  35     """Create a new page."""
  36 
  37     name = "new_page"
  38     doc_usage = "[options] [path]"
  39     doc_purpose = "create a new page in the site"
  40     cmd_options = [
  41         {
  42             'name': 'title',
  43             'short': 't',
  44             'long': 'title',
  45             'type': str,
  46             'default': '',
  47             'help': 'Title for the page.'
  48         },
  49         {
  50             'name': 'author',
  51             'short': 'a',
  52             'long': 'author',
  53             'type': str,
  54             'default': '',
  55             'help': 'Author of the post.'
  56         },
  57         {
  58             'name': 'onefile',
  59             'short': '1',
  60             'type': bool,
  61             'default': False,
  62             'help': 'Create the page with embedded metadata (single file format)'
  63         },
  64         {
  65             'name': 'twofile',
  66             'short': '2',
  67             'type': bool,
  68             'default': False,
  69             'help': 'Create the page with separate metadata (two file format)'
  70         },
  71         {
  72             'name': 'edit',
  73             'short': 'e',
  74             'type': bool,
  75             'default': False,
  76             'help': 'Open the page (and meta file, if any) in $EDITOR after creation.'
  77         },
  78         {
  79             'name': 'content_format',
  80             'short': 'f',
  81             'long': 'format',
  82             'type': str,
  83             'default': '',
  84             'help': 'Markup format for the page (use --available-formats for list)',
  85         },
  86         {
  87             'name': 'available-formats',
  88             'short': 'F',
  89             'long': 'available-formats',
  90             'type': bool,
  91             'default': False,
  92             'help': 'List all available input formats'
  93         },
  94         {
  95             'name': 'import',
  96             'short': 'i',
  97             'long': 'import',
  98             'type': str,
  99             'default': '',
  100             'help': 'Import an existing file instead of creating a placeholder'
  101         },
  102     ]
  103 
  104     def _execute(self, options, args):
  105         """Create a new page."""
  106         # Defaults for some values that don’t apply to pages and the is_page option (duh!)
  107         options['tags'] = ''
  108         options['schedule'] = False
  109         options['is_page'] = True
  110         # Even though stuff was split into `new_page`, it’s easier to do it
  111         # there not to duplicate the code.
  112         p = self.site.plugin_manager.getPluginByName('new_post', 'Command').plugin_object
  113         return p.execute(options, args)
  114
  ```
  --- 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/new_page.py b/nikola/plugins/command/new_page.py
  --- a/nikola/plugins/command/new_page.py
  +++ b/nikola/plugins/command/new_page.py
  @@ -107,6 +107,7 @@
           options['tags'] = ''
           options['schedule'] = False
           options['is_page'] = True
  +        options['date-path'] = False
           # Even though stuff was split into `new_page`, it’s easier to do it
           # there not to duplicate the code.
           p = self.site.plugin_manager.getPluginByName('new_post', 'Command').plugin_object
  
verification_info: {"golden_diff": "diff --git a/nikola/plugins/command/new_page.py b/nikola/plugins/command/new_page.py\n--- a/nikola/plugins/command/new_page.py\n+++ b/nikola/plugins/command/new_page.py\n@@ -107,6 +107,7 @@\n         options['tags'] = ''\n         options['schedule'] = False\n         options['is_page'] = True\n+        options['date-path'] = False\n         # Even though stuff was split into `new_page`, it\u2019s easier to do it\n         # there not to duplicate the code.\n         p = self.site.plugin_manager.getPluginByName('new_post', 'Command').plugin_object\n", "issue": "new install - new_page fails\nsteps to reproduce:\r\n\r\n1. install nikola.\r\n2. init a new project and cd to it's dir\r\n3. run \"nikola new_page\" throws an exception.\r\n4. however, run \"nikola new_post -p\" and it works just fine!??\r\n\r\ni am puzzled, why does \"new_post -p\" work and \"new_page\" fail???\r\n\r\nthe exception trace i get is:\r\nTraceback (most recent call last):\r\n  File \"/home/smg/.virtualenvs_py3/nikola/lib/python3.5/site-packages/doit/doit_cmd.py\", line 167, in run\r\n    return command.parse_execute(args)\r\n  File \"/home/smg/.virtualenvs_py3/nikola/lib/python3.5/site-packages/doit/cmd_base.py\", line 120, in parse_execute\r\n    return self.execute(params, args)\r\n  File \"/home/smg/.virtualenvs_py3/nikola/lib/python3.5/site-packages/nikola/plugin_categories.py\", line 130, in execute\r\n    return self._execute(options, args)\r\n  File \"/home/smg/.virtualenvs_py3/nikola/lib/python3.5/site-packages/nikola/plugins/command/new_page.py\", line 113, in _execute\r\n    return p.execute(options, args)\r\n  File \"/home/smg/.virtualenvs_py3/nikola/lib/python3.5/site-packages/nikola/plugin_categories.py\", line 130, in execute\r\n    return self._execute(options, args)\r\n  File \"/home/smg/.virtualenvs_py3/nikola/lib/python3.5/site-packages/nikola/plugins/command/new_post.py\", line 244, in _execute\r\n    date_path_opt = options['date-path']\r\nKeyError: 'date-path'\r\n\r\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n# Copyright \u00a9 2012-2017 Roberto Alsina, Chris Warrick 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\n\"\"\"Create a new page.\"\"\"\n\nfrom __future__ import unicode_literals, print_function\n\nfrom nikola.plugin_categories import Command\n\n\nclass CommandNewPage(Command):\n    \"\"\"Create a new page.\"\"\"\n\n    name = \"new_page\"\n    doc_usage = \"[options] [path]\"\n    doc_purpose = \"create a new page in the site\"\n    cmd_options = [\n        {\n            'name': 'title',\n            'short': 't',\n            'long': 'title',\n            'type': str,\n            'default': '',\n            'help': 'Title for the page.'\n        },\n        {\n            'name': 'author',\n            'short': 'a',\n            'long': 'author',\n            'type': str,\n            'default': '',\n            'help': 'Author of the post.'\n        },\n        {\n            'name': 'onefile',\n            'short': '1',\n            'type': bool,\n            'default': False,\n            'help': 'Create the page with embedded metadata (single file format)'\n        },\n        {\n            'name': 'twofile',\n            'short': '2',\n            'type': bool,\n            'default': False,\n            'help': 'Create the page with separate metadata (two file format)'\n        },\n        {\n            'name': 'edit',\n            'short': 'e',\n            'type': bool,\n            'default': False,\n            'help': 'Open the page (and meta file, if any) in $EDITOR after creation.'\n        },\n        {\n            'name': 'content_format',\n            'short': 'f',\n            'long': 'format',\n            'type': str,\n            'default': '',\n            'help': 'Markup format for the page (use --available-formats for list)',\n        },\n        {\n            'name': 'available-formats',\n            'short': 'F',\n            'long': 'available-formats',\n            'type': bool,\n            'default': False,\n            'help': 'List all available input formats'\n        },\n        {\n            'name': 'import',\n            'short': 'i',\n            'long': 'import',\n            'type': str,\n            'default': '',\n            'help': 'Import an existing file instead of creating a placeholder'\n        },\n    ]\n\n    def _execute(self, options, args):\n        \"\"\"Create a new page.\"\"\"\n        # Defaults for some values that don\u2019t apply to pages and the is_page option (duh!)\n        options['tags'] = ''\n        options['schedule'] = False\n        options['is_page'] = True\n        # Even though stuff was split into `new_page`, it\u2019s easier to do it\n        # there not to duplicate the code.\n        p = self.site.plugin_manager.getPluginByName('new_post', 'Command').plugin_object\n        return p.execute(options, args)\n", "path": "nikola/plugins/command/new_page.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\n# Copyright \u00a9 2012-2017 Roberto Alsina, Chris Warrick 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\n\"\"\"Create a new page.\"\"\"\n\nfrom __future__ import unicode_literals, print_function\n\nfrom nikola.plugin_categories import Command\n\n\nclass CommandNewPage(Command):\n    \"\"\"Create a new page.\"\"\"\n\n    name = \"new_page\"\n    doc_usage = \"[options] [path]\"\n    doc_purpose = \"create a new page in the site\"\n    cmd_options = [\n        {\n            'name': 'title',\n            'short': 't',\n            'long': 'title',\n            'type': str,\n            'default': '',\n            'help': 'Title for the page.'\n        },\n        {\n            'name': 'author',\n            'short': 'a',\n            'long': 'author',\n            'type': str,\n            'default': '',\n            'help': 'Author of the post.'\n        },\n        {\n            'name': 'onefile',\n            'short': '1',\n            'type': bool,\n            'default': False,\n            'help': 'Create the page with embedded metadata (single file format)'\n        },\n        {\n            'name': 'twofile',\n            'short': '2',\n            'type': bool,\n            'default': False,\n            'help': 'Create the page with separate metadata (two file format)'\n        },\n        {\n            'name': 'edit',\n            'short': 'e',\n            'type': bool,\n            'default': False,\n            'help': 'Open the page (and meta file, if any) in $EDITOR after creation.'\n        },\n        {\n            'name': 'content_format',\n            'short': 'f',\n            'long': 'format',\n            'type': str,\n            'default': '',\n            'help': 'Markup format for the page (use --available-formats for list)',\n        },\n        {\n            'name': 'available-formats',\n            'short': 'F',\n            'long': 'available-formats',\n            'type': bool,\n            'default': False,\n            'help': 'List all available input formats'\n        },\n        {\n            'name': 'import',\n            'short': 'i',\n            'long': 'import',\n            'type': str,\n            'default': '',\n            'help': 'Import an existing file instead of creating a placeholder'\n        },\n    ]\n\n    def _execute(self, options, args):\n        \"\"\"Create a new page.\"\"\"\n        # Defaults for some values that don\u2019t apply to pages and the is_page option (duh!)\n        options['tags'] = ''\n        options['schedule'] = False\n        options['is_page'] = True\n        options['date-path'] = False\n        # Even though stuff was split into `new_page`, it\u2019s easier to do it\n        # there not to duplicate the code.\n        p = self.site.plugin_manager.getPluginByName('new_post', 'Command').plugin_object\n        return p.execute(options, args)\n", "path": "nikola/plugins/command/new_page.py"}]}