context_processors.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. # Copyright 2013 The Distro Tracker Developers
  2. # See the COPYRIGHT file at the top-level directory of this distribution and
  3. # at http://deb.li/DTAuthors
  4. #
  5. # This file is part of Distro Tracker. It is subject to the license terms
  6. # in the LICENSE file found in the top-level directory of this
  7. # distribution and at http://deb.li/DTLicense. No part of Distro Tracker,
  8. # including this file, may be copied, modified, propagated, or distributed
  9. # except according to the terms contained in the LICENSE file.
  10. """Implements Django context processors specific to Distro Tracker."""
  11. from __future__ import unicode_literals
  12. from django.conf import settings
  13. #: Defines a dictionary of all Distro Tracker extra context key/value pairs that
  14. #: are to be included in the
  15. #: :class:`RequestContext <django.template.RequestContext>`.
  16. DISTRO_TRACKER_EXTRAS = {
  17. 'DISTRO_TRACKER_VENDOR_NAME': settings.DISTRO_TRACKER_VENDOR_NAME,
  18. 'DISTRO_TRACKER_VENDOR_URL': getattr(settings, 'DISTRO_TRACKER_VENDOR_URL',
  19. ''),
  20. 'DISTRO_TRACKER_CONTACT_EMAIL': settings.DISTRO_TRACKER_CONTACT_EMAIL,
  21. 'DISTRO_TRACKER_CONTROL_EMAIL': settings.DISTRO_TRACKER_CONTROL_EMAIL,
  22. 'DISTRO_TRACKER_SITE_DOMAIN': settings.DISTRO_TRACKER_FQDN,
  23. }
  24. def extras(request):
  25. """
  26. The context processor which includes the
  27. :py:data:`DISTRO_TRACKER_EXTRAS
  28. <distro_tracker.core.context_processors.DISTRO_TRACKER_EXTRAS>` in the
  29. :class:`RequestContext <django.template.RequestContext>`.
  30. """
  31. return DISTRO_TRACKER_EXTRAS