Repository: pubs/pubs (language: python)

Issue:
Tilde only expanded sometimes
My `.pubsrc` contains
```
[main]
pubsdir = ~/.pubs
```
Most commands (`add`, `doc`, `edit`, ...) work fine. When I use `pubs note foobar` however, pubs is trying to create a file at `./~/.pubs/notes/foobar.txt`.
Tilde only expanded sometimes
My `.pubsrc` contains
```
[main]
pubsdir = ~/.pubs
```
Most commands (`add`, `doc`, `edit`, ...) work fine. When I use `pubs note foobar` however, pubs is trying to create a file at `./~/.pubs/notes/foobar.txt`.


Discussion / hints:

Fix patch:
diff --git a/pubs/filebroker.py b/pubs/filebroker.py
index 7043f4c6..7c052b34 100644
--- a/pubs/filebroker.py
+++ b/pubs/filebroker.py
@@ -154,7 +154,7 @@ class DocBroker(object):
 
     def __init__(self, directory, scheme='docsdir', subdir='doc'):
         self.scheme = scheme
-        self.docdir = os.path.join(directory, subdir)
+        self.docdir = os.path.expanduser(os.path.join(directory, subdir))
         if not check_directory(self.docdir, fail=False):
             os.mkdir(system_path(self.docdir))
 


Test patch:
diff --git a/tests/test_filebroker.py b/tests/test_filebroker.py
index f8560a95..1f090081 100644
--- a/tests/test_filebroker.py
+++ b/tests/test_filebroker.py
@@ -71,6 +71,16 @@ def test_remove(self):
 
 class TestDocBroker(fake_env.TestFakeFs):
 
+    def test_expanduser(self):
+        """Test that real_docpath expand the user ~"""
+
+        self.fs.add_real_directory(os.path.join(self.rootpath, 'data'), read_only=False)
+        fb = filebroker.FileBroker('~/testrepo', create = True)
+        docb = filebroker.DocBroker('~/testrepo')
+        self.assertTrue(os.path.isabs(docb.docdir))
+        self.assertTrue(os.path.isabs(docb.real_docpath('docsdir://abc')))
+
+
     def test_doccopy(self):
 
         self.fs.add_real_directory(os.path.join(self.rootpath, 'data'), read_only=False)