Skip to content

Commit

Permalink
abandoning the caching stuff for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
anutron committed Oct 7, 2009
1 parent 4000faf commit 1443c9a
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions django/mootools/depender/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@

import logging
import datetime
from email.Utils import mktime_tz, parsedate_tz
import re
import time

from django.http import HttpResponse, HttpResponseNotModified
from django.utils.http import http_date
from django.conf import settings

from depender.core import Depender
Expand All @@ -22,7 +19,6 @@ def make_depender():
return depender

depender = make_depender()
server_started = time.time()

def build(request):
"""
Expand Down Expand Up @@ -70,12 +66,6 @@ def get_arr(name):
if settings.DEPENDER_DEBUG:
compression = "none"

last_modified_header = request.META.get('HTTP_IF_MODIFIED_SINCE')
LOG.info("last mondified header: " + str(last_modified_header))
if (last_modified_header and extract_last_modified_time(last_modified_header) >= server_started
and not settings.DEPENDER_DEBUG and not reset == "true"):
return HttpResponseNotModified()

if client == "true" and require.count("Depender.Client") == 0:
require.append("Depender.Client")

Expand Down Expand Up @@ -107,34 +97,21 @@ def get_arr(name):

output += "//This lib: " + location + '?' + args
output += "\n\n"



for i in includes:
output += i.compressed_content[compression] + "\n\n"

if client == "true":
output += dpdr.get_client_js(includes, location)

response = HttpResponse(output, content_type="application/x-javascript")
response["Last-Modified"] = http_date(server_started)

if (download == "true"):
response['Content-Disposition'] = 'attachment; filename=built.js'
return response

build.login_notrequired = True

def extract_last_modified_time(header):
"""
Extracts time from the HTTP_IF_MODIFIED_SINCE header.
Based on django's django.static.views:was_modified_since
"""
LOG.info('header: ', header)
matches = re.match(r"^([^;]+)(; length=([0-9]+))?$", header, re.IGNORECASE)
header_mtime = mktime_tz(parsedate_tz(matches.group(1)))
header_len = matches.group(3)


def test(request):
#this seems silly
return HttpResponse(file(settings.DEPENDER_ROOT + '/mootools/depender/static/test.html').read())

0 comments on commit 1443c9a

Please sign in to comment.