[Checkins] SVN: grok/trunk/src/grok/ Fix an application_url
bug: it didn't work with empty containers, which
Christian Theune
ct at gocept.com
Thu May 3 14:46:48 EDT 2007
*blink*
That's weird. I explicitly fixed that.
... *search* ...
... and did not check it in. Mea culpa. :/
Am Donnerstag, den 03.05.2007, 14:40 -0400 schrieb Martijn Faassen:
> Log message for revision 75067:
> Fix an application_url bug: it didn't work with empty containers, which
> evaluate to False. Instead of explicitly comparing to None, application_url
> was checking whether the object evaluated to True, which only works for
> containers which actually have some content.
>
>
> Changed:
> U grok/trunk/src/grok/components.py
> U grok/trunk/src/grok/ftests/url/application.py
>
> -=-
> Modified: grok/trunk/src/grok/components.py
> ===================================================================
> --- grok/trunk/src/grok/components.py 2007-05-03 18:35:20 UTC (rev 75066)
> +++ grok/trunk/src/grok/components.py 2007-05-03 18:40:17 UTC (rev 75067)
> @@ -204,7 +204,7 @@
>
> def application_url(self, name=None):
> obj = self.context
> - while obj:
> + while obj is not None:
> if isinstance(obj, Application):
> return self.url(obj, name)
> obj = obj.__parent__
>
> Modified: grok/trunk/src/grok/ftests/url/application.py
> ===================================================================
> --- grok/trunk/src/grok/ftests/url/application.py 2007-05-03 18:35:20 UTC (rev 75066)
> +++ grok/trunk/src/grok/ftests/url/application.py 2007-05-03 18:40:17 UTC (rev 75067)
> @@ -31,6 +31,14 @@
> >>> browser.open('http://localhost/cave/caveman/second')
> >>> browser.contents
> 'http://localhost/cave/second'
> +
> +application_url also works with empty containers::
> +
> + >>> from grok.ftests.url.application import Corridors
> + >>> cave['corridors'] = Corridors()
> + >>> browser.open('http://localhost/cave/corridors')
> + >>> browser.contents
> + 'http://localhost/cave'
>
> """
> import zope.interface
> @@ -56,3 +64,6 @@
>
> class CaveMan(grok.Model):
> pass
> +
> +class Corridors(grok.Container):
> + pass
>
> _______________________________________________
> Checkins mailing list
> Checkins at zope.org
> http://mail.zope.org/mailman/listinfo/checkins
--
gocept gmbh & co. kg - forsterstraße 29 - 06112 halle/saale - germany
www.gocept.com - ct at gocept.com - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.zope.org/pipermail/checkins/attachments/20070503/6a0e717e/attachment.bin
More information about the Checkins
mailing list