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
=== modified file 'desktopcouch/__init__.py'
--- desktopcouch/__init__.py 2009-07-28 11:32:07 +0000
+++ desktopcouch/__init__.py 2009-07-28 17:56:10 +0000
@@ -18,12 +18,12 @@
18from __future__ import with_statement18from __future__ import with_statement
19import os19import os
20import re20import re
21from desktopcouch import local_files
22import errno21import errno
23import time22import time
2423
25def find_pid():24def find_pid():
26 # Work out whether CouchDB is running by looking at its pid file25 # Work out whether CouchDB is running by looking at its pid file
26 from desktopcouch import local_files
27 fp = open(local_files.FILE_PID)27 fp = open(local_files.FILE_PID)
28 pid = int(fp.read())28 pid = int(fp.read())
29 fp.close()29 fp.close()
3030
=== modified file 'desktopcouch/local_files.py'
--- desktopcouch/local_files.py 2009-07-24 18:34:34 +0000
+++ desktopcouch/local_files.py 2009-07-28 17:56:10 +0000
@@ -62,8 +62,7 @@
62 if os.path.exists(os.path.join(x, 'couchdb')):62 if os.path.exists(os.path.join(x, 'couchdb')):
63 COUCH_EXE = os.path.join(x, 'couchdb')63 COUCH_EXE = os.path.join(x, 'couchdb')
64if not COUCH_EXE:64if not COUCH_EXE:
65 print "Could not find couchdb"65 raise ImportError("Could not find couchdb")
66 sys.exit(1)
6766
68def couch_chain_flag():67def couch_chain_flag():
69 process = subprocess.Popen([COUCH_EXE, '-V'], shell=False,68 process = subprocess.Popen([COUCH_EXE, '-V'], shell=False,

Subscribers

People subscribed via source and target branches