# HG changeset patch # User Sylvain Thénault # Date 1328189610 -3600 # Node ID 2ee0ef069fa7f4eaec903296b744e23f6caf67d4 # Parent 1867e252e487ceb2ca336084fc31dcc6ed4a3eef [datafeed] when checking for deletion using cwentity xml parser, use vid=xml to limit resources consumption diff -r 1867e252e487 -r 2ee0ef069fa7 sobjects/cwxmlparser.py --- a/sobjects/cwxmlparser.py Tue Jan 31 21:43:24 2012 +0100 +++ b/sobjects/cwxmlparser.py Thu Feb 02 14:33:30 2012 +0100 @@ -238,6 +238,22 @@ attrs = extract_typed_attrs(entity.e_schema, sourceparams['item']) entity.cw_edited.update(attrs) + + def normalize_url(self, url): + """overriden to add vid=xml""" + url = super(CWEntityXMLParser, self).normalize_url(url) + if url.startswih('http'): + try: + url, qs = url.split('?', 1) + except ValueError: + params = {} + else: + params = parse_qs(qs) + if not 'vid' in params: + params['vid'] = ['xml'] + return url + '?' + self._cw.build_url_params(**params) + return url + def complete_url(self, url, etype=None, known_relations=None): """append to the url's query string information about relation that should be included in the resulting xml, according to source mapping. @@ -253,9 +269,8 @@ url, qs = url.split('?', 1) except ValueError: qs = '' + # XXX vid will be added by later call to normalize_url (in parent class) params = parse_qs(qs) - if not 'vid' in params: - params['vid'] = ['xml'] if etype is None: try: etype = url.rsplit('/', 1)[1]