- Timestamp:
- Feb 11, 2019, 6:55:55 PM (5 years ago)
- Branches:
- current, feature/docs, master
- Children:
- 02aee97
- Parents:
- 93bbb89
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ow/models/workout.py
r93bbb89 rd6f8304 423 423 return self.fit_file is not None 424 424 425 @property 426 def map_screenshot(self): 425 def map_screenshot(self, request): 427 426 """ 428 427 Return the static path to the screenshot image of the map for … … 432 431 return None 433 432 433 screenshot_name = os.path.join( 434 str(self.owner.uid), str(self.workout_id) + '.png') 434 435 current_path = os.path.abspath(os.path.dirname(__file__)) 435 436 screenshot_path = os.path.join( 436 current_path, '../static/maps', 437 str(self.owner.uid), str(self.workout_id)) + '.png' 437 current_path, '../static/maps', screenshot_name) 438 438 439 439 if not os.path.exists(screenshot_path): 440 440 # screenshot does not exist, generate it 441 save_map_screenshot(self) 442 443 # the value returned is relative to the static files served 444 # by the app, so we can use request.static_url() with it 445 static_path = os.path.join('static/maps', str(self.owner.uid), 446 str(self.workout_id)) 447 return 'ow:' + static_path + '.png' 441 save_map_screenshot(self, request) 442 443 static_path = os.path.join('static/maps', screenshot_name) 444 return request.static_url('ow:' + static_path)
Note: See TracChangeset
for help on using the changeset viewer.