Exemple #1
0
 def main_help_text(self, commands_only=False):
     """
     Returns the script's main help text, as a string.
     """
     if commands_only:
         usage = sorted(get_commands().keys())
     else:
         usage = [
             "",
             "Type '%s help <subcommand>' for help on a specific subcommand." % self.prog_name,
             "",
             "Available subcommands:",
         ]
         commands_dict = collections.defaultdict(lambda: [])
         for name, app in six.iteritems(get_commands()):
             if app == 'djangocg.core':
                 app = 'django'
             else:
                 app = app.rpartition('.')[-1]
             commands_dict[app].append(name)
         style = color_style()
         for app in sorted(commands_dict.keys()):
             usage.append("")
             usage.append(style.NOTICE("[%s]" % app))
             for name in sorted(commands_dict[app]):
                 usage.append("    %s" % name)
     return '\n'.join(usage)
Exemple #2
0
 def __init__(self, *args, **kwargs):
     from djangocg.conf import settings
     self.admin_static_prefix = urljoin(settings.STATIC_URL, 'admin/')
     # We set self.path to avoid crashes in log_message() on unsupported
     # requests (like "OPTIONS").
     self.path = ''
     self.style = color_style()
     super(WSGIRequestHandler, self).__init__(*args, **kwargs)
 def __init__(self, outfile=sys.stdout):
     self.errors = []
     self.outfile = outfile
     self.style = color_style()
Exemple #4
0
 def __init__(self):
     self.style = color_style()