Code

Ticket #5522: django-admin.3.diff

File django-admin.3.diff, 36.1 KB (added by jezdez, 6 years ago)

normal patch with SVN on fresh checkout (r7140)

Line 
1Index: django/core/management/commands/messagesmake.py
2===================================================================
3--- django/core/management/commands/messagesmake.py     (revision 0)
4+++ django/core/management/commands/messagesmake.py     (revision 0)
5@@ -0,0 +1,145 @@
6+import re
7+import os
8+import sys
9+from itertools import dropwhile
10+from optparse import make_option
11+from django.core.management.base import CommandError, BaseCommand, get_locale_dir
12+from django.utils.translation import templatize
13+
14+pythonize_re = re.compile(r'\n\s*//')
15+
16+class Command(BaseCommand):
17+    option_list = BaseCommand.option_list + (
18+        make_option('--locale', '-l', default=None, dest='locale',
19+            help='Creates or updates the message files only for the given locale (e.g. pt_BR).'),
20+        make_option('--domain', '-d', default='django', dest='domain',
21+            help='The domain of the message files (default: "django").'),
22+        make_option('--verbosity', '-v', action='store', dest='verbosity', default='1',
23+            type='choice', choices=['0', '1', '2'],
24+            help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'),
25+        make_option('--all', '-a', action='store_true', dest='all', default=False,
26+            help='Reexamines all source code and templates for new translation strings and updates all message files for all available languages.'),
27+    )
28+    help = "Runs over the entire source tree of the current directory and pulls out all strings marked for translation. It creates (or updates) a message file in the conf/locale (in the django tree) or locale (for project and application) directory."
29+
30+    requires_model_validation = False
31+    can_import_settings = False
32+
33+    def handle(self, *args, **options):
34+        if len(args) != 0:
35+            raise CommandError("Command doesn't accept any arguments")
36+
37+        localedir = get_locale_dir()
38+        locale = options.get('locale', None)
39+        domain = options.get('domain', 'django')
40+        verbosity = int(options.get('verbosity', 1))
41+        all = options.get('all', False)
42+
43+        if domain not in ('django', 'djangojs'):
44+            raise CommandError("currently messagesmake only supports domains 'django' and 'djangojs'")
45+        if (locale is None and not all) or domain is None:
46+            # backwards compatible error message
47+            if not sys.argv[0].endswith("make-messages.py"):
48+                message = "Type '%s help %s' for usage.\n" % (os.path.basename(sys.argv[0]), sys.argv[1])
49+            else:
50+                message = "usage: make-messages.py -l <language>\n   or: make-messages.py -a\n"
51+            sys.stderr.write(message)
52+            sys.exit(1)
53+
54+        languages = []
55+
56+        if locale is not None:
57+            languages.append(locale)
58+        elif all:
59+            languages = [el for el in os.listdir(localedir) if not el.startswith('.')]
60+
61+        for locale in languages:
62+            if verbosity > 0:
63+                print "processing language", locale
64+            basedir = os.path.join(localedir, locale, 'LC_MESSAGES')
65+            if not os.path.isdir(basedir):
66+                os.makedirs(basedir)
67+
68+            pofile = os.path.join(basedir, '%s.po' % domain)
69+            potfile = os.path.join(basedir, '%s.pot' % domain)
70+
71+            if os.path.exists(potfile):
72+                os.unlink(potfile)
73+
74+            all_files = []
75+            for (dirpath, dirnames, filenames) in os.walk("."):
76+                all_files.extend([(dirpath, f) for f in filenames])
77+            all_files.sort()
78+            for dirpath, file in all_files:
79+                if domain == 'djangojs' and file.endswith('.js'):
80+                    if verbosity > 1:
81+                        sys.stdout.write('processing file %s in %s\n' % (file, dirpath))
82+                    src = open(os.path.join(dirpath, file), "rb").read()
83+                    src = pythonize_re.sub('\n#', src)
84+                    open(os.path.join(dirpath, '%s.py' % file), "wb").write(src)
85+                    thefile = '%s.py' % file
86+                    cmd = 'xgettext %s -d %s -L Perl --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy:1,2 --from-code UTF-8 -o - "%s"' % (
87+                        os.path.exists(potfile) and '--omit-header' or '', domain, os.path.join(dirpath, thefile))
88+                    (stdin, stdout, stderr) = os.popen3(cmd, 't')
89+                    msgs = stdout.read()
90+                    errors = stderr.read()
91+                    if errors:
92+                        print "errors happened while running xgettext on %s" % file
93+                        print errors
94+                        sys.exit(8)
95+                    old = '#: '+os.path.join(dirpath, thefile)[2:]
96+                    new = '#: '+os.path.join(dirpath, file)[2:]
97+                    msgs = msgs.replace(old, new)
98+                    if msgs:
99+                        open(potfile, 'ab').write(msgs)
100+                    os.unlink(os.path.join(dirpath, thefile))
101+                elif domain == 'django' and (file.endswith('.py') or file.endswith('.html')):
102+                    thefile = file
103+                    if file.endswith('.html'):
104+                        src = open(os.path.join(dirpath, file), "rb").read()
105+                        thefile = '%s.py' % file
106+                        open(os.path.join(dirpath, thefile), "wb").write(templatize(src))
107+                    if verbosity > 1:
108+                        sys.stdout.write('processing file %s in %s\n' % (file, dirpath))
109+                    cmd = 'xgettext -d %s -L Python --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy:1,2 --keyword=ugettext_noop --keyword=ugettext_lazy --keyword=ungettext_lazy:1,2 --from-code UTF-8 -o - "%s"' % (
110+                        domain, os.path.join(dirpath, thefile))
111+                    (stdin, stdout, stderr) = os.popen3(cmd, 't')
112+                    msgs = stdout.read()
113+                    errors = stderr.read()
114+                    if errors:
115+                        print "errors happened while running xgettext on %s" % file
116+                        print errors
117+                        sys.exit(8)
118+                    if thefile != file:
119+                        old = '#: '+os.path.join(dirpath, thefile)[2:]
120+                        new = '#: '+os.path.join(dirpath, file)[2:]
121+                        msgs = msgs.replace(old, new)
122+                    if os.path.exists(potfile):
123+                        # Strip the header
124+                        msgs = '\n'.join(dropwhile(len, msgs.split('\n')))
125+                    else:
126+                        msgs = msgs.replace('charset=CHARSET', 'charset=UTF-8')
127+                    if msgs:
128+                        open(potfile, 'ab').write(msgs)
129+                    if thefile != file:
130+                        os.unlink(os.path.join(dirpath, thefile))
131+
132+            if os.path.exists(potfile):
133+                (stdin, stdout, stderr) = os.popen3('msguniq --to-code=utf-8 "%s"' % potfile, 'b')
134+                msgs = stdout.read()
135+                errors = stderr.read()
136+                if errors:
137+                    print "errors happened while running msguniq"
138+                    print errors
139+                    sys.exit(8)
140+                open(potfile, 'w').write(msgs)
141+                if os.path.exists(pofile):
142+                    (stdin, stdout, stderr) = os.popen3('msgmerge -q "%s" "%s"' % (pofile, potfile), 'b')
143+                    msgs = stdout.read()
144+                    errors = stderr.read()
145+                    if errors:
146+                        print "errors happened while running msgmerge"
147+                        print errors
148+                        sys.exit(8)
149+                open(pofile, 'wb').write(msgs)
150+                os.unlink(potfile)
151Index: django/core/management/commands/messagescompile.py
152===================================================================
153--- django/core/management/commands/messagescompile.py  (revision 0)
154+++ django/core/management/commands/messagescompile.py  (revision 0)
155@@ -0,0 +1,58 @@
156+import os
157+import sys
158+from optparse import make_option
159+from django.core.management.base import BaseCommand, CommandError, get_locale_dir
160+from django.core.management.color import no_style
161+
162+try:
163+    set
164+except NameError:
165+    from sets import Set as set     # For Python 2.3
166+
167+class Command(BaseCommand):
168+    option_list = BaseCommand.option_list + (
169+        make_option('--locale', '-l', dest='locale',
170+            help='The locale to process. Default is to process all.'),
171+    )
172+    help = 'Compiles .po files to .mo files for use with builtin gettext support.'
173+
174+    requires_model_validation = False
175+    can_import_settings = False
176+
177+    def handle(self, **options):
178+        basedirs = (os.path.join('conf', 'locale'), 'locale')
179+        if os.environ.get('DJANGO_SETTINGS_MODULE'):
180+            from django.conf import settings
181+            basedirs += settings.LOCALE_PATHS
182+
183+        # Gather existing directories.
184+        basedirs = set(map(os.path.abspath, filter(os.path.isdir, basedirs)))
185+       
186+        if not basedirs:
187+            raise CommandError("This script should be run from the Django SVN tree or your project or app tree, or with the settings module specified.")
188+
189+        locale = options.get('locale', None)
190+
191+        def compile_messages_in_dir(basedir):
192+            for dirpath, dirnames, filenames in os.walk(basedir):
193+                for f in filenames:
194+                    if f.endswith('.po'):
195+                        sys.stderr.write('processing file %s in %s\n' % (f, dirpath))
196+                        pf = os.path.splitext(os.path.join(dirpath, f))[0]
197+                        # Store the names of the .mo and .po files in an environment
198+                        # variable, rather than doing a string replacement into the
199+                        # command, so that we can take advantage of shell quoting, to
200+                        # quote any malicious characters/escaping.
201+                        # See http://cyberelk.net/tim/articles/cmdline/ar01s02.html
202+                        os.environ['djangocompilemo'] = pf + '.mo'
203+                        os.environ['djangocompilepo'] = pf + '.po'
204+                        if sys.platform == 'win32': # Different shell-variable syntax
205+                            cmd = 'msgfmt --check-format -o "%djangocompilemo%" "%djangocompilepo%"'
206+                        else:
207+                            cmd = 'msgfmt --check-format -o "$djangocompilemo" "$djangocompilepo"'
208+                        os.system(cmd)
209+
210+        for basedir in basedirs:
211+            if locale:
212+                basedir = os.path.join(basedir, locale, 'LC_MESSAGES')
213+            compile_messages_in_dir(basedir)
214Index: django/core/management/commands/cleanup.py
215===================================================================
216--- django/core/management/commands/cleanup.py  (revision 0)
217+++ django/core/management/commands/cleanup.py  (revision 0)
218@@ -0,0 +1,11 @@
219+import datetime
220+from django.core.management.base import NoArgsCommand
221+
222+class Command(NoArgsCommand):
223+    help = "Can be run as a cronjob or directly to clean out old data from the database (only expired sessions at the moment)."
224+
225+    def handle_noargs(self, **options):
226+        from django.db import transaction
227+        from django.contrib.sessions.models import Session
228+        Session.objects.filter(expire_date__lt=datetime.datetime.now()).delete()
229+        transaction.commit_unless_managed()
230Index: django/core/management/base.py
231===================================================================
232--- django/core/management/base.py      (revision 7140)
233+++ django/core/management/base.py      (working copy)
234@@ -230,3 +230,13 @@
235         st = os.stat(filename)
236         new_permissions = stat.S_IMODE(st.st_mode) | stat.S_IWUSR
237         os.chmod(filename, new_permissions)
238+
239+def get_locale_dir():
240+    "Returns the locale directory from the Django SVN tree or an application/project"
241+    if os.path.isdir(os.path.join('conf', 'locale')):
242+        basedir = os.path.abspath(os.path.join('conf', 'locale'))
243+    elif os.path.isdir('locale'):
244+        basedir = os.path.abspath('locale')
245+    else:
246+        raise CommandError("This script should be run from the Django SVN tree or your project or app tree. If you did indeed run it from the SVN checkout or your project or application, maybe you are just missing the conf/locale (in the django tree) or locale (for project and application) directory? It is not created automatically, you have to create it by hand if you want to enable i18n for your project or application.")
247+    return basedir
248Index: django/bin/daily_cleanup.py
249===================================================================
250--- django/bin/daily_cleanup.py (revision 7140)
251+++ django/bin/daily_cleanup.py (working copy)
252@@ -7,14 +7,7 @@
253 sessions at the moment).
254 """
255 
256-import datetime
257-from django.db import transaction
258-from django.contrib.sessions.models import Session
259+from django.core import management
260 
261-def clean_up():
262-    """Clean up expired sessions."""
263-    Session.objects.filter(expire_date__lt=datetime.datetime.now()).delete()
264-    transaction.commit_unless_managed()
265-
266 if __name__ == "__main__":
267-    clean_up()
268+    management.call_command('cleanup')
269Index: django/bin/compile-messages.py
270===================================================================
271--- django/bin/compile-messages.py      (revision 7140)
272+++ django/bin/compile-messages.py      (working copy)
273@@ -1,52 +1,8 @@
274 #!/usr/bin/env python
275 
276 import optparse
277-import os
278-import sys
279+from django.core import management
280 
281-try:
282-    set
283-except NameError:
284-    from sets import Set as set     # For Python 2.3
285-
286-
287-def compile_messages(locale=None):
288-    basedirs = (os.path.join('conf', 'locale'), 'locale')
289-    if os.environ.get('DJANGO_SETTINGS_MODULE'):
290-        from django.conf import settings
291-        basedirs += settings.LOCALE_PATHS
292-
293-    # Gather existing directories.
294-    basedirs = set(map(os.path.abspath, filter(os.path.isdir, basedirs)))
295-
296-    if not basedirs:
297-        print "This script should be run from the Django SVN tree or your project or app tree, or with the settings module specified."
298-        sys.exit(1)
299-
300-    for basedir in basedirs:
301-        if locale:
302-            basedir = os.path.join(basedir, locale, 'LC_MESSAGES')
303-        compile_messages_in_dir(basedir)
304-
305-def compile_messages_in_dir(basedir):
306-    for dirpath, dirnames, filenames in os.walk(basedir):
307-        for f in filenames:
308-            if f.endswith('.po'):
309-                sys.stderr.write('processing file %s in %s\n' % (f, dirpath))
310-                pf = os.path.splitext(os.path.join(dirpath, f))[0]
311-                # Store the names of the .mo and .po files in an environment
312-                # variable, rather than doing a string replacement into the
313-                # command, so that we can take advantage of shell quoting, to
314-                # quote any malicious characters/escaping.
315-                # See http://cyberelk.net/tim/articles/cmdline/ar01s02.html
316-                os.environ['djangocompilemo'] = pf + '.mo'
317-                os.environ['djangocompilepo'] = pf + '.po'
318-                if sys.platform == 'win32': # Different shell-variable syntax
319-                    cmd = 'msgfmt --check-format -o "%djangocompilemo%" "%djangocompilepo%"'
320-                else:
321-                    cmd = 'msgfmt --check-format -o "$djangocompilemo" "$djangocompilepo"'
322-                os.system(cmd)
323-
324 def main():
325     parser = optparse.OptionParser()
326     parser.add_option('-l', '--locale', dest='locale',
327@@ -56,9 +12,9 @@
328     options, args = parser.parse_args()
329     if len(args):
330         parser.error("This program takes no arguments")
331-    if options.settings:
332-        os.environ['DJANGO_SETTINGS_MODULE'] = options.settings
333-    compile_messages(options.locale)
334+    if not options.settings:
335+        options.settings = None
336+    management.call_command('messagescompile', locale=options.locale, settings=options.settings)
337 
338 if __name__ == "__main__":
339     main()
340Index: django/bin/make-messages.py
341===================================================================
342--- django/bin/make-messages.py (revision 7140)
343+++ django/bin/make-messages.py (working copy)
344@@ -1,155 +1,32 @@
345 #!/usr/bin/env python
346 
347-# Need to ensure that the i18n framework is enabled
348-from django.conf import settings
349-settings.configure(USE_I18N = True)
350-
351-from django.utils.translation import templatize
352-import re
353 import os
354 import sys
355 import getopt
356-from itertools import dropwhile
357+import optparse
358+from django.core import management
359 
360-pythonize_re = re.compile(r'\n\s*//')
361+def main():
362+    parser = optparse.OptionParser()
363+    parser.add_option('-l', '--locale', dest='locale',
364+        help='Creates or updates the message files only for the given locale (e.g. pt_BR).')
365+    parser.add_option('-d', '--domain', dest='domain', default='django',
366+        help='The domain of the message files (default: "django").')
367+    parser.add_option('-v', '--verbose', action='store_true', dest='verbose', default=False,
368+        help='Verbosity output')
369+    parser.add_option('-a', '--all', action='store_true', dest='all', default=False,
370+        help='Reexamines all source code and templates for new translation strings and updates all message files for all available languages.')
371 
372-def make_messages():
373-    localedir = None
374-
375-    if os.path.isdir(os.path.join('conf', 'locale')):
376-        localedir = os.path.abspath(os.path.join('conf', 'locale'))
377-    elif os.path.isdir('locale'):
378-        localedir = os.path.abspath('locale')
379+    options, args = parser.parse_args()
380+    if len(args):
381+        parser.error("This program takes no arguments")
382+    if options.verbose:
383+        verbosity = 2
384     else:
385-        print "This script should be run from the django svn tree or your project or app tree."
386-        print "If you did indeed run it from the svn checkout or your project or application,"
387-        print "maybe you are just missing the conf/locale (in the django tree) or locale (for project"
388-        print "and application) directory?"
389-        print "make-messages.py doesn't create it automatically, you have to create it by hand if"
390-        print "you want to enable i18n for your project or application."
391-        sys.exit(1)
392+        verbosity = 1
393 
394-    (opts, args) = getopt.getopt(sys.argv[1:], 'l:d:va')
395+    management.call_command('messagesmake', locale=options.locale,
396+        domain=options.domain, verbosity=verbosity, all=options.all)
397 
398-    lang = None
399-    domain = 'django'
400-    verbose = False
401-    all = False
402-
403-    for o, v in opts:
404-        if o == '-l':
405-            lang = v
406-        elif o == '-d':
407-            domain = v
408-        elif o == '-v':
409-            verbose = True
410-        elif o == '-a':
411-            all = True
412-
413-    if domain not in ('django', 'djangojs'):
414-        print "currently make-messages.py only supports domains 'django' and 'djangojs'"
415-        sys.exit(1)
416-    if (lang is None and not all) or domain is None:
417-        print "usage: make-messages.py -l <language>"
418-        print "   or: make-messages.py -a"
419-        sys.exit(1)
420-
421-    languages = []
422-
423-    if lang is not None:
424-        languages.append(lang)
425-    elif all:
426-        languages = [el for el in os.listdir(localedir) if not el.startswith('.')]
427-
428-    for lang in languages:
429-
430-        print "processing language", lang
431-        basedir = os.path.join(localedir, lang, 'LC_MESSAGES')
432-        if not os.path.isdir(basedir):
433-            os.makedirs(basedir)
434-
435-        pofile = os.path.join(basedir, '%s.po' % domain)
436-        potfile = os.path.join(basedir, '%s.pot' % domain)
437-
438-        if os.path.exists(potfile):
439-            os.unlink(potfile)
440-
441-        all_files = []
442-        for (dirpath, dirnames, filenames) in os.walk("."):
443-            all_files.extend([(dirpath, f) for f in filenames])
444-        all_files.sort()
445-        for dirpath, file in all_files:
446-            if domain == 'djangojs' and file.endswith('.js'):
447-                if verbose: sys.stdout.write('processing file %s in %s\n' % (file, dirpath))
448-                src = open(os.path.join(dirpath, file), "rb").read()
449-                src = pythonize_re.sub('\n#', src)
450-                open(os.path.join(dirpath, '%s.py' % file), "wb").write(src)
451-                thefile = '%s.py' % file
452-                cmd = 'xgettext %s -d %s -L Perl --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy:1,2 --from-code UTF-8 -o - "%s"' % (
453-                    os.path.exists(potfile) and '--omit-header' or '', domain, os.path.join(dirpath, thefile))
454-                (stdin, stdout, stderr) = os.popen3(cmd, 't')
455-                msgs = stdout.read()
456-                errors = stderr.read()
457-                if errors:
458-                    print "errors happened while running xgettext on %s" % file
459-                    print errors
460-                    sys.exit(8)
461-                old = '#: '+os.path.join(dirpath, thefile)[2:]
462-                new = '#: '+os.path.join(dirpath, file)[2:]
463-                msgs = msgs.replace(old, new)
464-                if msgs:
465-                    open(potfile, 'ab').write(msgs)
466-                os.unlink(os.path.join(dirpath, thefile))
467-            elif domain == 'django' and (file.endswith('.py') or file.endswith('.html')):
468-                thefile = file
469-                if file.endswith('.html'):
470-                    src = open(os.path.join(dirpath, file), "rb").read()
471-                    thefile = '%s.py' % file
472-                    open(os.path.join(dirpath, thefile), "wb").write(templatize(src))
473-                if verbose:
474-                    sys.stdout.write('processing file %s in %s\n' % (file, dirpath))
475-                cmd = 'xgettext -d %s -L Python --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy:1,2 --keyword=ugettext_noop --keyword=ugettext_lazy --keyword=ungettext_lazy:1,2 --from-code UTF-8 -o - "%s"' % (
476-                    domain, os.path.join(dirpath, thefile))
477-                (stdin, stdout, stderr) = os.popen3(cmd, 't')
478-                msgs = stdout.read()
479-                errors = stderr.read()
480-                if errors:
481-                    print "errors happened while running xgettext on %s" % file
482-                    print errors
483-                    sys.exit(8)
484-                if thefile != file:
485-                    old = '#: '+os.path.join(dirpath, thefile)[2:]
486-                    new = '#: '+os.path.join(dirpath, file)[2:]
487-                    msgs = msgs.replace(old, new)
488-                if os.path.exists(potfile):
489-                    # Strip the header
490-                    msgs = '\n'.join(dropwhile(len, msgs.split('\n')))
491-                else:
492-                    msgs = msgs.replace('charset=CHARSET', 'charset=UTF-8')
493-                if msgs:
494-                    open(potfile, 'ab').write(msgs)
495-                if thefile != file:
496-                    os.unlink(os.path.join(dirpath, thefile))
497-
498-        if os.path.exists(potfile):
499-            (stdin, stdout, stderr) = os.popen3('msguniq --to-code=utf-8 "%s"' % potfile, 'b')
500-            msgs = stdout.read()
501-            errors = stderr.read()
502-            if errors:
503-                print "errors happened while running msguniq"
504-                print errors
505-                sys.exit(8)
506-            open(potfile, 'w').write(msgs)
507-            if os.path.exists(pofile):
508-                (stdin, stdout, stderr) = os.popen3('msgmerge -q "%s" "%s"' % (pofile, potfile), 'b')
509-                msgs = stdout.read()
510-                errors = stderr.read()
511-                if errors:
512-                    print "errors happened while running msgmerge"
513-                    print errors
514-                    sys.exit(8)
515-            open(pofile, 'wb').write(msgs)
516-            os.unlink(potfile)
517-
518 if __name__ == "__main__":
519-    make_messages()
520+    main()
521Index: extras/django_bash_completion
522===================================================================
523--- extras/django_bash_completion       (revision 7140)
524+++ extras/django_bash_completion       (working copy)
525@@ -42,13 +42,15 @@
526     prev="${COMP_WORDS[COMP_CWORD-1]}"
527 
528     # Standalone options
529-    opts="--help --settings --pythonpath --noinput --noreload --format --indent --verbosity --adminmedia --version"
530+    opts="--help --settings --pythonpath --noinput --noreload --locale --all --domain --format --indent --verbosity --adminmedia --version"
531+
532     # Actions
533-    actions="adminindex createcachetable dbshell diffsettings \
534-             dumpdata flush inspectdb loaddata reset runfcgi runserver \
535-             shell sql sqlall sqlclear sqlcustom sqlflush sqlindexes \
536-             sqlreset sqlsequencereset startapp startproject \
537-             syncdb test validate"
538+    actions="adminindex createcachetable cleanup dbshell diffsettings \
539+             dumpdata flush inspectdb loaddata messagescompile messagesmake \
540+             reset runfcgi runserver shell sql sqlall sqlclear sqlcustom \
541+             sqlflush sqlindexes sqlreset sqlsequencereset startapp \
542+             startproject syncdb test validate"
543+
544     # Action's options
545     action_shell_opts="--plain"
546     action_runfcgi_opts="host port socket method maxspare minspare maxchildren daemonize pidfile workdir"
547@@ -112,8 +114,9 @@
548                 return 0
549                 ;;
550 
551-            createcachetable|dbshell|diffsettings| \
552-            inspectdb|runserver|startapp|startproject|syncdb| \
553+            createcachetable|cleanup|dbshell|diffsettings| \
554+            inspectdb|messagescompile|messagesmake| \
555+            runserver|startapp|startproject|syncdb| \
556             validate)
557                 COMPREPLY=()
558                 return 0
559Index: docs/man/django-admin.1
560===================================================================
561--- docs/man/django-admin.1     (revision 7140)
562+++ docs/man/django-admin.1     (working copy)
563@@ -1,4 +1,4 @@
564-.TH "django-admin.py" "1" "June 2007" "Django Project" ""
565+.TH "django-admin.py" "1" "February 2008" "Django Project" ""
566 .SH "NAME"
567 django\-admin.py \- Utility script for the Django web framework
568 .SH "SYNOPSIS"
569@@ -21,6 +21,9 @@
570 .BI "adminindex [" "appname ..." "]"
571 Prints the admin\-index template snippet for the given app name(s).
572 .TP
573+.BI cleanup
574+Cleans out old data from the database (only expired sessions at the moment).
575+.TP
576 .BI "createcachetable [" "tablename" "]"
577 Creates the table needed to use the SQL cache backend
578 .TP
579@@ -43,6 +46,14 @@
580 .B sqlall
581 for the given app(s) in the current database.
582 .TP
583+.BI "messagescompile [" "\-\-locale=LOCALE" "]"
584+Compiles .po files to .mo files for use with builtin gettext support.
585+.TP
586+.BI "messagesmake [" "\-\-locale=LOCALE" "] [" "\-\-domain=DOMAIN" "] [" "\-\-all" "]"
587+Runs over the entire source tree of the current directory and pulls out all
588+strings marked for translation. It creates (or updates) a message file in the
589+conf/locale (in the django tree) or locale (for project and application) directory.
590+.TP
591 .BI "reset [" "appname ..." "]"
592 Executes
593 .B sqlreset
594@@ -136,7 +147,15 @@
595 .TP
596 .I \-\-adminmedia=ADMIN_MEDIA_PATH
597 Specifies the directory from which to serve admin media when using the development server.
598-
599+.TP
600+.I \-l, \-\-locale=LOCALE
601+The locale to process when using messagesmake or messagecompile.
602+.TP
603+.I \-d, \-\-domain=DOMAIN
604+The domain of the message files (default: "django") when using messagesmake.
605+.TP
606+.I \-a, \-\-all
607+Process all available locales when using messagesmake.
608 .SH "ENVIRONMENT"
609 .TP
610 .I DJANGO_SETTINGS_MODULE
611Index: docs/settings.txt
612===================================================================
613--- docs/settings.txt   (revision 7140)
614+++ docs/settings.txt   (working copy)
615@@ -614,7 +614,7 @@
616         ('en', gettext('English')),
617     )
618 
619-With this arrangement, ``make-messages.py`` will still find and mark these
620+With this arrangement, ``django-admin.py messagesmake`` will still find and mark these
621 strings for translation, but the translation won't happen at runtime -- so
622 you'll have to remember to wrap the languages in the *real* ``gettext()`` in
623 any code that uses ``LANGUAGES`` at runtime.
624Index: docs/i18n.txt
625===================================================================
626--- docs/i18n.txt       (revision 7140)
627+++ docs/i18n.txt       (working copy)
628@@ -122,8 +122,8 @@
629 
630 (The caveat with using variables or computed values, as in the previous two
631 examples, is that Django's translation-string-detecting utility,
632-``make-messages.py``, won't be able to find these strings. More on
633-``make-messages`` later.)
634+``djangoadmin.py messagesmake``, won't be able to find these strings. More on
635+``messagesmake`` later.)
636 
637 The strings you pass to ``_()`` or ``ugettext()`` can take placeholders,
638 specified with Python's standard named-string interpolation syntax. Example::
639@@ -392,12 +392,12 @@
640 available translation strings and how they should be represented in the given
641 language. Message files have a ``.po`` file extension.
642 
643-Django comes with a tool, ``bin/make-messages.py``, that automates the creation
644+Django comes with a tool, ``djangoadmin.py messagesmake``, that automates the creation
645 and upkeep of these files.
646 
647 To create or update a message file, run this command::
648 
649-    bin/make-messages.py -l de
650+    djangoadmin.py messagesmake -l de
651 
652 ...where ``de`` is the language code for the message file you want to create.
653 The language code, in this case, is in locale format. For example, it's
654@@ -422,7 +422,7 @@
655 
656 .. admonition:: No gettext?
657 
658-    If you don't have the ``gettext`` utilities installed, ``make-messages.py``
659+    If you don't have the ``gettext`` utilities installed, ``djangoadmin.py messagesmake``
660     will create empty files. If that's the case, either install the ``gettext``
661     utilities or just copy the English message file
662     (``conf/locale/en/LC_MESSAGES/django.po``) and use it as a starting point;
663@@ -439,7 +439,7 @@
664 
665     _("Welcome to my site.")
666 
667-...then ``make-messages.py`` will have created a ``.po`` file containing the
668+...then ``djangoadmin.py messagesmake`` will have created a ``.po`` file containing the
669 following snippet -- a message::
670 
671     #: path/to/python/module.py:23
672@@ -475,21 +475,21 @@
673 To reexamine all source code and templates for new translation strings and
674 update all message files for **all** languages, run this::
675 
676-    make-messages.py -a
677+    djangoadmin.py messagesmake -a
678 
679 Compiling message files
680 -----------------------
681 
682 After you create your message file -- and each time you make changes to it --
683 you'll need to compile it into a more efficient form, for use by ``gettext``.
684-Do this with the ``bin/compile-messages.py`` utility.
685+Do this with the ``djangoadmin.py messagescompile`` utility.
686 
687 This tool runs over all available ``.po`` files and creates ``.mo`` files,
688 which are binary files optimized for use by ``gettext``. In the same directory
689-from which you ran ``make-messages.py``, run ``compile-messages.py`` like
690+from which you ran ``djangoadmin.py messagesmake``, run ``djangoadmin.py messagescompile`` like
691 this::
692 
693-   bin/compile-messages.py
694+   djangoadmin.py messagescompile
695 
696 That's it. Your translations are ready for use.
697 
698@@ -597,7 +597,7 @@
699               ('en', ugettext('English')),
700           )
701 
702-      With this arrangement, ``make-messages.py`` will still find and mark
703+      With this arrangement, ``djangoadmin.py messagesmake`` will still find and mark
704       these strings for translation, but the translation won't happen at
705       runtime -- so you'll have to remember to wrap the languages in the *real*
706       ``ugettext()`` in any code that uses ``LANGUAGES`` at runtime.
707@@ -676,11 +676,11 @@
708       searched in that order for ``<language>/LC_MESSAGES/django.(po|mo)``
709     * ``$PYTHONPATH/django/conf/locale/<language>/LC_MESSAGES/django.(po|mo)``
710 
711-To create message files, you use the same ``make-messages.py`` tool as with the
712+To create message files, you use the same ``djangoadmin.py messagesmake`` tool as with the
713 Django message files. You only need to be in the right place -- in the directory
714 where either the ``conf/locale`` (in case of the source tree) or the ``locale/``
715 (in case of app messages or project messages) directory are located. And you
716-use the same ``compile-messages.py`` to produce the binary ``django.mo`` files
717+use the same ``djangoadmin.py messagescompile`` to produce the binary ``django.mo`` files
718 that are used by ``gettext``.
719 
720 You can also run ``compile-message.py --settings=path.to.settings`` to make
721@@ -694,13 +694,13 @@
722 files. If your applications need to be delivered to other users and will
723 be used in other projects, you might want to use app-specific translations.
724 But using app-specific translations and project translations could produce
725-weird problems with ``make-messages``: ``make-messages`` will traverse all
726+weird problems with ``messagesmake``: ``messagesmake`` will traverse all
727 directories below the current path and so might put message IDs into the
728 project message file that are already in application message files.
729 
730 The easiest way out is to store applications that are not part of the project
731 (and so carry their own translations) outside the project tree. That way,
732-``make-messages`` on the project level will only translate strings that are
733+``messagesmake`` on the project level will only translate strings that are
734 connected to your explicit project and not strings that are distributed
735 independently.
736 
737@@ -832,13 +832,13 @@
738 ----------------------------------------
739 
740 You create and update the translation catalogs the same way as the other
741-Django translation catalogs -- with the make-messages.py tool. The only
742+Django translation catalogs -- with the djangoadmin.py messagesmake tool. The only
743 difference is you need to provide a ``-d djangojs`` parameter, like this::
744 
745-    make-messages.py -d djangojs -l de
746+    djangoadmin.py messagesmake -d djangojs -l de
747 
748 This would create or update the translation catalog for JavaScript for German.
749-After updating translation catalogs, just run ``compile-messages.py`` the same
750+After updating translation catalogs, just run ``djangoadmin.py messagescompile`` the same
751 way as you do with normal Django translation catalogs.
752 
753 Specialties of Django translation
754Index: docs/django-admin.txt
755===================================================================
756--- docs/django-admin.txt       (revision 7140)
757+++ docs/django-admin.txt       (working copy)
758@@ -85,6 +85,12 @@
759 
760 .. _Tutorial 2: ../tutorial02/
761 
762+cleanup
763+-------
764+
765+Can be run as a cronjob or directly to clean out old data from the database
766+(only expired sessions at the moment).
767+
768 createcachetable <tablename>
769 ----------------------------
770 
771@@ -321,6 +327,76 @@
772 
773     django-admin.py loaddata --verbosity=2
774 
775+messagescompile
776+---------------
777+
778+Compiles .po files created with ``messagesmake`` to .mo files for use with
779+the builtin gettext support. See the `i18n documentation`_ for details.
780+
781+--locale
782+~~~~~~~~
783+
784+Use the ``--locale`` or ``-l`` option to specify the locale to process.
785+If not provided all locales are processed.
786+
787+Example usage::
788+
789+    django-admin.py messagescompile --locale=br_PT
790+
791+messagesmake
792+------------
793+
794+Runs over the entire source tree of the current directory and pulls out all
795+strings marked for translation. It creates (or updates) a message file in the
796+conf/locale (in the django tree) or locale (for project and application)
797+directory. After making changes to the messages files you need to compile them
798+with ``messagescompile`` for use with the builtin gettext support. See the
799+`i18n documentation`_ for details.
800+
801+.. _i18n documentation: ../i18n/#how-to-create-language-files
802+
803+--all
804+~~~~~
805+
806+Use the ``--all`` or ``-a`` option to update the message files for all
807+available languages.
808+
809+Example usage::
810+
811+    django-admin.py messagesmake --all
812+
813+--locale
814+~~~~~~~~
815+
816+Use the ``--locale`` or ``-l`` option to specify the locale to process.
817+
818+Example usage::
819+
820+    django-admin.py messagesmake --locale=br_PT
821+
822+--domain
823+~~~~~~~~
824+
825+Use the ``--domain`` or ``-d`` option to change the domain of the messages files.
826+Currently supported:
827+
828+       * ``django`` for all ``*.py`` and ``*.html`` files (default)
829+       * ``djangojs`` for ``*.js`` files
830+
831+--verbosity
832+~~~~~~~~~~~
833+
834+Use ``--verbosity`` or ``-v`` to specify the amount of notification and debug
835+information that ``django-admin.py`` should print to the console.
836+
837+       * ``0`` means no input.
838+       * ``1`` means normal input (default).
839+       * ``2`` means verbose input.
840+
841+Example usage::
842+
843+    django-admin.py messagesmake --verbosity=2
844+
845 reset <appname appname ...>
846 ---------------------------
847