Permalink
Browse files
fixes for an issue discovered by @ibnesayeed this morning
- Loading branch information...
Showing
with
17 additions
and 12 deletions.
- +1 −1 docs/source/conf.py
- +12 −10 mementoembed/__init__.py
- +1 −1 mementoembed/version.py
- +3 −0 sample_appconfig.cfg
@@ -223,17 +223,19 @@ def create_app(): | ||
application_logger.info("Default image path set to {}".format(app.config['DEFAULT_IMAGE_PATH'])) | ||
application_logger.info("Use data URIs for default image: {}".format(app.config['USE_DATA_URI_FOR_DEFAULT_IMAGE'])) | ||
if app.config['USE_DATA_URI_FOR_DEFAULT_IMAGE'].lower() == "yes": | ||
if 'USE_DATA_URI_FOR_DEFAULT_IMAGE' in app.config: | ||
This comment has been minimized.Show comment
Hide comment
ibnesayeed
Member
|
||
application_logger.info("Opening default image for conversion to data URI") | ||
with open(app.config['DEFAULT_IMAGE_PATH'], 'rb') as f: | ||
imgdata = f.read() | ||
application_logger.info("Default image has been opened and stored") | ||
application_logger.info("Converting image data to a base64 data URI") | ||
app.config['DEFAULT_IMAGE_PATH'] = "data:png;base64,{}".format( base64.b64encode(imgdata).decode('utf-8') ) | ||
application_logger.info("Done with image conversion") | ||
application_logger.debug("Default image path now set to {}".format(app.config['DEFAULT_IMAGE_PATH'])) | ||
if app.config['USE_DATA_URI_FOR_DEFAULT_IMAGE'].lower() == "yes": | ||
application_logger.info("Opening default image for conversion to data URI") | ||
with open(app.config['DEFAULT_IMAGE_PATH'], 'rb') as f: | ||
imgdata = f.read() | ||
application_logger.info("Default image has been opened and stored") | ||
application_logger.info("Converting image data to a base64 data URI") | ||
app.config['DEFAULT_IMAGE_PATH'] = "data:png;base64,{}".format( base64.b64encode(imgdata).decode('utf-8') ) | ||
application_logger.info("Done with image conversion") | ||
application_logger.debug("Default image path now set to {}".format(app.config['DEFAULT_IMAGE_PATH'])) | ||
application_logger.info("All Configuration successfully loaded for MementoEmbed") | ||
@@ -1,3 +1,3 @@ | ||
__appname__ = "MementoEmbed" | ||
__appversion__ = '0.2018.10.11.222821' | ||
__appversion__ = '0.2018.10.12.164424' | ||
__useragent__ = "{}/{}".format(__appname__, __appversion__) |
@shawnmjones you could have avoided this additional nesting of if blocks by simply changing:
to