Answering my own question in case anyone else runs into this:
The problem was caused by the last_modified field in the database being
empty for existing assets (the last_modified stuff was added later to the
model).
When the last_modified database field is 0, then Django doesn't send a
Last-Modified header based on the value from the database. Equally it
doesn't produce any error either.
The fix is simple - run some SQL to set all the last_modified fields to a
recent date. Voila, the header appears.
Hope this proves useful to someone in the future.
Cheers,
Malcolm
2010/2/2 Malcolm Box
> Hi,
>
> I'm seeing a strange problem with Last-modified headers on my
> Apache/mod_python install. The problem being that they don't get sent.
>
> Running my django app locally, and using 'curl -v' to see the headers, I
> see correctly generated 'Last-modified' headers.
>
> When I deploy the same code to a server running Apache with mod_python, and
> make the same request using curl, there's no sign of a Last-modified header
> coming down.
>
> I'm using the standard last_modified decorators on the view:
>
> from django.views.decorators.http import last_modified
>
> json_skin_scalable =
> last_modified(scalable_last_modified)(SkinScalableCollection(
> queryset=Skin.objects.all(),
> permitted_methods=('GET', 'PUT', 'POST', 'DELETE'),
> anonymous_methods = ('GET',),
> entry_class = SkinScalableEntry,
> responder = JSONResponder(),
> expose_fields = ['base_url','qboxtext', 'softkey', 'link',
> 'swing_options',
> 'swing_results', 'polls_list_off',
> 'polls_list_on',
> 'multi_item_off', 'multi_item_on'
> ],
> ))
>
> Is there anything special that needs to be done to get Apache to send these
> headers correctly?
>
> Cheers,
>
> Malcolm
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.