[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bricolage-devel
Subject:    Re: More fun with find_or_create_alternate()
From:       Zdravko Balorda <zdravko.balorda () siix ! com>
Date:       2011-07-18 6:04:21
Message-ID: 4E23CCE5.8040705 () siix ! com
[Download RAW message or body]

Hi!

I've also got into trouble with OCs on thumbnail. If the calling
story has more OCs assigned to it, the generated thumbnail is created
without any. IMHO, the thumbnail should inherit current story OC.
However, I would like to suggest searching for thumbnails through
filename only, not the whole URI.

Regards, Zdravko


Bret Dawson wrote:
> Hi everybody,
> 
> I've just been fiddling with the fun parts of the
> find_or_create_alternate() method to fix a bug. I've found a fix, but
> thought I should add this to the list anyhow.
> 
> Here's the bug:
> 
> When the source image and target thumbnail image are in different OCs
> with different URI formats, calling find_or_create_alternate() will
> throw a URI-not-unique error.
> 
> This is because the URI generated for the initial find uses the source
> image OC URI format, not the destination URI format.
> 
> 
> Here's an example:
> 
> The original image is of type "Infrastructure image." That type is in
> the "Includes" OC, with fixed URI. Here are the URI formats:
> 
> /%{categories}/includes/%{slug}/
> /%{categories}/includes/%Y/%m/%d/%{slug}/
> 
> So the starting URI of my image is this:
> 
> /international/includes/a19new.gif
> 
> 
> The element type for my thumbnail is "Auto-generated image." Which is in
> the Web OC, with non-fixed URI, like this:
> 
> /%{categories}/%Y/%m/%d/%{slug}/
> 
> I'm expecting the thumbnail to have a URI like this:
> 
> /international/2011/07/14/a19new_90.gif
> 
> ...but the lookup inside the find_or_create_alternate comes up with this
> target URI instead:
> 
> /international/includes/2011/07/14/a19new_90.gif
> 
> No image with this URI exists, so it goes on to create one. This one has
> the correct URI, and because the template has run once in the past, it
> collides with a previously-created version of the same image.
> 
> I've opened bug #274 and a pull request for my patch.
> 
> C
> 
> 
> 
> 
> 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic