def traverse(self, name, remaining): form = self.context form.update() if hasattr(form, 'widgets'): widget = form.widgets.get(name) if widget: return widget raise zope.traversing.namespace.LocationError(form, name)
def render_form(self): provided = IPloneFormLayer.providedBy(self.request) noLongerProvides(self.request, IPloneFormLayer) alsoProvides(self.request, IFormLayer) try: form = self.create_form() if IWrappedForm is None: switch_on(self) alsoProvides(self.request, ICMFDefaultSkin) else: alsoProvides(form, IWrappedForm) form.update() return form.render() finally: noLongerProvides(self.request, IFormLayer) if provided: alsoProvides(self.request, IPloneFormLayer)