[Zope] index_html always seems to exist

Peter Bengtsson mail@peterbe.com
Tue, 27 May 2003 00:45:04 +0100


At 02:09 2003-05-24 +0200, martin f krafft wrote:
>i have a python script doing the following:
>
>   file = 'index_html'
>   if not hasattr(context.aq_explicit, file):
>     context.invokeFactory('Member Profile', id=file, title=file)

file = 'index_html'
base = getattr(context, 'aq_base', context)
if not hasattr(base, file):
     ...

Dieter Maurer taught me that one.

>in English:
>   if the current folder does not have an object by the name of
>   'index_html', then generate a new 'Member Profile'.
>
>This works beautifully whenever file is set to something that's not
>'index_html'; the file gets added if and only if there isn't one
>yet.
>
>However, in the case of index_html, it always seems to exist, even
>if there is no index_html in the current folder (and yes, I have
>verified that context is the right folder).
>
>What am I doing wrong?
>
>Thanks!
>
>--
>martin;              (greetings from the heart of the sun.)
>   \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
>
>keyserver problems? http://keyserver.kjsl.com/~jharris/keyserver.html
>get my key here: http://madduck.net/me/gpg/publickey
>
>the reason that every major university
>maintains a department of mathematicsis
>is that it's cheaper than
>institutionalizing all those people.