google-code-export / django-photologue

Automatically exported from code.google.com/p/django-photologue
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

EXIF parsing lacks error handling #41

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create a JPEG with an EXIF DateTimeOriginal of '2007:06:14 18:03: 6'
2. try to add it to a photologue gallery

What is the expected output? What do you see instead?
Should either parse or ignore badly formed date-time string.
Crashes with
Traceback (most recent call last):
  File "test.py", line 76, in test
    Photo.objects.create(image='test.jpg', title='Test', slug='test')
  File "django/db/models/manager.py", line 75, in create
    return self.get_query_set().create(**kwargs)
  File "django/db/models/query.py", line 274, in create
    obj.save()
  File "photologue/models.py", line 399, in save
    d, t = str.split(exif_date.values)
ValueError: too many values to unpack

What version of the product are you using? On what operating system?
Revision 185 on Ubuntu 7.10 Gutsy.

Please provide any additional information below.
The JPEG originates from an HP ScanJet 4600 scanner. Probably their
scanning software has a bug. I think it would be best to use the current
date/time if parsing fails.

Original issue reported on code.google.com by akaih...@gmail.com on 29 Mar 2008 at 11:56

GoogleCodeExporter commented 9 years ago
Oh, and I'm using the 2.0 branch.

Original comment by akaih...@gmail.com on 29 Mar 2008 at 5:39

GoogleCodeExporter commented 9 years ago
Here's a patch which simply substitutes any invalid date/time values with the 
current
timestamp.

Original comment by akaih...@gmail.com on 29 Mar 2008 at 6:13

Attachments:

GoogleCodeExporter commented 9 years ago
Modified the patch slightly. Needs testing (r186).

Original comment by justin.d...@gmail.com on 31 Mar 2008 at 8:10