All pastes #1727569 Raw Edit

Mine

public text v1 · immutable
#1727569 ·published 2009-12-26 15:59 UTC
rendered paste body
    def index_html(self, REQUEST, RESPONSE, path=None):
        """Publish the object to the external editor helper app"""

        security = getSecurityManager()
        if path is None:
            parent = self.aq_parent
            try:
                ob = parent[REQUEST['target']] # Try getitem
            except KeyError:
                import pdb; pdb.set_trace();
                ob = getattr(parent, REQUEST['target']) # Try getattr
            except AttributeError:
                # Handle objects that are methods in ZClasses
                ob = parent.propertysheets.methods[REQUEST['target']]
        else:
            ob = self.restrictedTraverse( path )


I added a pdb at the first except and get this:

(Pdb) 
(Pdb) parent
<ATFolder at /cms/documents>
(Pdb) target
*** NameError: name 'target' is not defined
(Pdb) parent[REQUEST]
*** AttributeError: startswith
(Pdb) parent[REQUEST['target']]
*** KeyError: 'xip.odt.zem'
(Pdb) parent['xip.odt']
<ATFile at /cms/documents/xip.odt>
(Pdb)