[Zope-CMF] Re: [CMF-checkins] link object / CMF 1.3b2

Yuppie schubbe@web.de
Mon, 01 Jul 2002 16:55:42 +0200


Hi!

Florent Guillaume wrote:
> Ok, I reread RFC1808 and you're right that I don't handle relative URLs
> correctly. I'll re-change that.

Some more thoughts about test cases. Perhaps they'll help you to 
re-change that.

1) I think the basic requirement is not to break a valid URL. Exception: 
relative URLs.

additional test case:

         d = Link( 'mail' )
         d.edit( 'mailto:user@foo.com' )
         self.assertEqual( d.getRemoteUrl(), 'mailto:user@foo.com' )

<mailto:pass@foo.com> and <http://mailto:pass@foo.com> are both valid 
URLs. But <mailto:pass@foo.com> should not be changed to 
<http://mailto:pass@foo.com> .
If you don't want to test the scheme name (and I wouldn't), you can't 
fix <user:pass@foo.com> to <http://user:pass@foo.com>.

2) Next priority is fixing invalid URLs. If the value could be a valid 
absolute URL, we don't care to break a valid relative URL.

test cases:

If you want to fix <www.foo.com>, <baz.com>, <baz2.com/index.html>, 
<hmmm.com/lol.txt> etc., you'll change also <index.html> to 
<http://index.html>, <folder/file.txt> to <http://folder/file.txt>. 
That's not nice, but you can't avoid it.

3) The rest should not be touched or it should be discarded.

I think these 3 test cases don't make any sense.

         d = Link( 'zoinx' )
         d.edit( '/huh/zoinx.html' )
         self.assertEqual( d.getRemoteUrl(), 'http:/huh/zoinx.html' )

         d = Link('foo', remote_url='/baz.org/zoinx/')
         self.assertEqual(d.getRemoteUrl(), 'http:/baz.org/zoinx/')

         d = Link('foo')
         d.edit('/baz.com/foo/')
         self.assertEqual(d.getRemoteUrl(), 'http:/baz.com/foo/')

Ciao,
	Yuppie