def describe(self, page): actives = [page] active = page.__parent__ while IRESTComponent.providedBy(active): actives.append(active) active = active.__parent__ return map(lambda e: e.describe(page, None, actives), self)
def queryRESTComponent(specs, args, name=u'', parent=None, id=_marker): """Query the ZCA for a REST component. """ factory = getComponent(specs, IRESTComponent, name, default=None) if factory is not None: result = factory(*args) if result is not None and IRESTComponent.providedBy(result): # Set parenting information / for security if id is _marker: id = name result.__name__ = id result.__parent__ = parent return result return None
def __init__(self, screen): # Follow Zope 2 information to appear in the undo log. note = [] if ISilvaObject.providedBy(screen.context) or IVersion.providedBy(screen.context): note.append("/".join(screen.context.getPhysicalPath())) else: note.append("/") names = [] while IRESTComponent.providedBy(screen): names.append(screen.__name__) screen = screen.__parent__ if names: note.extend(["SMI action:", "/".join(reversed(names))]) self.note = " ".join(note) self.user = getSecurityManager().getUser() self.user_path = "" auth_folder = aq_parent(self.user) if auth_folder is not None: self.user_path = "/".join(auth_folder.getPhysicalPath()[1:-1])
def get_tab_path(tab): path = [] while IRESTComponent.providedBy(tab): path.extend(reversed_clean_path(tab.__name__)) tab = tab.__parent__ return path
def __str__(self): pattern = '%s/++rest++%s' if IRESTComponent.providedBy(self.context.__parent__): pattern = '%s/%s' return pattern % (self._parent_url(), self.context.__name__)