Merge lp://qastaging/~cmiller/desktopcouch/bookmarks-always-exists into lp://qastaging/desktopcouch

Proposed by Chad Miller
Status: Merged
Approved by: Nicola Larosa
Approved revision: 97
Merged at revision: not available
Proposed branch: lp://qastaging/~cmiller/desktopcouch/bookmarks-always-exists
Merge into: lp://qastaging/desktopcouch
Diff against target: 38 lines (+12/-15)
1 file modified
desktopcouch/start_local_couchdb.py (+12/-15)
To merge this branch: bzr merge lp://qastaging/~cmiller/desktopcouch/bookmarks-always-exists
Reviewer Review Type Date Requested Status
Nicola Larosa (community) Approve
Guillermo Gonzalez Approve
Review via email: mp+14897@code.qastaging.launchpad.net

Commit message

Don't remove the HTML file that bookmarks point to. A description of the problem is better than a file-not-found error message in the web browser. The problem is not the file missing, it's what caused the file to be missing.

To post a comment you must log in.
Revision history for this message
Guillermo Gonzalez (verterok) :
review: Approve
Revision history for this message
Nicola Larosa (teknico) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'desktopcouch/start_local_couchdb.py'
2--- desktopcouch/start_local_couchdb.py 2009-10-16 15:23:51 +0000
3+++ desktopcouch/start_local_couchdb.py 2009-11-15 21:20:23 +0000
4@@ -278,22 +278,19 @@
5 fp.close()
6
7 port = desktopcouch.find_port(pid=pid)
8- if port is None:
9- print ("We couldn't find desktop-CouchDB's network port. Bookmark "
10- "file not written.")
11- try:
12- os.remove(bookmark_file)
13- except OSError:
14- pass
15- else:
16- fp = open(bookmark_file, "w")
17- out = html.replace("[[COUCHDB_PORT]]", str(port))
18- out = out.replace("[[COUCHDB_USERNAME]]", username)
19- out = out.replace("[[COUCHDB_PASSWORD]]", password)
20- fp.write(out)
21+ fp = open(bookmark_file, "w")
22+ try:
23+ if port is None:
24+ fp.write("<html><body><p>Sorry, desktop couchdb does is not running.</body></html>\n")
25+ else:
26+ out = html.replace("[[COUCHDB_PORT]]", str(port))
27+ out = out.replace("[[COUCHDB_USERNAME]]", username)
28+ out = out.replace("[[COUCHDB_PASSWORD]]", password)
29+ fp.write(out)
30+ print "Browse your desktop CouchDB at file://%s" % \
31+ os.path.realpath(bookmark_file)
32+ finally:
33 fp.close()
34- print "Browse your desktop CouchDB at file://%s" % \
35- os.path.realpath(bookmark_file)
36
37 def start_couchdb():
38 """Execute each step to start a desktop CouchDB."""

Subscribers

People subscribed via source and target branches