1 | #!/usr/bin/python
|
---|
2 | """
|
---|
3 | django must be installed
|
---|
4 | execute this script in a functioning django environment
|
---|
5 | * Make sure DJANGO_SETTINGS_MODULE environment var is set
|
---|
6 | * Make sure the module to which it points is on python path
|
---|
7 |
|
---|
8 | Then run this script on genindex.html
|
---|
9 |
|
---|
10 | Take results with grain of salt; not all objects documented are meant to be imported directly
|
---|
11 | """
|
---|
12 |
|
---|
13 | import fileinput
|
---|
14 | import re
|
---|
15 |
|
---|
16 | module_re = re.compile(r'href="(.*\.html)#django\.[\w.]+">(\w+)(?:\(\) \(in module| \(class in) (django\.[\w.]+)\)')
|
---|
17 | for line in fileinput.input():
|
---|
18 | match = module_re.search(line)
|
---|
19 | if match:
|
---|
20 | html, obj, mod = match.groups()
|
---|
21 | try:
|
---|
22 | m = __import__(mod, fromlist=[obj])
|
---|
23 | getattr(m, obj)
|
---|
24 | except (ImportError, AttributeError):
|
---|
25 | print "%s, %s, %s" % (html, mod, obj)
|
---|