Mercurial > libervia-web
diff src/server/server.py @ 1038:6b906b1f419a
pages: fixed XMPP URIs handling
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 24 Jan 2018 09:57:57 +0100 |
parents | dc6c8c4d8ff6 |
children | 3d97c93561ff |
line wrap: on
line diff
--- a/src/server/server.py Wed Jan 24 09:57:38 2018 +0100 +++ b/src/server/server.py Wed Jan 24 09:57:57 2018 +0100 @@ -190,18 +190,10 @@ # we handle the known URL schemes if new_url.scheme == 'xmpp': - # XMPP URI - parsed_qs = urlparse.parse_qs(new_url.geturl()) - try: - item = parsed_qs['item'][0] - if not item: - raise KeyError - except (IndexError, KeyError): - raise NotImplementedError(u"only item for PubSub URI is handled for the moment for url_redirections_dict") - location = "/blog/{profile}/{item}".format( - profile=quote(options['url_redirections_profile']), - item = urllib.quote_plus(item), - ).decode('utf-8') + location = LiberviaPage.getPagePathFromURI(new) + if location is None: + log.warning(_(u"ignoring redirection, no page found to handle this URI: {uri}").format(uri=new)) + continue request_data = self._getRequestData(location) if old: self.inv_redirections[location] = old