Mercurial > p > roundup > code
diff frontends/ZRoundup/ZRoundup.py @ 5402:88dbacd11cd1
Python 3 preparation: update urllib / urllib2 / urlparse imports.
The existing roundup/anypy/urllib_.py is extended to cover more
imports and used in more places. Manual patch.
| author | Joseph Myers <jsm@polyomino.org.uk> |
|---|---|
| date | Tue, 24 Jul 2018 23:48:30 +0000 |
| parents | dccae35caa59 |
| children | fed0f839c260 |
line wrap: on
line diff
--- a/frontends/ZRoundup/ZRoundup.py Tue Jul 24 23:47:10 2018 +0000 +++ b/frontends/ZRoundup/ZRoundup.py Tue Jul 24 23:48:30 2018 +0000 @@ -26,7 +26,7 @@ advantages over regular CGI :) ''' -import urlparse +from roundup.anypy import urllib_ from Globals import InitializeClass, HTMLFile from OFS.SimpleItem import Item @@ -141,7 +141,7 @@ env = self.REQUEST.environ # figure out the path components to set - url = urlparse.urlparse( self.absolute_url() ) + url = urllib_.urlparse( self.absolute_url() ) path = url[2] path_components = path.split( '/' ) @@ -168,10 +168,10 @@ # PATH_INFO, as defined by the CGI spec, has the *real* request path orig_path = self.REQUEST.environ['PATH_INFO'] if orig_path[-1] != '/' : - url = urlparse.urlparse( self.absolute_url() ) + url = urllib_.urlparse( self.absolute_url() ) url = list( url ) # make mutable url[2] = url[2]+'/' # patch - url = urlparse.urlunparse( url ) # reassemble + url = urllib_.urlunparse( url ) # reassemble RESPONSE = self.REQUEST.RESPONSE RESPONSE.setStatus( "MovedPermanently" ) # 301 RESPONSE.setHeader( "Location" , url )
