Ghosts without date in HTTP header

Reported by Flynt on 2006-11-29
8
Affects Status Importance Assigned to Milestone
Silva
Medium
Sylvain Viollon

Bug Description

Bengt is reporting:

Ghosts seem to lack a Last-Modified date in the HTTP header. Therefore they are
not cacheable. They should return the date of the target object.
Example: http://www.lue.ethz.ch/
The main page is a ghost to http://www.lue.ethz.ch/news/index which has a date,
but not the main page.

Kit Blake (kitblake) wrote :

Ok. Ghosts should provide the last modified of the haunted object. Once a ghost
is made it usually never changes (even though it's versioned content).

Eric Casteleijn (thisfred) wrote :

I don't think plain Silva even sets the Last-Modified header in the response. I
think you might be doing that in your own public layout code, in which case
you'd need to call the metadata on the published version of the haunted content,
instead of the Ghost itself...

Eric Casteleijn (thisfred) wrote :

Nope sorry, that is not entirely correct. I think that *Zope* actually sets this
header. Silva doesn't override it anywhere, and so Ghosts show the modification
date of the ghost object, not the haunted content...

Flynt (flyntle) wrote :

So, is it possible to follow Kit's proposition to show as 'Last-Modified' the
respective date of the haunted object for the next release of Silva-1.5?

Eric Casteleijn (thisfred) wrote :

Since the headers are set from Zope, and Silva doesn't really have a way to
intervene currently, that will be rather hard, and I don't think we can
realistically expect to do this for 1.5.9 which I hope to release today or
tomorrow. This is really more than a bugfix issue, and if we find a way to solve
this, it probably shouldn't go into a bugfix release version anyway.

Flynt (flyntle) wrote :

Okay. I see the point. I agree, if it needs larger changes, it is not suitable
for a bugfix release.

Kit Blake (kitblake) wrote :

I'm removing the Silva 1.5 label, leaving 1.6. We still don't know if we can fix
it.

Daniel Nouri (daniel.nouri) wrote :

From r23559:

Ghosts now override `get_modification_datetime` to get their
modification date from the haunted object, allowing the
`Last-Modified` header to be set in a convenient way.

If you're setting the headers via model/get_modification_datetime, this should
be your fix. Previously, this would have returned None.

Can you test this and confirm that we can close the issue? Thanks!

Benno Luthiger (benno-luthiger) wrote :

I encountered a new problem concerning ghosts and their target objects:
I had a Silva Document with last modified (according to the SMI) Oct. 26, 2006.
I then created a ghost for this target document. This ghost, then, shows as last
modified date March 1, 2007. That's what we expect.
Unfortunately, the last modified date of the target object changed through this
action and shows March 1, 2007 too :-(
That's not what we expect concerning the use of get_modification_datetime with
cache control.

Eric Casteleijn (thisfred) wrote :

This is a beauty, took me a good while to track down:

We have access handlers for the metadata of ghosts, which means that if the
metadata binding for a ghost is called, it passes through that accesshandler,
which returns the metadata of the target instead.

That is obviously a huge problem when we get the binding when we want to *WRITE
TO IT*.

What I don't get, is why this behavior is new: both the handlers, and the way
the code calls them are ancient. Benno, can you confirm this is not the case in
1.5? The way to trigger the behavior is to click the 'save reference' button on
the ghost, and see whether the target document's modification date is changed
after that.

To assist my own memory:

The offending call comes from Security.py lines 260-267:

            try:
                binding = self.service_metadata.getMetadata(version)
            except BindingError:
                return
            if binding is None:
                return
            now = DateTime()
            binding.setValues('silva-extra', {'modificationtime': now})

Eric Casteleijn (thisfred) wrote :

Oh, and I haven't thought of a solution yet, unfortunately, but I'm sure I will.

Eric Casteleijn (thisfred) wrote :

Note to self: GhostFolders have the same problem.

I can confirm that this unexpected behavior exists in Silva 1.5.8 too.
I don't think that this behavior is new, but existed for quit a long time
undiscovered.

Eric Casteleijn (thisfred) wrote :

Ok, I will look at this with Martijn on thursday, and hopefully a fix will find
its way into 1.6 and if it's at all possible into the 1.5 branch.

Eric Casteleijn (thisfred) wrote :

Whew, it's fixed, both on trunk and the 1.5 branch. The main changes are in
SilvaMetadata, so you'll need the trunk of that to test.

The behaviour now is as expected if I use model.get_modification_datetime(): I get the modification time of the hunted object.
However, if I use model.get_public_version_publication_datetime(), the public modification time of the ghost object is returned instead.
Bug or feature?

Changed in silva:
assignee: thisfred → aaltepet
Andy Altepeter (aaltepet) wrote :

Work on ghosts needs to be considered when implementing the full-blown SMI-enabled Silva Object caching (via a custom AcceleratedHTTPCacheManager). Ghosts need to defer to the haunted objects for their caching policy.

I'm marking this as a duplicate of t

Changed in silva:
status: In Progress → Triaged
Sylvain Viollon (thefunny) wrote :

It should now be fixed in 3.0 since ghosts return the modification date of the ghosted content. A unit test would be welcome for it.

Changed in silva:
assignee: Andy Altepeter (aaltepet) → Sylvain Viollon (thefunny)
milestone: none → 3.0.2
status: Triaged → In Progress
Sylvain Viollon (thefunny) wrote :

You can choose to have Last-Modified headers on Ghost, and other contents too.

Changed in silva:
status: In Progress → Fix Committed
Changed in silva:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers