15bf56cfe9c3455ce6d74657e6ab2fa9219ea63b
[idea/community.git] / python / helpers / pycharm / django_obtainer.py
1 # coding=utf-8
2 """
3 This XML is part of API implemented by XmlDumper, but data fetch engine is optparse-specific (at least in Django <1.8)
4 and implemented in _django_obtainer_optparse.py.
5
6 Module to be call package directly, just to get XML, but be sure env var DJANGO_SETTINGS_MODULE is set to something
7 like "mysite.settings"
8 """
9 from distutils.version import LooseVersion
10 import django
11 import _django_obtainer_optparse
12 from _django_obtainer_core import XmlDumper
13
14 __author__ = 'Ilya.Kazakevich'
15
16 # TODO: Support Django 1.8 as well, it uses argparse, not optparse
17 assert LooseVersion(django.get_version()) < LooseVersion('1.8a'), "Only Django <1.8 is supported now"
18 dumper = XmlDumper()
19 _django_obtainer_optparse.report_data(dumper)
20 print(dumper.xml)