[Erp5-report] r25868 - /erp5/trunk/products/ERP5Wizard/Tool/WizardTool.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Mar 4 16:01:40 CET 2009


Author: ivan
Date: Wed Mar  4 16:01:34 2009
New Revision: 25868

URL: http://svn.erp5.org?rev=25868&view=rev
Log:
Even though we detect a Redirect code not always we can rely that server will send a correct location header. 
Be more robust and add a basic check. 

Modified:
    erp5/trunk/products/ERP5Wizard/Tool/WizardTool.py

Modified: erp5/trunk/products/ERP5Wizard/Tool/WizardTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Wizard/Tool/WizardTool.py?rev=25868&r1=25867&r2=25868&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Wizard/Tool/WizardTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Wizard/Tool/WizardTool.py [utf8] Wed Mar  4 16:01:34 2009
@@ -354,14 +354,15 @@
       if f.code> 300 and f.code <400:
         # adjust return url which my contain proxy URLs as arguments
         location = metadata.getheader('location')
-        parsed_url = list(urlparse(location))
-        local_site_url_prefix = urllib.quote('%s/portal_wizard/proxy' \
-                                              %self.getPortalObject().absolute_url())
-        remote_url_parsed = urlparse(self.getServerUrl())
-        remote_site_url_prefix = '%s://%s/kb' %(remote_url_parsed[0], remote_url_parsed[1])
-        # fix arguments for returned location URL
-        parsed_url[4] = parsed_url[4].replace(local_site_url_prefix, remote_site_url_prefix)
-        response['location'] = urlunparse(parsed_url)
+        if location is not None:
+          parsed_url = list(urlparse(location))
+          local_site_url_prefix = urllib.quote('%s/portal_wizard/proxy' \
+                                                %self.getPortalObject().absolute_url())
+          remote_url_parsed = urlparse(self.getServerUrl())
+          remote_site_url_prefix = '%s://%s/kb' %(remote_url_parsed[0], remote_url_parsed[1])
+          # fix arguments for returned location URL
+          parsed_url[4] = parsed_url[4].replace(local_site_url_prefix, remote_site_url_prefix)
+          response['location'] = urlunparse(parsed_url)
 
       response.setStatus(f.code, f.msg)
       response.setHeader('content-type', metadata.getheader('content-type'))




More information about the Erp5-report mailing list