Repository: glotzerlab/signac

Issue:
view function regression in latest version
<!-- Please replace the text in the individual sections below. -->

### Description

"...there appears to be a regression affecting the view function in the latest version." per @csadorf  in the Gitter signac lobby

### To reproduce
```
# init.py
import signac

project = signac.init('fmria_project')

sp = {'monomer':'nfa'}
job = project.open_job(sp)
job.init()
```
`$ python3 init.py`
`$ signac view`

### Error output

`Error: <lambda>() takes 1 positional argument but 2 were given`

### System configuration

Please complete the following information:

 - Operating System [e.g. macOS]: CentOS `6.10 (final)`
 - Version of Python [e.g. 3.7]: `3.7.3`
 - Version of signac [e.g. 1.0]: `1.1.0`


Comments:

Patch:
diff --git a/changelog.txt b/changelog.txt
index daf2b1c6..145174d3 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -27,6 +27,7 @@ next
  - Fix issue causing a failure of the automatic conversion of valid key types (#168, #205).
  - Improve the 'dots in keys' error message to make it easier to fix related issues (#170, #205).
  - Update the ``__repr__`` and ``__repr_html__`` implementations of the ``Project`, ``Job``, and ``JobsCursor`` classes (#193).
+ - Fix issue with rendering views from the command line for single job project (#208).
  - Fix issue with heterogeneous types in state point values that are lists (#209).
 
 [1.1.0] -- 2019-05-19
diff --git a/signac/contrib/import_export.py b/signac/contrib/import_export.py
index 8a5a6053..b63d9a08 100644
--- a/signac/contrib/import_export.py
+++ b/signac/contrib/import_export.py
@@ -44,7 +44,9 @@ def _make_schema_based_path_function(jobs, exclude_keys=None, delimiter_nested='
     "Generate schema based paths as a function of the given jobs."
     from .schema import _build_job_statepoint_index
     if len(jobs) <= 1:
-        return lambda job: ''
+        # The lambda must (optionally) take a format spec argument to match the
+        # signature of the path function below.
+        return lambda job, sep=None: ''
 
     index = [{'_id': job._id, 'statepoint': job.sp()} for job in jobs]
     jsi = _build_job_statepoint_index(jobs=jobs, exclude_const=True, index=index)


Test patch:
diff --git a/tests/test_shell.py b/tests/test_shell.py
index 0b33d92c..a7a9dd5c 100644
--- a/tests/test_shell.py
+++ b/tests/test_shell.py
@@ -142,6 +142,21 @@ class BasicShellTest(unittest.TestCase):
         self.assertIn('b', doc)
         self.assertEqual(doc['b'], 0)
 
+    def test_view_single(self):
+        """Check whether command line views work for single job workspaces."""
+        self.call('python -m signac init my_project'.split())
+        project = signac.Project()
+        sps = [{'a': i} for i in range(1)]
+        for sp in sps:
+            project.open_job(sp).init()
+        os.mkdir('view')
+        self.call('python -m signac view'.split())
+        for sp in sps:
+            self.assertTrue(os.path.isdir('view/job'))
+            self.assertEqual(
+                os.path.realpath('view/job'),
+                os.path.realpath(project.open_job(sp).workspace()))
+
     def test_view(self):
         self.call('python -m signac init my_project'.split())
         project = signac.Project()