what is manage_workspace supposed to do?
I've a problem with a product I'm writing and the way manage_workspace works. There's this code in App/Management.py: def manage_workspace(self, REQUEST): """Dispatch to first interface in manage_options """ options=self.filtered_manage_options(REQUEST) try: m=options[0]['action'] if m=='manage_workspace': raise TypeError except: raise Unauthorized, ( 'You are not authorized to view this object.') (*) if m.find('/'): raise 'Redirect', ( "%s/%s" % (REQUEST['URL1'], m)) return getattr(self, m)(self, REQUEST) My question is about the marked block. I'd guess that the intent is to send a redirect if m (== options[0]['action']) contains a '/'. But m.find('/') evaluates to false only if m[0] == '/', otherwise it yields either -1 (which is true), if there's no '/' in m, or something greater 0, if there's a slash after the first char. Is this intended behavior or a bug? cheers, oliver
Oliver Bleutgen wrote at 2003-6-10 14:54 +0200:
... (*) if m.find('/'): raise 'Redirect', ( "%s/%s" % (REQUEST['URL1'], m)) return getattr(self, m)(self, REQUEST)
My question is about the marked block. I'd guess that the intent is to send a redirect if m (== options[0]['action']) contains a '/'.
But m.find('/') evaluates to false only if m[0] == '/', otherwise it yields either -1 (which is true), if there's no '/' in m, or something greater 0, if there's a slash after the first char.
Is this intended behavior or a bug?
It probably a bug. But one, that usually only adds an unnecessary "redirect". Dieter
Dieter Maurer wrote:
Oliver Bleutgen wrote at 2003-6-10 14:54 +0200:
... (*) if m.find('/'): raise 'Redirect', ( "%s/%s" % (REQUEST['URL1'], m)) return getattr(self, m)(self, REQUEST)
My question is about the marked block. I'd guess that the intent is to send a redirect if m (== options[0]['action']) contains a '/'.
But m.find('/') evaluates to false only if m[0] == '/', otherwise it yields either -1 (which is true), if there's no '/' in m, or something greater 0, if there's a slash after the first char.
Is this intended behavior or a bug?
It probably a bug. But one, that usually only adds an unnecessary "redirect".
Usually, but not when m.find('/') == 0, which OTOH happens if you want to give nice, secure absolute paths to the methods. The attribute error you get in that case is quite irritating. I'll stick it in the collectior. thanks, oliver
participants (2)
-
Dieter Maurer -
Oliver Bleutgen