~ubuntu-branches/ubuntu/jaunty/python-django/jaunty-backports

« back to all changes in this revision

Viewing changes to django/core/management/commands/dbshell.py

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant
  • Date: 2008-11-15 19:15:33 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20081115191533-xbt1ut2xf4fvwtvc
Tags: 1.0.1-0ubuntu1
* New upstream release:
  - Bug fixes.

* The tests/ sub-directory appaers to have been dropped upstream, so pull
  our patch to workaround the tests and modify the rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
from django.core.management.base import NoArgsCommand
 
1
from django.core.management.base import NoArgsCommand, CommandError
2
2
 
3
3
class Command(NoArgsCommand):
4
4
    help = "Runs the command-line client for the current DATABASE_ENGINE."
7
7
 
8
8
    def handle_noargs(self, **options):
9
9
        from django.db import connection
10
 
        connection.client.runshell()
 
10
        try:
 
11
            connection.client.runshell()
 
12
        except OSError:
 
13
            # Note that we're assuming OSError means that the client program
 
14
            # isn't installed. There's a possibility OSError would be raised
 
15
            # for some other reason, in which case this error message would be
 
16
            # inaccurate. Still, this message catches the common case.
 
17
            raise CommandError('You appear not to have the %r program installed or on your path.' % \
 
18
                connection.client.executable_name)