示例#1
0
文件: views.py 项目: helemaalbigt/h
    def __html__(self):
        request = self.request
        context = request.context

        d = url_values_from_document(context)
        d["annotation"] = context

        referrers = self.Store(request).search(references=context["id"])
        d["annotation"]["referrers"] = referrers

        if context.get("references", []):
            parent = context.__parent__[context["references"][-1]]
            d["quoteSource"] = "annotation"
            d["quoteUser"] = parent["user"]
            d["quote"] = parent["text"]
        else:
            d["quoteSource"] = "document"
            d["quote"] = context.quote
            context["references"] = []

        if not "deleted" in context:
            context["deleted"] = False

        context["date"] = context["updated"]

        return {"annotation": json.dumps(d)}
示例#2
0
文件: views.py 项目: almereyda/h
    def __html__(self):
        request = self.request
        context = request.context
        if len(context) == 0:
            raise httpexceptions.HTTPNotFound(
                body_template=
                "Either no annotation exists with this identifier, or you "
                "don't have the permissions required for viewing it."
            )

        d = url_values_from_document(context)
        d['annotation'] = context
        d['annotation']['referrers'] = context.referrers

        if context.get('references', []):
            parent = context.__parent__[context['references'][-1]]
            d['quoteSource'] = 'annotation'
            d['quoteUser'] = parent['user']
            d['quote'] = parent['text']
        else:
            d['quoteSource'] = 'document'
            d['quote'] = context.quote
            context['references'] = []

        if not 'deleted' in context:
            context['deleted'] = False

        context['date'] = context['updated']

        return {'annotation': json.dumps(d)}
示例#3
0
    def __html__(self):
        request = self.request
        context = request.context
        if len(context) == 0:
            raise httpexceptions.HTTPNotFound(
                body_template=
                "Either no annotation exists with this identifier, or you "
                "don't have the permissions required for viewing it.")

        d = url_values_from_document(context)
        d['annotation'] = context
        d['annotation']['referrers'] = context.referrers

        if context.get('references', []):
            parent = context.__parent__[context['references'][-1]]
            d['quote'] = parent['text']
        else:
            d['quote'] = context.quote
            context['references'] = []

        if not 'deleted' in context:
            context['deleted'] = False

        context['date'] = context['updated']

        return {'annotation': json.dumps(d)}
示例#4
0
文件: views.py 项目: helemaalbigt/h
    def __html__(self):
        request = self.request
        context = request.context

        d = url_values_from_document(context)
        d['annotation'] = context

        referrers = self.Store(request).search(references=context['id'])
        d['annotation']['referrers'] = referrers

        if context.get('references', []):
            parent = context.__parent__[context['references'][-1]]
            d['quoteSource'] = 'annotation'
            d['quoteUser'] = parent['user']
            d['quote'] = parent['text']
        else:
            d['quoteSource'] = 'document'
            d['quote'] = context.quote
            context['references'] = []

        if not 'deleted' in context:
            context['deleted'] = False

        context['date'] = context['updated']

        return {'annotation': json.dumps(d)}
示例#5
0
文件: views.py 项目: mambocab/h
    def __html__(self):
        request = self.request
        context = request.context

        d = url_values_from_document(context)
        d['annotation'] = context

        referrers = self.Store(request).search(references=context['id'])
        d['annotation']['referrers'] = referrers

        if context.get('references', []):
            parent = context.__parent__[context['references'][-1]]
            d['quoteSource'] = 'annotation'
            d['quoteUser'] = parent['user']
            d['quote'] = parent['text']
        else:
            d['quoteSource'] = 'document'
            d['quote'] = context.quote
            context['references'] = []

        if not 'deleted' in context:
            context['deleted'] = False

        context['date'] = context['updated']

        return {'annotation': json.dumps(d)}