Rework again to see if I can get this corrected.
This commit is contained in:
parent
f64ff43450
commit
ab2239009a
2 changed files with 14 additions and 12 deletions
|
@ -25,6 +25,13 @@ def handler404(request):
|
||||||
def handler500(request):
|
def handler500(request):
|
||||||
return handler(request, '500')
|
return handler(request, '500')
|
||||||
|
|
||||||
|
def fundgoal_lookup(fundraiser_sought):
|
||||||
|
try:
|
||||||
|
return FundraisingGoal.objects.get(fundraiser_code_name=fundraiser_sought)
|
||||||
|
except FundraisingGoal.DoesNotExist:
|
||||||
|
# we have no object! do something
|
||||||
|
return None
|
||||||
|
|
||||||
def index(request, *args, **kwargs):
|
def index(request, *args, **kwargs):
|
||||||
# return HttpResponse("Hello, static world: " + request.get_full_path())
|
# return HttpResponse("Hello, static world: " + request.get_full_path())
|
||||||
path = request.get_full_path()
|
path = request.get_full_path()
|
||||||
|
@ -37,19 +44,14 @@ def index(request, *args, **kwargs):
|
||||||
# return HttpResponse("Sorry that's a 404: " + path)
|
# return HttpResponse("Sorry that's a 404: " + path)
|
||||||
return handler404(request)
|
return handler404(request)
|
||||||
template = loader.get_template(path)
|
template = loader.get_template(path)
|
||||||
|
|
||||||
|
if kwargs.has_key('fundraiser_sought'):
|
||||||
|
kwargs = kwargs.copy()
|
||||||
|
kwargs['fundgoal'] = fundgoal_lookup(kwargs['fundraiser_sought'])
|
||||||
|
|
||||||
context = RequestContext(request, kwargs)
|
context = RequestContext(request, kwargs)
|
||||||
return HttpResponse(template.render(context))
|
return HttpResponse(template.render(context))
|
||||||
|
|
||||||
def fundgoal_lookup(fundraiser_sought):
|
|
||||||
try:
|
|
||||||
return FundraisingGoal.objects.get(fundraiser_code_name=fundraiser_sought)
|
|
||||||
except FundraisingGoal.DoesNotExist:
|
|
||||||
# we have no object! do something
|
|
||||||
return None
|
|
||||||
|
|
||||||
def index_with_fundraiser_data(request, *args, **kwargs):
|
|
||||||
return index(request, { 'fundgoal' : fundgoal_lookup(kwargs['fundraiser_sought']) })
|
|
||||||
|
|
||||||
def debug(request):
|
def debug(request):
|
||||||
path = request.get_full_path()
|
path = request.get_full_path()
|
||||||
path = path.lstrip('/')
|
path = path.lstrip('/')
|
||||||
|
|
|
@ -53,10 +53,10 @@ urlpatterns = patterns('',
|
||||||
(r'^error', 'conservancy.static.views.index'),
|
(r'^error', 'conservancy.static.views.index'),
|
||||||
(r'^about', 'conservancy.static.views.index'),
|
(r'^about', 'conservancy.static.views.index'),
|
||||||
(r'^donate', 'conservancy.static.views.index'),
|
(r'^donate', 'conservancy.static.views.index'),
|
||||||
(r'^linux-compliance', 'conservancy.static.views.index_with_fundraiser_data',
|
(r'^linux-compliance', 'conservancy.static.views.index',
|
||||||
{'fundraiser_sought' : 'vmware-match-0'}),
|
{'fundraiser_sought' : 'vmware-match-0'}),
|
||||||
(r'^members', 'conservancy.static.views.index'),
|
(r'^members', 'conservancy.static.views.index'),
|
||||||
(r'^npoacct', 'conservancy.static.views.index_with_fundraiser_data',
|
(r'^npoacct', 'conservancy.static.views.index',
|
||||||
{'fundraiser_sought' : 'npoacct'}),
|
{'fundraiser_sought' : 'npoacct'}),
|
||||||
(r'^overview', 'conservancy.static.views.index'),
|
(r'^overview', 'conservancy.static.views.index'),
|
||||||
(r'^privacy-policy', 'conservancy.static.views.index'),
|
(r'^privacy-policy', 'conservancy.static.views.index'),
|
||||||
|
|
Loading…
Reference in a new issue