Skip to content

Commit

Permalink
Update debug statements and add notes. (see #694)
Browse files Browse the repository at this point in the history
  • Loading branch information
jnga committed Aug 19, 2018
1 parent 3ceacb7 commit 8026297
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions gobotany/plantshare/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,15 +423,17 @@ def _extract_gps_data(self, img):
direction = gps_info[EXIF_GPSLATITUDEREF]
if direction.upper() == 'S':
latitude = latitude * -1
### testing
print '_extract_gps_data: about to try to get gps info'
### debugging
print '_extract_gps_data: latitude:', latitude
print '_extract_gps_data: about to try to set lat./long.s'
print 'self:', self
print 'selt.target_object:', self.target_object
###
try:
self.target_object.latitude = latitude
except AttributeError:
print 'target_object NoneType, no latitude attribute'
print 'cannot set latitude on target_object:', \
type(self.target_object)
finally:
# Get longitude.
degrees, minutes, seconds = self._get_dms(
Expand All @@ -441,10 +443,12 @@ def _extract_gps_data(self, img):
direction = gps_info[EXIF_GPSLONGITUDEREF]
if direction.upper() == 'W':
longitude = longitude * -1
print '_extract_gps_data: longitude:', longitude
try:
self.target_object.longitude = longitude
except AttributeError:
print 'target_object NoneType, no longitude attribute'
print 'cannot set longitude on target_object:', \
type(self.target_object)


class PlantshareGpsImage(ImageSpec):
Expand All @@ -458,16 +462,24 @@ class PlantshareGpsImage(ImageSpec):
def processors(self):
""" Dynamically create the list of image processors using the model
instance. """
print 'processors() about to call get_field_info: self.source:', self.source
print 'type(self.source):', type(self.source)
# August 2018: found that this code no longer seems to be
# able to produce a model instance as it must have in the past.
# When this happens, the ExifGpsExtractor image processor below
# cannot save any extracted latitude or longitude coordinates.
# TODO: debug and resolve, or else extract and save coordinates
# another way (such as client side).
print 'processors(): self.source:', self.source
print 'processors(): type(self.source):', type(self.source)
instance, field_name = get_field_info(self.source)
print 'processors() instance:', instance
print 'processors() field_name:', field_name

return [
ExifGpsExtractor(instance),
ResizeToFit(1000, 1000, False),
]


register.generator('plantshare:screenedimage:plantsharegpsimage',
PlantshareGpsImage)

Expand Down

0 comments on commit 8026297

Please sign in to comment.