Get the review history for the given brain or context.

    :param brain_or_object: A single catalog brain or content object
    :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain
    :returns: Workflow history
    :rtype: [{}, ...]
187407
def get_review_history(brain_or_object, rev=True):
    
    obj = get_object(brain_or_object)
    review_history = []
    try:
        workflow = get_tool("portal_workflow")
        review_history = workflow.getInfoFor(obj, 'review_history')
    except WorkflowException as e:
        message = str(e)
        logger.error("Cannot retrieve review_history on {}: {}".format(
            obj, message))
    if not isinstance(review_history, (list, tuple)):
        logger.error("get_review_history: expected list, recieved {}".format(
            review_history))
        review_history = []
    if rev is True:
        review_history.reverse()
    return review_history
279486
def user_has_reviewed(obj, user):
    """"""
    ctype = ContentType.objects.get_for_model(obj)
    try:
        models.Review.objects.get(user=user, content_type=ctype,
                                  object_id=obj.id)
    except models.Review.DoesNotExist:
        return False
    return True
770827
def get_objects_in_sequence(brain_or_object, ctype, cref):
    
    obj = api.get_object(brain_or_object)
    if ctype == "backreference":
        return get_backreferences(obj, cref)
    if ctype == "contained":
        return get_contained_items(obj, cref)
    raise ValueError("Reference value is mandatory for sequence type counter")
569116
def get_reviews(obj):
    """"""
    ctype = ContentType.objects.get_for_model(obj)
    return models.Review.objects.filter(content_type=ctype, object_id=obj.id)
1273945
def existing(self):
        
        catalog = api.portal.get_tool('portal_catalog')
        results = []
        layout_path = self._get_layout_path(
            self.request.form.get('layout', '')
        )
        for brain in catalog(layout=layout_path):
            results.append({
                'title': brain.Title,
                'url': brain.getURL()
            })
        return json.dumps({
            'total': len(results),
            'data': results
        })
774067
def get_title(brain_or_object):
    
    if is_brain(brain_or_object) and base_hasattr(brain_or_object, "Title"):
        return brain_or_object.Title
    return get_object(brain_or_object).Title()
348137
def history(self):
        
        history = self.history_class
        if history:
            return self.session.query(history).filter(history.id == self.id)
        else:
            return None
1071418
def getVerifier(self):
        
        wtool = getToolByName(self, 'portal_workflow')
        mtool = getToolByName(self, 'portal_membership')

        verifier = None
        # noinspection PyBroadException
        try:
            review_history = wtool.getInfoFor(self, 'review_history')
        except:  # noqa FIXME: remove blind except!
            return 'access denied'

        if not review_history:
            return 'no history'
        for items in review_history:
            action = items.get('action')
            if action != 'verify':
                continue
            actor = items.get('actor')
            member = mtool.getMemberById(actor)
            verifier = member.getProperty('fullname')
            if verifier is None or verifier == '':
                verifier = actor
        return verifier
170738
def get_revision_history(brain_or_object):
    
    obj = get_object(brain_or_object)
    chv = ContentHistoryView(obj, safe_getattr(obj, "REQUEST", None))
    return chv.fullHistory()
831011
def get_workflow_actions_for(brain_or_object):
    
    portal_type = api.get_portal_type(brain_or_object)
    actions = actions_by_type.get(portal_type, None)
    if actions:
        return actions

    # Retrieve the actions from the workflows this object is bound to
    actions = []
    wf_tool = api.get_tool("portal_workflow")
    for wf_id in get_workflow_ids_for(brain_or_object):
        workflow = wf_tool.getWorkflowById(wf_id)
        wf_actions = map(lambda action: action[0], workflow.transitions.items())
        actions.extend(wf_actions)

    actions = list(set(actions))
    actions_by_type[portal_type] = actions
    return actions
1184797
def init_with_brain(self, brain):
        
        self._uid = api.get_uid(brain)
        self._brain = brain
        self._catalog = self.get_catalog_for(brain)
        self._instance = None
756841
def get_json_history(self, item=None, nb=0):
        
        s = self.stats_history.get_json(nb=nb)
        if item is None:
            return s
        else:
            if item in s:
                return s[item]
            else:
                return None
689911
def history(self):
        ''''''
        r = self.obj.api.getDatastreamHistory(self.obj.pid, self.id, format='xml')
        return parse_xml_object(DatastreamHistory, r.content, r.url)
645817
def get_ideas_in_review(self, **kwargs):
        
        return bind_api(
            api=self,
            path='/ideas/inreview',
            payload_type='idea',
            payload_list=True,
            pagination_param=['page_number', 'page_size', 'order_key']
        )(**kwargs)
265105
def catalog(self):
        
        if self._catalog is None:
            logger.debug("SuperModel::catalog: *Fetch catalog*")
            self._catalog = self.get_catalog_for(self.brain)
        return self._catalog
1357662
def previous(self):
        '''  '''
        try:
            return self.__class__.objects.for_model(self.content_object,
                                                    self.content_type).\
                            filter(order__gt=self.order).order_by('order')[0]
        except IndexError:
            return None
1017548
def get_behaviors(brain_or_object):
    
    obj = get_object(brain_or_object)
    if not is_dexterity_content(obj):
        fail(400, "Only Dexterity contents can have assigned behaviors")
    assignable = IBehaviorAssignable(obj, None)
    if not assignable:
        return {}
    out = {}
    for behavior in assignable.enumerateBehaviors():
        for name, field in getFields(behavior.interface).items():
            out[name] = field
    return out