Commit 3520e49d authored by Sanjay Yadav's avatar Sanjay Yadav

ENH: Integrated pptgen with formhandler.

parent dfb8c80e
Pipeline #30967 failed with stage
in 11 seconds
......@@ -6,6 +6,7 @@ import sys
import copy
import json
import collections
import gramex.data
import pandas as pd
import gramex.cache
from . import commands
......@@ -74,15 +75,8 @@ def load_data(data_config, handler=None):
for key, conf in data_config.items():
if 'function' in conf:
data[key] = build_transform(conf, vars={'handler': None})(handler=handler)[0]
elif conf.get('format') == 'database':
query = conf.pop('query')
sqlengine = conf.pop('engine')
state = conf.pop('state') if 'state' in conf else None
data[key] = gramex.cache.query(query, sqlengine, state=state)
else:
path = conf.pop('path')
fmt = conf.pop('format')
data[key] = gramex.cache.open(path, fmt, **conf)
data[key] = gramex.data.filter(conf.pop('url'), **dict(conf))
return data
......@@ -112,7 +106,11 @@ def pptgen(source, target, **config):
# removed from yaml config.
handler = config.pop('handler') if 'handler' in config else None
_config = copy.deepcopy(config)
data = AttrDict(load_data(_config.pop('data', {}), handler=handler))
if _config.get('is_formhandler', False):
data = _config.pop('data')
_config.pop('is_formhandler')
else:
data = AttrDict(load_data(_config.pop('data', {}), handler=handler))
prs = Presentation(source)
slides = prs.slides
# Loop through each change configuration
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment