[CMF-checkins] CVS: CMF/CMFDefault - Link.py:1.17
Florent Guillaume
fg@nuxeo.com
Sat, 29 Jun 2002 15:35:07 -0400
Update of /cvs-repository/CMF/CMFDefault
In directory cvs.zope.org:/tmp/cvs-serv7039/CMFDefault
Modified Files:
Link.py
Log Message:
Made the Link objects deal correctly with empty remote urls
(Tracker #507) and not strip trailing slashes (Tracker #451).
I corrected the behavior and testcase that said that 'baz.com' was
canonicalized into 'http://baz.com', which was dubious, as I'd rather
have 'baz.html' canonicalized into 'http:baz.html'.
This is a change of behavior that may be unwanted however.
=== CMF/CMFDefault/Link.py 1.16 => 1.17 ===
self.id=id
self.title=title
- self.remote_url=remote_url
self.description=description
+ self._edit(remote_url)
self.format=self.URL_FORMAT
security.declareProtected( CMFCorePermissions.ModifyPortalContent
@@ -148,12 +148,10 @@
Edit the Link
"""
tokens = urlparse.urlparse( remote_url, 'http' )
- if tokens[0] and tokens[1]:
- self.remote_url = urlparse.urlunparse( tokens )
- else:
- self.remote_url = 'http://' + remote_url
- if self.remote_url[-1] == '/':
- self.remote_url = self.remote_url[:-1]
+ url = urlparse.urlunparse( tokens )
+ if url == 'http:':
+ url = ''
+ self.remote_url = url
security.declareProtected( CMFCorePermissions.ModifyPortalContent, 'edit' )
edit = WorkflowAction( _edit )