web/lib/django/db/backends/dummy/base.py
changeset 29 cc9b7e14412b
parent 0 0d40e90630ef
equal deleted inserted replaced
28:b758351d191f 29:cc9b7e14412b
     1 """
     1 """
     2 Dummy database backend for Django.
     2 Dummy database backend for Django.
     3 
     3 
     4 Django uses this if the DATABASE_ENGINE setting is empty (None or empty string).
     4 Django uses this if the database ENGINE setting is empty (None or empty string).
     5 
     5 
     6 Each of these API functions, except connection.close(), raises
     6 Each of these API functions, except connection.close(), raises
     7 ImproperlyConfigured.
     7 ImproperlyConfigured.
     8 """
     8 """
     9 
     9 
    10 from django.core.exceptions import ImproperlyConfigured
    10 from django.core.exceptions import ImproperlyConfigured
    11 from django.db.backends import *
    11 from django.db.backends import *
    12 from django.db.backends.creation import BaseDatabaseCreation
    12 from django.db.backends.creation import BaseDatabaseCreation
    13 
    13 
    14 def complain(*args, **kwargs):
    14 def complain(*args, **kwargs):
    15     raise ImproperlyConfigured, "You haven't set the DATABASE_ENGINE setting yet."
    15     raise ImproperlyConfigured("You haven't set the database ENGINE setting yet.")
    16 
    16 
    17 def ignore(*args, **kwargs):
    17 def ignore(*args, **kwargs):
    18     pass
    18     pass
    19 
    19 
    20 class DatabaseError(Exception):
    20 class DatabaseError(Exception):
    39     operators = {}
    39     operators = {}
    40     cursor = complain
    40     cursor = complain
    41     _commit = complain
    41     _commit = complain
    42     _rollback = ignore
    42     _rollback = ignore
    43 
    43 
    44     def __init__(self, *args, **kwargs):
    44     def __init__(self, settings_dict, alias, *args, **kwargs):
    45         self.features = BaseDatabaseFeatures()
    45         self.features = BaseDatabaseFeatures()
    46         self.ops = DatabaseOperations()
    46         self.ops = DatabaseOperations()
    47         self.client = DatabaseClient(self)
    47         self.client = DatabaseClient(self)
    48         self.creation = BaseDatabaseCreation(self)
    48         self.creation = BaseDatabaseCreation(self)
    49         self.introspection = DatabaseIntrospection(self)
    49         self.introspection = DatabaseIntrospection(self)
    50         self.validation = BaseDatabaseValidation()
    50         self.validation = BaseDatabaseValidation(self)
       
    51 
       
    52         self.settings_dict = settings_dict
       
    53         self.alias = alias
    51 
    54 
    52     def close(self):
    55     def close(self):
    53         pass
    56         pass