Merge lp:~dholbach/loco-team-portal/update-pot into lp:loco-team-portal

Proposed by Daniel Holbach
Status: Merged
Merged at revision: not available
Proposed branch: lp:~dholbach/loco-team-portal/update-pot
Merge into: lp:loco-team-portal
Diff against target: 35 lines (+31/-0)
1 file modified
loco_directory/teams/management/commands/update-template.py (+31/-0)
To merge this branch: bzr merge lp:~dholbach/loco-team-portal/update-pot
Reviewer Review Type Date Requested Status
Michael Hall Pending
Review via email: mp+23021@code.launchpad.net

This proposal supersedes a proposal from 2010-04-08.

To post a comment you must log in.
Revision history for this message
Michael Hall (mhall119) wrote : Posted in a previous version of this proposal

mhall@quinnco:~/projects/loco-directory/loco-testing/loco_directory$ ./manage.py update-template
Traceback (most recent call last):
  File "./manage.py", line 11, in <module>
    execute_manager(settings)
  File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 362, in execute_manager
    utility.execute()
  File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 303, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 257, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 67, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/usr/lib/pymodules/python2.6/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/home/mhall/projects/loco-directory/loco-testing/loco_directory/teams/management/commands/update-template.py", line 23
    os.path.join(project_locale_path, "%s.pot" % APP_NAME)])
                                                          ^
SyntaxError: invalid syntax

review: Needs Fixing
Revision history for this message
Michael Hall (mhall119) wrote : Posted in a previous version of this proposal

Testing and working

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'loco_directory/teams/management/commands/update-template.py'
2--- loco_directory/teams/management/commands/update-template.py 1970-01-01 00:00:00 +0000
3+++ loco_directory/teams/management/commands/update-template.py 2010-04-08 13:32:33 +0000
4@@ -0,0 +1,31 @@
5+#!/usr/bin/python
6+
7+from django.core.management.base import NoArgsCommand
8+
9+import subprocess
10+import os
11+
12+from django.conf import settings
13+
14+try:
15+ APP_NAME = settings.LP_PROJECT_NAME
16+except AttributeError:
17+ # if you prefer not to set LP_PROJECT_NAME in settings.py, define here
18+ APP_NAME = "loco-directory"
19+
20+
21+def update_template():
22+ pwd = os.getcwd()
23+ os.chdir(settings.PROJECT_PATH)
24+ subprocess.call(["./manage.py", "makemessages", "-l", "xx"])
25+ project_locale_path = os.path.join(settings.PROJECT_PATH, "locale")
26+ os.rename(os.path.join(project_locale_path, "xx/LC_MESSAGES/django.po"),
27+ os.path.join(project_locale_path, "%s.pot" % APP_NAME))
28+ os.removedirs(os.path.join(project_locale_path, "xx/LC_MESSAGES"))
29+ os.chdir(pwd)
30+
31+class Command(NoArgsCommand):
32+ help = "Update translations template."
33+
34+ def handle_noargs(self, **options):
35+ update_template()

Subscribers

People subscribed via source and target branches