liuyang1520 / django-command-extensions

Automatically exported from code.google.com/p/django-command-extensions
MIT License
0 stars 0 forks source link

when running graph_models, get "ImportError: cannot import name mark_safe" #58

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Trying to produce a picture. changing to a project directory and running:
./manage.py graph_models -a -g -o my_project_visualized.png

What is the expected output? What do you see instead?
I expect to see the png file and i see this error instead about a missing
mark_safe

Traceback (most recent call last):
  File "./manage.py", line 11, in <module>
    execute_manager(settings)
  File
"/usr/lib/python2.5/site-packages/django/core/management/__init__.py", line
340, in execute_manager
    utility.execute()
  File
"/usr/lib/python2.5/site-packages/django/core/management/__init__.py", line
295, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File
"/usr/lib/python2.5/site-packages/django/core/management/__init__.py", line
249, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File
"/usr/lib/python2.5/site-packages/django/core/management/__init__.py", line
67, in load_command_class
    {}, {}, ['Command']), 'Command')()
  File
"/usr/lib/python2.5/site-packages/extensions/management/commands/graph_models.py
",
line 3, in <module>
    from extensions.management.modelviz import generate_dot
  File
"/usr/lib/python2.5/site-packages/extensions/management/modelviz.py", line
45, in <module>
    from django.utils.encoding import mark_safe
ImportError: cannot import name mark_safe

What version of the product are you using? On what operating system?

version 0.3. OS: ubuntu linux 8.04 (Hardy)

Please provide any additional information below.

I searched around the django site and found that the mark_safe function is
available django.utils.safestring
I then edited this file 
/usr/lib/python2.5/site-packages/extensions/management/modelviz.py

and changed this line:
from django.utils.encoding import mark_safe
to this: 
from django.utils.safestring import mark_safe

And the error went away when i ran the original command and I got my picture :)

Original issue reported on code.google.com by yuvil...@gmail.com on 28 Sep 2008 at 10:10

GoogleCodeExporter commented 8 years ago
thanks for the report.

this was already fixed in svn.
i will add a 'big-fat-warning' on the index page to use svn with django-1.0 for 
the
time being :)

Original comment by v.oostv...@gmail.com on 2 Oct 2008 at 12:27