Update the management commands to be compatible with Django 1.6+.

Review Request #8680 — Created Jan. 30, 2017 and submitted

Information

Djblets
release-0.10.x
5489521...

Reviewers

Newer versions of Django switched to using ArgumentParser instead of
OptionParser for arguments to management commands, and got rid of
NoArgsCommand. While ArgumentParser and OptionParser are fairly
compatible for most things, the changes to how options are registered in
Django management commands were fairly extensive, making it harder to
keep compatibility with both.

This change introduces a compatibility class for management commands
that allows the commands to code for the new style of argument
registration, while providing compatibility with the OptionParsers used
in Django 1.6. This can be used by projects that need to keep
compatibility between the two.

The management commands that ship with Djblets have been updated to use
the new class and new style of argument registration.

Tested each command on Django 1.6, 1.8, and 1.10.

Description From Last Updated

Col: 5 E303 too many blank lines (2)

reviewbotreviewbot

Col: 13 E265 block comment should start with '# '

reviewbotreviewbot

typo: exposrs

daviddavid
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/siteconfig/management/commands/get-siteconfig.py
        djblets/siteconfig/management/commands/list-siteconfig.py
        djblets/siteconfig/management/commands/set-siteconfig.py
        djblets/util/compat/django/core/management/base.py
        djblets/extensions/management/commands/install-extension-media.py
    
    Ignored Files:
        djblets/util/compat/django/core/management/__init__.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/siteconfig/management/commands/get-siteconfig.py
        djblets/siteconfig/management/commands/list-siteconfig.py
        djblets/siteconfig/management/commands/set-siteconfig.py
        djblets/util/compat/django/core/management/base.py
        djblets/extensions/management/commands/install-extension-media.py
    
    Ignored Files:
        djblets/util/compat/django/core/management/__init__.py
    
    
  2. Show all issues
    Col: 5
     E303 too many blank lines (2)
    
  3. Show all issues
    Col: 13
     E265 block comment should start with '# '
    
  4. 
      
brennie
  1. 
      
  2. Where does _use_real_option_list come from?

    1. It's set right in this function, which is why we access it this way and provide a default.

      Basically, we need to be able to populate a option_list from the arguments registered on the parser, but the act of creating the parser results in an access to the option_list attribute, which may/will have content that needs to be returned as-is. So we use this internal attribute to control which list we're accessing on lookup.

  3. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/siteconfig/management/commands/get-siteconfig.py
        djblets/siteconfig/management/commands/list-siteconfig.py
        djblets/siteconfig/management/commands/set-siteconfig.py
        djblets/util/compat/django/core/management/base.py
        djblets/extensions/management/commands/install-extension-media.py
    
    Ignored Files:
        djblets/util/compat/django/core/management/__init__.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/siteconfig/management/commands/get-siteconfig.py
        djblets/siteconfig/management/commands/list-siteconfig.py
        djblets/siteconfig/management/commands/set-siteconfig.py
        djblets/util/compat/django/core/management/base.py
        djblets/extensions/management/commands/install-extension-media.py
    
    Ignored Files:
        djblets/util/compat/django/core/management/__init__.py
    
    
  2. 
      
david
  1. 
      
  2. Show all issues

    typo: exposrs

  3. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-0.10.x (646f4ac)