def __call__(self): context = aq_inner(self.context) storage = IStorage(self.context) catalog = getToolByName(self.context, 'portal_catalog') try: brains = catalog(UID=IUUID(self.context)) except TypeError: # pragma: no cover brains = [] item = None if len(brains) > 0: obj = brains[0] base_path = '/'.join(context.getPhysicalPath()) item = {} for attr in self.attributes: key = attr if key == 'path': attr = 'getPath' val = getattr(obj, attr, None) if callable(val): val = val() if key == 'path': val = val[len(base_path):] item[key] = val return json.dumps({ 'addButtons': [], 'defaultPage': self.context.getDefaultPage(), 'object': item, 'branches': storage.branches(), 'tags': storage.tags(), 'defaultRev': storage.rev, # no checkout should have been done })