Django

Code

Changeset 886

Show
Ignore:
Timestamp:
10/16/05 11:17:48 (3 years ago)
Author:
hugo
Message:

i18n: merged to [885] in trunk

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/i18n/django/conf/global_settings.py

    r874 r886  
    5656 
    5757# Database connection info. 
    58 DATABASE_ENGINE = 'postgresql' # 'postgresql', 'mysql', or 'sqlite3'. 
    59 DATABASE_NAME = '' 
    60 DATABASE_USER = '' 
    61 DATABASE_PASSWORD = '' 
    62 DATABASE_HOST = ''             # Set to empty string for localhost. 
    63 DATABASE_PORT = ''             # Set to empty string for default. 
     58DATABASE_ENGINE = 'postgresql' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. 
     59DATABASE_NAME = ''             # Or path to database file if using sqlite3. 
     60DATABASE_USER = ''             # Not used with sqlite3. 
     61DATABASE_PASSWORD = ''         # Not used with sqlite3. 
     62DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3. 
     63DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3. 
    6464 
    6565# Host for sending e-mail. 
  • django/branches/i18n/django/conf/project_template/settings/main.py

    r869 r886  
    1111LANGUAGE_CODE = 'en-us' 
    1212 
    13 DATABASE_ENGINE = 'postgresql' # 'postgresql', 'mysql', or 'sqlite3'. 
     13DATABASE_ENGINE = 'postgresql' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. 
    1414DATABASE_NAME = ''             # Or path to database file if using sqlite3. 
    1515DATABASE_USER = ''             # Not used with sqlite3. 
  • django/branches/i18n/django/core/handlers/base.py

    r580 r886  
    33class BaseHandler: 
    44    def __init__(self): 
    5         self._request_middleware = self._view_middleware = self._response_middleware = None 
     5        self._request_middleware = self._view_middleware = self._response_middleware = self._exception_middleware = None 
    66 
    77    def load_middleware(self): 
     
    1616        self._view_middleware = [] 
    1717        self._response_middleware = [] 
     18        self._exception_middleware = [] 
    1819        for middleware_path in settings.MIDDLEWARE_CLASSES: 
    1920            dot = middleware_path.rindex('.') 
     
    3940            if hasattr(mw_instance, 'process_response'): 
    4041                self._response_middleware.insert(0, mw_instance.process_response) 
     42            if hasattr(mw_instance, 'process_exception'): 
     43                self._exception_middleware.insert(0, mw_instance.process_exception) 
    4144 
    4245    def get_response(self, path, request): 
     
    6265                    return response 
    6366 
    64             response = callback(request, **param_dict) 
     67            try: 
     68                response = callback(request, **param_dict) 
     69            except Exception, e: 
     70                # If the view raised an exception, run it through exception 
     71                # middleware, and if the exception middleware returns a 
     72                # response, use that. Otherwise, reraise the exception. 
     73                for middleware_method in self._exception_middleware: 
     74                    response = middleware_method(request, e) 
     75                    if response: 
     76                        return response 
     77                raise e 
    6578 
    6679            # Complain if the view returned None (a common error). 
  • django/branches/i18n/django/core/meta/__init__.py

    r815 r886  
    564564 
    565565        # Give the class a docstring -- its definition. 
    566         new_class.__doc__ = "%s.%s(%s)" % (opts.module_name, name, ", ".join([f.name for f in opts.fields])) 
     566        if new_class.__doc__ is None: 
     567            new_class.__doc__ = "%s.%s(%s)" % (opts.module_name, name, ", ".join([f.name for f in opts.fields])) 
    567568 
    568569        # Create the standard, module-level API helper functions such 
  • django/branches/i18n/django/utils/decorators.py

    r844 r886  
    1717                if result is not None: 
    1818                    return result 
    19             response = view_func(request, *args, **kwargs) 
     19            try: 
     20                response = view_func(request, *args, **kwargs) 
     21            except Exception, e: 
     22                if hasattr(middleware, 'process_exception'): 
     23                    result = middleware.process_exception(request, e) 
     24                    if result is not None: 
     25                        return result 
     26                raise e 
    2027            if hasattr(middleware, 'process_response'): 
    2128                result = middleware.process_response(request, response) 
  • django/branches/i18n/docs/middleware.txt

    r815 r886  
    169169``HttpResponse``. 
    170170 
     171process_exception 
     172----------------- 
     173 
     174Interface: ``process_exception(self, request, exception)`` 
     175 
     176``request`` is an ``HttpRequest`` object. ``exception`` is an ``Exception`` 
     177object raised by the view function. 
     178 
     179Django calls ``process_exception()`` when a view raises an exception. 
     180``process_exception()`` should return either ``None`` or an ``HttpResponse`` 
     181object. If it returns an ``HttpResponse`` object, the response will be returned 
     182to the browser. Otherwise, default exception handling kicks in. 
     183 
    171184Guidelines 
    172185----------