Merge lp:~jderose/microfiber/couchdb-1.1.1 into lp:microfiber

Proposed by Jason Gerard DeRose
Status: Merged
Merged at revision: 99
Proposed branch: lp:~jderose/microfiber/couchdb-1.1.1
Merge into: lp:microfiber
Diff against target: 115 lines (+38/-7)
4 files modified
doc/index.rst (+4/-0)
doc/microfiber.rst (+20/-2)
microfiber.py (+9/-0)
test_microfiber.py (+5/-5)
To merge this branch: bzr merge lp:~jderose/microfiber/couchdb-1.1.1
Reviewer Review Type Date Requested Status
David Jordan Approve
Review via email: mp+86504@code.launchpad.net

Description of the change

Updates one unit test for CouchDB 1.1.1 compatability, and adds the new dmedia_env() function so the collection of utility scripts and examples out there can be ready for Dmedia being what starts CouchDB.

To post a comment you must log in.
Revision history for this message
David Jordan (dmj726) wrote :

Approved!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'doc/index.rst'
2--- doc/index.rst 2011-09-02 03:17:34 +0000
3+++ doc/index.rst 2011-12-21 07:29:24 +0000
4@@ -12,6 +12,9 @@
5 packages are available for Ubuntu in the `Novacut Stable Releases PPA`_ and the
6 `Novacut Daily Builds PPA`_.
7
8+If you have questions or need help getting started with Microfiber, please stop
9+by the `#novacut`_ IRC channel on freenode.
10+
11 Microfiber is licensed `LGPLv3+`_.
12
13
14@@ -33,4 +36,5 @@
15 .. _`Novacut`: https://wiki.ubuntu.com/Novacut
16 .. _`Novacut Stable Releases PPA`: https://launchpad.net/~novacut/+archive/stable
17 .. _`Novacut Daily Builds PPA`: https://launchpad.net/~novacut/+archive/daily
18+.. _`#novacut`: http://webchat.freenode.net/?channels=novacut
19
20
21=== modified file 'doc/microfiber.rst'
22--- doc/microfiber.rst 2011-09-03 02:39:53 +0000
23+++ doc/microfiber.rst 2011-12-21 07:29:24 +0000
24@@ -448,16 +448,33 @@
25 .. function:: dc3_env()
26
27 Return the dc3 environment information.
28-
29+
30 For example, to create a :class:`Database` with the correct per-user `dc3`_
31 environment:
32-
33+
34 >>> from microfiber import dc3_env, Database
35 >>> db = Database('dmedia', dc3_env())
36 >>> db.url
37 'http://localhost:41289/'
38
39
40+.. function:: dmedia_env()
41+
42+ Return the Dmedia environment information.
43+
44+ For example, to create a :class:`Database` with the correct per-user
45+ `Dmedia`_ environment:
46+
47+ >>> from microfiber import dmedia_env, Database
48+ >>> db = Database('dmedia', dmedia_env())
49+ >>> db.url
50+ 'http://localhost:41289/'
51+
52+ If you're using Microfiber to work with Dmedia or Novacut, please use this
53+ function instead of :func:`dc3_env()` as starting with the Dmedia 12.01
54+ release, Dmedia itself will be what starts CouchDB.
55+
56+
57 Exceptions
58 ==========
59
60@@ -552,6 +569,7 @@
61 .. _`Novacut`: https://wiki.ubuntu.com/Novacut
62 .. _`desktopcouch`: https://launchpad.net/desktopcouch
63 .. _`dc3`: https://launchpad.net/dc3
64+.. _`Dmedia`: https://launchpad.net/dmedia
65 .. _`python-couchdb`: http://packages.python.org/CouchDB/client.html#database
66
67
68
69=== modified file 'microfiber.py'
70--- microfiber.py 2011-12-08 12:25:53 +0000
71+++ microfiber.py 2011-12-21 07:29:24 +0000
72@@ -76,6 +76,7 @@
73 USER_AGENT = 'microfiber ' + __version__
74 SERVER = 'http://localhost:5984/'
75 DC3_CMD = ('/usr/bin/dc3', 'GetEnv')
76+DMEDIA_CMD = ('/usr/bin/dmedia-cli', 'GetEnv')
77
78 RANDOM_BITS = 120
79 RANDOM_BYTES = RANDOM_BITS // 8
80@@ -119,6 +120,14 @@
81 return json.loads(env_s.decode('utf-8'))
82
83
84+def dmedia_env():
85+ from gi.repository import Gio
86+ conn = Gio.bus_get_sync(Gio.BusType.SESSION, None)
87+ bus = 'org.freedesktop.DMedia'
88+ proxy = Gio.DBusProxy.new_sync(conn, 0, None, bus, '/', bus, None)
89+ return json.loads(proxy.GetEnv())
90+
91+
92 def _json_body(obj):
93 if obj is None:
94 return None
95
96=== modified file 'test_microfiber.py'
97--- test_microfiber.py 2011-12-08 23:38:16 +0000
98+++ test_microfiber.py 2011-12-21 07:29:24 +0000
99@@ -607,11 +607,11 @@
100 self.assertRaises(MethodNotAllowed, inst.post, None)
101 self.assertRaises(MethodNotAllowed, inst.put, None)
102 self.assertRaises(MethodNotAllowed, inst.delete)
103- self.assertEqual(
104- inst.get(),
105- {'couchdb': 'Welcome', 'version': '1.1.0'}
106- )
107-
108+ ret = inst.get()
109+ self.assertIsInstance(ret, dict)
110+ self.assertEqual(set(ret), set(['couchdb', 'version']))
111+ self.assertEqual(ret['couchdb'], 'Welcome')
112+ self.assertIsInstance(ret['version'], str)
113
114 #####################
115 # Create the database

Subscribers

People subscribed via source and target branches