Merge lp:~dholbach/harvest/656217 into lp:harvest

Proposed by Daniel Holbach
Status: Merged
Approved by: James Westby
Approved revision: 265
Merged at revision: 272
Proposed branch: lp:~dholbach/harvest/656217
Merge into: lp:harvest
Diff against target: 92 lines (+11/-7)
6 files modified
harvest/common/launchpad.py (+1/-3)
harvest/common/opportunity_lists.py (+3/-1)
harvest/opportunities/management/commands/import-translations.py (+1/-1)
harvest/opportunities/management/commands/update-template.py (+1/-1)
harvest/opportunities/management/commands/updatelists.py (+1/-1)
harvest/settings.py (+4/-0)
To merge this branch: bzr merge lp:~dholbach/harvest/656217
Reviewer Review Type Date Requested Status
James Westby Approve
Review via email: mp+37935@code.launchpad.net
To post a comment you must log in.
lp:~dholbach/harvest/656217 updated
265. By Daniel Holbach

define paths in settings.py

Revision history for this message
James Westby (james-w) :
review: Approve
Revision history for this message
Dylan McCall (dylanmccall) wrote :

Do we need to worry about local_settings.py changing PROJECT_PATH?
If we do you'll want to move those new variables in settings.py down, below “from local_settings import *” (line 147).

Revision history for this message
Daniel Holbach (dholbach) wrote :

> Do we need to worry about local_settings.py changing PROJECT_PATH?
> If we do you'll want to move those new variables in settings.py down, below
> “from local_settings import *” (line 147).

I think it's fine if they get overridden in local_settings.py - it should be the only place where variables are changed.

Revision history for this message
Daniel Holbach (dholbach) wrote :

Does this resolve all open questions?

Revision history for this message
Daniel Holbach (dholbach) wrote :

I suggest I merge this now and you file a bug report if you expect a different behaviour.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'harvest/common/launchpad.py'
2--- harvest/common/launchpad.py 2010-09-01 11:24:39 +0000
3+++ harvest/common/launchpad.py 2010-10-08 08:07:58 +0000
4@@ -2,14 +2,12 @@
5
6 from django.conf import settings
7
8-import os
9-
10 def lp_login(lp_instance=EDGE_SERVICE_ROOT):
11 """
12 Return a logged in Launchpad object.
13 """
14
15- cachedir = os.path.join(settings.PROJECT_PATH, 'lp_data/cache')
16+ cachedir = settings.CACHE_PATH
17 client_ident = getattr(settings, 'LP_PROJECT_NAME', "Harvest")
18 try:
19 launchpad = Launchpad.login_anonymously(client_ident, lp_instance, cachedir)
20
21=== modified file 'harvest/common/opportunity_lists.py'
22--- harvest/common/opportunity_lists.py 2010-08-03 16:29:47 +0000
23+++ harvest/common/opportunity_lists.py 2010-10-08 08:07:58 +0000
24@@ -1,5 +1,7 @@
25 LIST_BRANCH_URL = "lp:harvest-data"
26
27+from django.conf import settings
28+
29 import csv
30 import os
31
32@@ -56,7 +58,7 @@
33
34
35 def pull_lists(data_dir):
36- list_dir = os.path.join(data_dir, "lists")
37+ list_dir = settings.LIST_PATH
38 if not os.path.exists(list_dir):
39 os.system("cd %s; bzr checkout %s lists -q" % (data_dir, LIST_BRANCH_URL))
40 else:
41
42=== modified file 'harvest/opportunities/management/commands/import-translations.py'
43--- harvest/opportunities/management/commands/import-translations.py 2010-03-02 10:38:05 +0000
44+++ harvest/opportunities/management/commands/import-translations.py 2010-10-08 08:07:58 +0000
45@@ -21,7 +21,7 @@
46 locale = re.findall("^%s-(.*).po$" % APP_NAME, os.path.basename(pofile))
47 if not locale:
48 return False
49- project_locale_path = os.path.join(settings.PROJECT_PATH, "locale", locale[0])
50+ project_locale_path = os.path.join(settings.LOCALE_PATH, locale[0])
51 if not os.path.exists(project_locale_path) or \
52 not os.path.isdir(project_locale_path):
53 pwd = os.getcwd()
54
55=== modified file 'harvest/opportunities/management/commands/update-template.py'
56--- harvest/opportunities/management/commands/update-template.py 2010-06-01 06:40:02 +0000
57+++ harvest/opportunities/management/commands/update-template.py 2010-10-08 08:07:58 +0000
58@@ -18,7 +18,7 @@
59 pwd = os.getcwd()
60 os.chdir(settings.PROJECT_PATH)
61 subprocess.call(["./manage.py", "makemessages", "-l", DUMMY_LOCALE])
62- project_locale_path = os.path.join(settings.PROJECT_PATH, "locale")
63+ project_locale_path = settings.LOCALE_PATH
64 os.rename(os.path.join(project_locale_path,
65 "%s/LC_MESSAGES/django.po" % DUMMY_LOCALE),
66 os.path.join(project_locale_path, "%s.pot" % APP_NAME))
67
68=== modified file 'harvest/opportunities/management/commands/updatelists.py'
69--- harvest/opportunities/management/commands/updatelists.py 2010-08-03 16:29:47 +0000
70+++ harvest/opportunities/management/commands/updatelists.py 2010-10-08 08:07:58 +0000
71@@ -14,7 +14,7 @@
72 help = "Pull opportunity lists and update them in the DB."
73
74 def update_lists(self):
75- data_dir = os.path.join(settings.PROJECT_PATH, "data")
76+ data_dir = settings.DATA_PATH
77 if not os.path.exists(data_dir):
78 os.makedirs(data_dir)
79 list_dir = opportunity_lists.pull_lists(data_dir)
80
81=== modified file 'harvest/settings.py'
82--- harvest/settings.py 2010-08-31 23:49:08 +0000
83+++ harvest/settings.py 2010-10-08 08:07:58 +0000
84@@ -1,5 +1,9 @@
85 import os
86 PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
87+LOCALE_PATH = os.path.join(PROJECT_PATH, "locale")
88+DATA_PATH = os.path.join(PROJECT_PATH, "data")
89+LIST_PATH = os.path.join(DATA_PATH, "lists")
90+CACHE_PATH = os.path.join(PROJECT_PATH, "lp_data/cache")
91
92 # Django settings for harvest project.
93

Subscribers

People subscribed via source and target branches

to all changes: