[Zope] Checking zope userfolder root

Oliver Bleutgen myzope@gmx.net
Wed, 18 Sep 2002 14:20:05 +0200


chrisf wrote:
> Tried this pythion script from within a ZCLASS product
> 
> pub = ['changed']
> for item in context.ZopeFind(context.Bio,obj_metatypes=['Course_Topic'],
> search_sub=1):
>       if getattr(item[1],'index_html'):pub.append(item[1].absolute_url())
> return pub
> 
> The getattr line triggers a User Authorization window (user, password).
> I just want the statement to fail, indicating that current user is not allowed
> access to that folder.
> Is that so '****' hard. I have tried skip_unauthorized in every possible syntax. It
> doesn't work.
> Maybe because it is being called from within a ZClass product.
> Who knows.
> I just want users to log in and be redirected to their 'Base'catalogue


I'm confused, this is something else like the REQUEST.PARENTS thingy, 
isn't it?

Anyway, as Chris stated, you just have to catch the unauthorized exception:

try:
   if getattr(item[1],'index_html'):pub.append(item[1].absolute_url())
except:
   pass (or do something)


You can further qualify which exception you want to capture, I don't 
know offhand if
...
except Unauthorized:
   pass


works.


HTH,
oliver