Ticket #6338: patch.2.diff

File patch.2.diff, 1.5 KB (added by Ashutosh Dwivedi, 13 years ago)

patches the same in /django/core/management/command.py

  • django/core/management/commands/dbshell.py

    diff --git a/django/core/management/commands/dbshell.py b/django/core/management/commands/dbshell.py
    index a6b5427..14a1f77 100644
    a b  
    11from optparse import make_option
     2import errno
    23
    34from django.core.management.base import BaseCommand, CommandError
    45from django.db import connections, DEFAULT_DB_ALIAS
    class Command(BaseCommand):  
    1920        connection = connections[options.get('database', DEFAULT_DB_ALIAS)]
    2021        try:
    2122            connection.client.runshell()
    22         except OSError:
    23             # Note that we're assuming OSError means that the client program
    24             # isn't installed. There's a possibility OSError would be raised
    25             # for some other reason, in which case this error message would be
    26             # inaccurate. Still, this message catches the common case.
    27             raise CommandError('You appear not to have the %r program installed or on your path.' % \
    28                 connection.client.executable_name)
     23        except OSError, er:
     24            # In case the  client program's executable is not found display an
     25            # appropriate error message else raise the exception for user to
     26            # figure out what is wrong
     27            if er.errno == errno.ENOENT:
     28                raise CommandError('You appear not to have the %r program installed or on your path.' % \
     29                                       connection.client.executable_name)
     30            else:
     31                raise
Back to Top