[product_images] image folder name should escape / char

Bug #1198304 reported by Raphaël Valyi - http://www.akretion.com
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenERP Product Attributes
New
Undecided
Unassigned

Bug Description

Hello

when you install product_images with default settings, it depends on product_sequence which by default generates a PR/id sequence for a product with a given id.

If you set product_images with a file storage, this results in a strange file layout where images files are wrapped in a 'PR' folder because a folder like PR/0001 will actually generate two folders PR and 0001 inside. The image files are put in the 0001 folder then.
For the product with a sequence without "/" instead, there is not such folder nesting. This is a bit inconsistent.

We may not touch the sequence module, but may be escape the "/" char in the folder name to avoid such wrapping. A workaround is of course not using a sequence with a "/" but this requires a proper additional configuration.

What do you think?

Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

Hi Raph
I was thinking about changing the way to store the image on the file system and use as path "product_id/image_id".
With that solution the sequence on the product will be not required anymore and the problem with "/" or accent trouble.
An other solution can be to use the document object of OpenERP (product_image will inherit the ir_document). But we should configure the document module in a way that all of the image are in a special directory in order to give the possibility to publish the image with nginx without OpenERP.
What do you think?

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote : Re: [Bug 1198304] Re: [product_images] image folder name should escape / char

Hello Seb,

I believe the reason why Openlabs implemented product_images this way was
that in a Magentoerpconnectcontext, the product reference would become the
SKU so it means that you could create/update/share images on the Magento
side in some kind of shared folder (sftp, s3, rsync...) or any third party
system without having to know what the product ids are in OpenERP. I should
say I have that need of editing images in a third party system in my
current project, but in that case it's in Ruby with OOOR so I can easily
know the product ids in my case.

So while getting rid of product_sequence could be cool (sometimes you may
also want the sequence work differently like display on default_get instead
of save) seems cool, I'm not sure that forcing third party system to know
OpenERP ids is good.

Speaking about refactoring, something that would be cool would be to extra
some gallery mixing and have it available for other objects such as
partners, projects etc... Should be pretty easy. As for me I believe we can
extract that even in v7 we could adapt to the change here.

What do you think about the folders and about the mixin?

On Sat, Jul 6, 2013 at 7:05 AM, Sébastien BEAU - http://www.akretion.com <
<email address hidden>> wrote:

> Hi Raph
> I was thinking about changing the way to store the image on the file
> system and use as path "product_id/image_id".
> With that solution the sequence on the product will be not required
> anymore and the problem with "/" or accent trouble.
> An other solution can be to use the document object of OpenERP
> (product_image will inherit the ir_document). But we should configure the
> document module in a way that all of the image are in a special directory
> in order to give the possibility to publish the image with nginx without
> OpenERP.
> What do you think?
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1198304
>
> Title:
> [product_images] image folder name should escape / char
>
> Status in OpenERP Product Attributes:
> New
>
> Bug description:
> Hello
>
> when you install product_images with default settings, it depends on
> product_sequence which by default generates a PR/id sequence for a
> product with a given id.
>
> If you set product_images with a file storage, this results in a strange
> file layout where images files are wrapped in a 'PR' folder because a
> folder like PR/0001 will actually generate two folders PR and 0001 inside.
> The image files are put in the 0001 folder then.
> For the product with a sequence without "/" instead, there is not such
> folder nesting. This is a bit inconsistent.
>
> We may not touch the sequence module, but may be escape the "/" char
> in the folder name to avoid such wrapping. A workaround is of course
> not using a sequence with a "/" but this requires a proper additional
> configuration.
>
>
> What do you think?
>
> To manage notifications about this bug go to:
>
> https://bugs.launchpad.net/openerp-product-attributes/+bug/1198304/+subscriptions
>

Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

Hi Raph,
The storage of image on filesystem have been implemented by myself. At this time I choose to implement in this way in order to have "human readable url". But at the final, I am not sure that this is a very good idea.
Indeed it's force you to have a mandatory field for the sequence, it force you to have exclude some character into the sequence and the image name.

So I think there is two problem, storing the image and having "beautiful url". In my case (for prestashop and magento) I do not need "beautiful url" so the solution "product_id/image_id" seem to be a good idea. For the "beautiful url" I think that the best option will to add a table to manage url rewriting and read it directly with nginx (http://labs.frickle.com/nginx_ngx_postgres/)

For the mixing images galery, I think it's a real good idea (we need it for managing image on prestashop category)

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :

Hello Seb,

sorry for the paternity of the feature. OK, I think we don't need beautiful
URL's either for images. So we can proceed with ids. Now if we extract the
gallery in mixin, we could also have the name of the model as a parent
folder.

Also, we could investigate the possibility to have the image as a regular
OpenERP attachement and let OpenERP attachement thing handle both the DB
and the file persistence. The issue is that it's not clear to me yet how
OpenERP attachements map folder and file names, it doesn't seem great at
all, specially for edition by a third party tool, but I may be mistaken.

Thoughts?

On Sun, Jul 7, 2013 at 6:10 AM, Sébastien BEAU - http://www.akretion.com <
<email address hidden>> wrote:

> Hi Raph,
> The storage of image on filesystem have been implemented by myself. At
> this time I choose to implement in this way in order to have "human
> readable url". But at the final, I am not sure that this is a very good
> idea.
> Indeed it's force you to have a mandatory field for the sequence, it force
> you to have exclude some character into the sequence and the image name.
>
> So I think there is two problem, storing the image and having "beautiful
> url". In my case (for prestashop and magento) I do not need "beautiful
> url" so the solution "product_id/image_id" seem to be a good idea. For
> the "beautiful url" I think that the best option will to add a table to
> manage url rewriting and read it directly with nginx
> (http://labs.frickle.com/nginx_ngx_postgres/)
>
> For the mixing images galery, I think it's a real good idea (we need it
> for managing image on prestashop category)
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1198304
>
> Title:
> [product_images] image folder name should escape / char
>
> Status in OpenERP Product Attributes:
> New
>
> Bug description:
> Hello
>
> when you install product_images with default settings, it depends on
> product_sequence which by default generates a PR/id sequence for a
> product with a given id.
>
> If you set product_images with a file storage, this results in a strange
> file layout where images files are wrapped in a 'PR' folder because a
> folder like PR/0001 will actually generate two folders PR and 0001 inside.
> The image files are put in the 0001 folder then.
> For the product with a sequence without "/" instead, there is not such
> folder nesting. This is a bit inconsistent.
>
> We may not touch the sequence module, but may be escape the "/" char
> in the folder name to avoid such wrapping. A workaround is of course
> not using a sequence with a "/" but this requires a proper additional
> configuration.
>
>
> What do you think?
>
> To manage notifications about this bug go to:
>
> https://bugs.launchpad.net/openerp-product-attributes/+bug/1198304/+subscriptions
>

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.