Merge lp:~fginther/notes-app/fix-db-path into lp:notes-app

Proposed by Francis Ginther
Status: Merged
Approved by: Loïc Minier
Approved revision: 199
Merged at revision: 198
Proposed branch: lp:~fginther/notes-app/fix-db-path
Merge into: lp:notes-app
Diff against target: 28 lines (+13/-4)
1 file modified
tests/autopilot/notes_app/tests/__init__.py (+13/-4)
To merge this branch: bzr merge lp:~fginther/notes-app/fix-db-path
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Loïc Minier Approve
Review via email: mp+189492@code.launchpad.net

This proposal supersedes a proposal from 2013-10-03.

Commit message

Provide alternate location of offline storage in response to sdk change.

Description of the change

Provide alternate location of offline storage in response to sdk change (see lp:1231863).

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Loïc Minier (lool) wrote : Posted in a previous version of this proposal

Could you get the name from Qt/SDK instead of harcoding it? Otherwise we have to ensure the test and the updated SDK land at exactly the same time, and if the location changes again, it will break again.

Revision history for this message
Francis Ginther (fginther) wrote :

New version attempts to use the new path first. Yes it could do better and actually look for the db file, not just check the path.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~fginther/notes-app/fix-db-path updated
199. By Francis Ginther

Need to return the os.path.expanduser path.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Loïc Minier (lool) wrote :

Looks good, thanks for trying the two pathnames.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/notes_app/tests/__init__.py'
2--- tests/autopilot/notes_app/tests/__init__.py 2013-09-30 22:20:59 +0000
3+++ tests/autopilot/notes_app/tests/__init__.py 2013-10-06 04:34:02 +0000
4@@ -183,11 +183,20 @@
5 Helper functions for dealing with sqlite databases
6 """
7
8+ def _get_db_path(self):
9+ db_path_list = [
10+ "~/.local/share/notes-app/Databases",
11+ "~/.local/share/Qt Project/QtQmlViewer/QML/OfflineStorage/"
12+ "Databases/"]
13+ for path in db_path_list:
14+ path = os.path.expanduser(path)
15+ if os.path.exists(path):
16+ return path
17+ return None
18+
19 def find_db(self):
20- dbs_path = os.path.expanduser(
21- "~/.local/share/Qt Project/QtQmlViewer/QML/OfflineStorage/"
22- "Databases/")
23- if not os.path.exists(dbs_path):
24+ dbs_path = self._get_db_path()
25+ if not dbs_path:
26 return None
27 files = [f for f in os.listdir(dbs_path)
28 if os.path.splitext(f)[1] == ".ini"]

Subscribers

People subscribed via source and target branches