Merge lp:~statik/desktopcouch/server-problems into lp:desktopcouch

Proposed by Elliot Murphy
Status: Merged
Approved by: Elliot Murphy
Approved revision: 20
Merged at revision: not available
Proposed branch: lp:~statik/desktopcouch/server-problems
Merge into: lp:desktopcouch
Diff against target: None lines
To merge this branch: bzr merge lp:~statik/desktopcouch/server-problems
Reviewer Review Type Date Requested Status
Philip Fibiger (community) Approve
Review via email: mp+9383@code.launchpad.net

Commit message

    Don't trigger the desktopcouch path searching and automatic couch startup
    behavior when desktopcouch is imported, this module is used in server
    environments also and thats not very friendly for servers.

    Also: never, ever call sys.exit() during module import. raise an
    ImportError instead so that it's possible to debug.

To post a comment you must log in.
Revision history for this message
Elliot Murphy (statik) wrote :

Fixes some major problems with using the desktopcouch module in server environments.

Revision history for this message
Philip Fibiger (pfibiger) wrote :

our servers thank you.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'desktopcouch/__init__.py'
2--- desktopcouch/__init__.py 2009-07-28 11:32:07 +0000
3+++ desktopcouch/__init__.py 2009-07-28 17:56:10 +0000
4@@ -18,12 +18,12 @@
5 from __future__ import with_statement
6 import os
7 import re
8-from desktopcouch import local_files
9 import errno
10 import time
11
12 def find_pid():
13 # Work out whether CouchDB is running by looking at its pid file
14+ from desktopcouch import local_files
15 fp = open(local_files.FILE_PID)
16 pid = int(fp.read())
17 fp.close()
18
19=== modified file 'desktopcouch/local_files.py'
20--- desktopcouch/local_files.py 2009-07-24 18:34:34 +0000
21+++ desktopcouch/local_files.py 2009-07-28 17:56:10 +0000
22@@ -62,8 +62,7 @@
23 if os.path.exists(os.path.join(x, 'couchdb')):
24 COUCH_EXE = os.path.join(x, 'couchdb')
25 if not COUCH_EXE:
26- print "Could not find couchdb"
27- sys.exit(1)
28+ raise ImportError("Could not find couchdb")
29
30 def couch_chain_flag():
31 process = subprocess.Popen([COUCH_EXE, '-V'], shell=False,

Subscribers

People subscribed via source and target branches