~sil/desktopcouch/create-oauth-tokens-startup

« back to all changes in this revision

Viewing changes to desktopcouch/__init__.py

  • Committer: Tarmac
  • Author(s): Elliot Murphy
  • Date: 2009-07-28 18:05:47 UTC
  • mfrom: (19.1.1 server-problems)
  • Revision ID: elliot@elliotmurphy.com-20090728180547-vu9tx1sgaqh1n8lz


    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.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
from __future__ import with_statement
19
19
import os
20
20
import re
21
 
from desktopcouch import local_files
22
21
import errno
23
22
import time
24
23
 
25
24
def find_pid():
26
25
    # Work out whether CouchDB is running by looking at its pid file
 
26
    from desktopcouch import local_files
27
27
    fp = open(local_files.FILE_PID)
28
28
    pid = int(fp.read())
29
29
    fp.close()