Closed nikolas closed 8 years ago
@nikolas, just a few hints to get you started, if you don't mind:
try
-except
approach may be more pythonic, e.g.try:
from argparse import ArgumentParser # New since Python 2.7
parser = ArgumentParser()
except ImportError:
from optparse import OptionParser # Deprecated since Python 2.7
parser = OptionParser()
parser.add_argument = parser.add_option # use add_argument in any case
parser.add_argument('foo', help='foo does bar and baz')
# ... and a similar try-except block for the actual parsing and evaluation
@bittner thanks for the tips!
Another note: I just see, until Django 1.7 optparse's make_option
is used for the option_list
. The implementation of our management command pretty much depends on that. Django 1.8 makes the switch finally to argparse. I fear an implementation change on our side will probably have to follow their approach and may need to consider the Django version in use.
This deprecation warning is a bit annoying. Any news?
This affects
Anything else?
What is the exact deprecation warning, and when does it occur? (I don't notice any with Python 3.4 and Django 1.8)
@mixxorz We should address this deprecation warning now that we're under the hood of the behave
organization. As more and more developers start using Django 1.9 this issue becomes more visible.
I noticed
behave.py
usesoptparse
.. I think we should switch toargparse
as it's better supported.From https://docs.python.org/2/library/optparse.html
I'll try to make a PR for this at some point, unless you get to it before I do.