← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/maas/command-template into lp:maas

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/command-template into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jtv/maas/command-template/+merge/115469

We're doing so much of this, I thought it'd be helpful to have the boilerplate handy.

You may wonder why I documented the to-do steps with Xes rather than with “TODO.”  The reason is that some people use bzr plugins that will list TODO flags in the code.  It would be pointlessly disruptive to them to add TODO items in the templates.


Jeroen
-- 
https://code.launchpad.net/~jtv/maas/command-template/+merge/115469
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/maas/command-template into lp:maas.
=== added file 'templates/management_command.py'
--- templates/management_command.py	1970-01-01 00:00:00 +0000
+++ templates/management_command.py	2012-07-18 05:15:28 +0000
@@ -0,0 +1,36 @@
+# Copyright 2012 Canonical Ltd.  This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+# XXX: Document purpose.
+"""Django command: """
+
+from __future__ import (
+    absolute_import,
+    print_function,
+    unicode_literals,
+    )
+
+__metaclass__ = type
+__all__ = [
+    'Command',
+    ]
+
+from optparse import make_option
+
+from django.core.management.base import BaseCommand
+
+
+class Command(BaseCommand):
+
+    option_list = BaseCommand.option_list + (
+        # XXX: Define actual options.
+        make_option('--option', dest='option', default=None,
+            help="Your option goes here."),
+      )
+    # XXX: Describe the command.
+    help = "Purpose of this command."
+
+    def handle(self, *args, **options):
+        # XXX: Replace the lines below with your actual code.
+        option = options.get('option', None)
+        print(option)