def eval_text(self, templ, request, **kwargs): stub = kwargs['stub'] kwargs['recorded'] = stub.recorded() recorded = kwargs.get('recorded') if recorded: kwargs['recorded'] = as_date(recorded) return run_template(templ, request=request, request_text=request.request_body(), # legacy # utility functions roll_date=roll_date, today=today_str, as_date=as_date, parse_xml=parse_xml, **kwargs)
def eval_text(self, templ, request, **kwargs): request_text = request.request_body() stub = kwargs['stub'] kwargs['recorded'] = stub.recorded() recorded = kwargs.get('recorded') if recorded: kwargs['recorded'] = as_date(recorded) return run_template( templ, request_text=request_text, # utility functions roll_date=roll_date, today=today_str, as_date=as_date, parse_xml=parse_xml, **kwargs)
def run(self): if not self.cmd_file_url: raise exception_response(500, title='run requires a cmd_file_url input to the ctor.') cmds, _, _ = UrlFetch().get(self.location(self.cmd_file_url)[0]) cmds_expanded = run_template(cmds, # utility functions roll_date=roll_date, today=today_str, as_date=as_date, parse_xml=parse_xml, **self.location.request.arguments) try: payload = self.parse(cmds_expanded) except Exception, e: raise exception_response(400, title="Unable to parse '{0}', error={1}".format(self.cmd_file_url, e))
def make_stylesheet(self, **kwargs): """ Dynamically generate XSLT stylesheet using elements or attrs """ return run_template(self.xslt_template, basename=os.path.basename, **kwargs)