Author: bree Date: Mon Jan 30 14:26:50 2006 New Revision: 2252 Modified: azax/branches/snowsprint/azaxresponse.py Log: Etree parse options handling
Modified: azax/branches/snowsprint/azaxresponse.py ============================================================================== --- azax/branches/snowsprint/azaxresponse.py (original) +++ azax/branches/snowsprint/azaxresponse.py Mon Jan 30 14:26:50 2006 @@ -45,15 +45,21 @@ 'transitional.dtd">' % config.DTDS_DIR HTML_PREFIX = HTML_DTD + '<html><body>%s</body></html>' - + class AzaxResponse(object): """ azax command Response """ implements(IAzaxResponse) + custom_options = config.etree.getDefaultParseOptions() + 4 + + def _setEtreeParseOptions(self): + etree = config.etree + etree.setGlobalParseOptions(self.custom_options) + def __init__(self, response=None): etree = config.etree - etree.setGlobalParseOptions(etree.getDefaultParseOptions() + 4) + self._setEtreeParseOptions() self._html = etree.fromstring(HTML_PREFIX % '') self._body = self._html[0] self._html.set('xmlns:kukit', 'http://www.kukit.org/commands/1.0') @@ -77,7 +83,7 @@ def wrapInHtmlNamespace(self, new_value, data): etree = config.etree new_value = HTML_PREFIX % new_value - etree.setGlobalParseOptions(etree.getDefaultParseOptions() + 4) + self._setEtreeParseOptions() valuetree = etree.fromstring(new_value) body = valuetree[0] data.text = body.text -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins