# Buggy code
def performance(request):
    """
    Shows performance tuning tips.
    """
    checks = []
    # Check for debug mode
    checks.append(
        (
            _("Debug mode"),
            not settings.DEBUG,
            "production-debug",
        )
    )
    # Check for domain configuration
    checks.append(
        (
            _("Site domain"),
            Site.objects.get_current() != "example.net",
            "production-site",
        )
    )
    # Check database being used
    checks.append(
        (
            _("Database backend"),
            "sqlite" not in settings.DATABASES["default"]["ENGINE"],
            "production-database",
        )
    )
    # Check configured admins
    checks.append(
        (
            _("Site administrator"),
            len(settings.ADMINS) > 0,
            "production-admins",
        )
    )
    # Check offloading indexing
    checks.append(
        (
            # Translators: Indexing is postponed to cron job
            _("Indexing offloading"),
            settings.OFFLOAD_INDEXING,
            "production-indexing",
        )
    )
    # Check for sane caching
    cache = settings.CACHES["default"]["BACKEND"].split(".")[-1]
    if cache in ["MemcachedCache", "DatabaseCache"]:
        # We consider these good
        cache = True
    elif cache in ["DummyCache"]:
        # This one is definitely bad
        cache = False
    else:
        # These might not be that bad
        cache = None
    checks.append(
        (
            _("Django caching"),
            cache,
            "production-cache",
        )
    )
    # Check email setup
    default_mails = ("root@localhost", "webmaster@localhost", "noreply@weblate.org")
    checks.append(
        (
            _("Email addresses"),
            (
                settings.SERVER_EMAIL not in default_mails
                and settings.DEFAULT_FROM_EMAIL not in default_mails
            ),
            "production-email",
        )
    )
    return render_to_response(
        "admin/performance.html",
        RequestContext(
            request,
            {
                "checks": checks,
            },
        ),
    )


# Traceback (AttributeError)
Traceback (most recent call last):

File "/srv/weblate/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/srv/weblate/src/weblate/weblate/trans/views.py", line 1395, in translate
saved = unit.save_backend(request)
File "/srv/weblate/src/weblate/weblate/trans/models.py", line 2478, in save_backend
self.translation.update_lock(request)
File "/srv/weblate/src/weblate/weblate/trans/models.py", line 1463, in update_lock
self.create_lock(request.user)
File "/srv/weblate/src/weblate/weblate/trans/models.py", line 1434, in create_lock
self.update_lock_time(explicit, is_new)
File "/srv/weblate/src/weblate/weblate/trans/models.py", line 1443, in update_lock_time
seconds = settings.AUTO_LOCK_TIME
File "/srv/weblate/local/lib/python2.7/site-packages/django/utils/functional.py", line 185, in inner
return func(self._wrapped, *args)
AttributeError: 'Settings' object has no attribute 'AUTO_LOCK_TIME'

# Fixed code
def performance(request):
    """
    Shows performance tuning tips.
    """
    checks = []
    # Check for debug mode
    checks.append(
        (
            _("Debug mode"),
            not settings.DEBUG,
            "production-debug",
        )
    )
    # Check for domain configuration
    checks.append(
        (
            _("Site domain"),
            Site.objects.get_current() != "example.net",
            "production-site",
        )
    )
    # Check database being used
    checks.append(
        (
            _("Database backend"),
            "sqlite" not in settings.DATABASES["default"]["ENGINE"],
            "production-database",
        )
    )
    # Check configured admins
    checks.append(
        (
            _("Site administrator"),
            len(settings.ADMINS) > 0,
            "production-admins",
        )
    )
    # Check offloading indexing
    checks.append(
        (
            # Translators: Indexing is postponed to cron job
            _("Indexing offloading"),
            appsettings.OFFLOAD_INDEXING,
            "production-indexing",
        )
    )
    # Check for sane caching
    cache = settings.CACHES["default"]["BACKEND"].split(".")[-1]
    if cache in ["MemcachedCache", "DatabaseCache"]:
        # We consider these good
        cache = True
    elif cache in ["DummyCache"]:
        # This one is definitely bad
        cache = False
    else:
        # These might not be that bad
        cache = None
    checks.append(
        (
            _("Django caching"),
            cache,
            "production-cache",
        )
    )
    # Check email setup
    default_mails = ("root@localhost", "webmaster@localhost", "noreply@weblate.org")
    checks.append(
        (
            _("Email addresses"),
            (
                settings.SERVER_EMAIL not in default_mails
                and settings.DEFAULT_FROM_EMAIL not in default_mails
            ),
            "production-email",
        )
    )
    return render_to_response(
        "admin/performance.html",
        RequestContext(
            request,
            {
                "checks": checks,
            },
        ),
    )