summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2015-08-11 22:58:20 +0200
committerJan Pokorný <jpokorny@redhat.com>2015-08-11 23:30:08 +0200
commitf3968982da01150076dedd0e80e8dab7e35e6ae4 (patch)
tree8298847516f636585e5bd88c62b1b814657c97dd
parent6c57983b37728995c9c41b78a514b54a64b152fb (diff)
downloadclufter-f3968982da01150076dedd0e80e8dab7e35e6ae4.tar.gz
clufter-f3968982da01150076dedd0e80e8dab7e35e6ae4.tar.xz
clufter-f3968982da01150076dedd0e80e8dab7e35e6ae4.zip
filter: when filter validates along, avoid revalidation
... on output format instantiation (needless and unhelpful). Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rw-r--r--filter.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/filter.py b/filter.py
index a28b23f..987d371 100644
--- a/filter.py
+++ b/filter.py
@@ -151,7 +151,7 @@ class Filter(object):
if io_formats is None:
return None
self = super(Filter, cls).__new__(cls)
- self._in_format, self._out_format = io_formats
+ (self._in_format, self._out_format), self._validated = io_formats, False
return self
@hybridproperty
@@ -180,6 +180,8 @@ class Filter(object):
outdecl = self._fnc(flt_ctxt, in_obj)
outdecl_head, outdecl_tail = head_tail(outdecl)
outdecl_tail = arg2wrapped(outdecl_tail)
+ if self._validated:
+ fmt_kws['validator_specs'] = {'': ''}
return self.out_format(outdecl_head, *outdecl_tail, **fmt_kws)
@classmethod
@@ -507,6 +509,7 @@ class XMLFilter(Filter, MetaPlugin):
validator = self._out_format.validator('etree', spec=spec)
if validator:
validate_hook = self._xslt_get_validate_hook(validator, **kws)
+ self._validated = True # to avoid Format instance revalidation
return (lambda ret, error_log=():
self._xslt_atom_hook(ret, error_log, validate_hook, **kws))