Autocreates the CCP header from the ADMINS setting

This commit is contained in:
2011-06-16 13:16:39 +01:00
parent 8e4eaec94c
commit ab95de756f

View File

@@ -67,7 +67,10 @@ class CachedDocumentManager(models.Manager):
if created or not doc.cached_until or datetime.utcnow() > doc.cached_until or no_cache:
req = urllib2.Request(url)
req.add_header('CCP-Contact', 'matalok@pleaseignore.com')
# Add a header with the admin information in, so CCP can traceback the requests if needed
if settings.ADMINS:
req.add_header('CCP-Contact', str(', ').join(['%s <%s>' % (name, email) for name, email in settings.ADMINS]))
try:
if sys.version_info < (2, 6):
conn = urllib2.urlopen(req)