Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 686 - Use timestamp instead of string of timestamp to represent image modified date #689

Merged
merged 3 commits into from
Dec 13, 2016

Conversation

rodfersou
Copy link
Member

@rodfersou rodfersou commented Dec 1, 2016

closes #686

@hvelarde
Copy link
Member

hvelarde commented Dec 1, 2016

did you contacted the framework team about this issue?

@rodfersou rodfersou changed the title Issue 686 - Fix exception when scale image Issue 686 - Use DateTime object instead of string of timestamp to represent image modified date Dec 2, 2016
@@ -158,10 +159,12 @@ def modified(self):
name='images',
default=None)
return base_scales and base_scales.modified()
mtime = ''
mtime = DateTime(0)
Copy link
Member

@hvelarde hvelarde Dec 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should start as None; check the related code in plone.scale.

self.scaling = ImageScaling(self.tile, self.request)

def test_modified(self):
self.assertIsInstance(self.scaling.modified(), DateTime)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test is useless; we need to deal with scales

@rodfersou rodfersou force-pushed the issue_686 branch 2 times, most recently from 8ae21ca to 829254a Compare December 2, 2016 16:08
@rodfersou rodfersou changed the title Issue 686 - Use DateTime object instead of string of timestamp to represent image modified date Issue 686 - Use timestamp instead of string of timestamp to represent image modified date Dec 5, 2016
@rodfersou rodfersou force-pushed the issue_686 branch 2 times, most recently from 9a1f8e0 to 4b278f7 Compare December 5, 2016 16:59
for k, v in self.context.data.items():
if INamedImage.providedBy(v):
mtime += self.context.data.get('{0}_mtime'.format(k), '')
image_time = self.context.data.get('{0}_mtime'.format(k), None)
if mtime is None or image_time > mtime:
Copy link
Member

@hvelarde hvelarde Dec 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rodfersou can you explain this, please? are there any tiles with more than one image field?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code at tiles/data.py is made to search any image field and set the modified date into a data attribute.
I think this is done this way because there is no way to know if someone creates a tile with more than one image.

On the other hand, the timestamp setted at the same code will be the same for all image items.. so we could cut the complexity and create just one attribute for every image, removing the need to make a loop and check if the item is INamedImage.

I don't know if a refactory at this code is beyond the borders of this pull request, or if this is a good time to do it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK, there are no tiles with more than one image field, so let's not solve problems we don't have; anyway all that code is overly complex and has to be completely refactored at some point.

@hvelarde hvelarde force-pushed the issue_686 branch 2 times, most recently from 84a6411 to 7ceede2 Compare December 12, 2016 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Render error when change image size
2 participants