当前位置: 首页>>代码示例>>Python>>正文


Python models.DocEvent类代码示例

本文整理汇总了Python中ietf.doc.models.DocEvent的典型用法代码示例。如果您正苦于以下问题:Python DocEvent类的具体用法?Python DocEvent怎么用?Python DocEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DocEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: edit_notices

def edit_notices(request, name):
    """Change the set of email addresses document change notificaitions go to."""

    review = get_object_or_404(Document, type="conflrev", name=name)

    if request.method == 'POST':
        form = NotifyForm(request.POST)
        if form.is_valid():

            review.notify = form.cleaned_data['notify']
            review.save()

            login = request.user.person
            c = DocEvent(type="added_comment", doc=review, by=login)
            c.desc = "Notification list changed to : "+review.notify
            c.save()

            return redirect('doc_view', name=review.name)

    else:

        init = { "notify" : review.notify }
        form = NotifyForm(initial=init)

    conflictdoc = review.relateddocument_set.get(relationship__slug='conflrev').target.document
    titletext = 'the conflict review of %s-%s' % (conflictdoc.canonical_name(),conflictdoc.rev)
    return render_to_response('doc/notify.html',
                              {'form': form,
                               'doc': review,
                               'titletext' : titletext
                              },
                              context_instance = RequestContext(request))
开发者ID:algby,项目名称:ietfdb,代码行数:32,代码来源:views_conflict_review.py

示例2: edit_ad

def edit_ad(request, name):
    """Change the shepherding Area Director for this status_change."""

    status_change = get_object_or_404(Document, type="statchg", name=name)

    if request.method == 'POST':
        form = AdForm(request.POST)
        if form.is_valid():

            status_change.ad = form.cleaned_data['ad']
            status_change.save()
    
            login = request.user.get_profile()
            c = DocEvent(type="added_comment", doc=status_change, by=login)
            c.desc = "Shepherding AD changed to "+status_change.ad.name
            c.save()

            return redirect("doc_view", name=status_change.name)

    else:
        init = { "ad" : status_change.ad_id }
        form = AdForm(initial=init)

    titletext = '%s-%s.txt' % (status_change.canonical_name(),status_change.rev)
    return render_to_response('doc/change_ad.html',
                              {'form': form,
                               'doc': status_change,
                               'titletext' : titletext,
                              },
                              context_instance = RequestContext(request))
开发者ID:mcr,项目名称:ietfdb,代码行数:30,代码来源:views_status_change.py

示例3: edit_notices

def edit_notices(request, name):
    """Change the set of email addresses document change notificaitions go to."""

    status_change = get_object_or_404(Document, type="statchg", name=name)

    if request.method == 'POST':
        form = NotifyForm(request.POST)
        if form.is_valid():

            status_change.notify = form.cleaned_data['notify']
            status_change.save()

            login = request.user.get_profile()
            c = DocEvent(type="added_comment", doc=status_change, by=login)
            c.desc = "Notification list changed to : "+status_change.notify
            c.save()

            return HttpResponseRedirect(reverse('doc_view', kwargs={'name': status_change.name}))

    else:

        init = { "notify" : status_change.notify }
        form = NotifyForm(initial=init)

    return render_to_response('doc/notify.html',
                              {'form': form,
                               'doc': status_change,
                               'titletext' : '%s-%s.txt' % (status_change.canonical_name(),status_change.rev)
                              },
                              context_instance = RequestContext(request))
开发者ID:mcr,项目名称:ietfdb,代码行数:30,代码来源:views_status_change.py

示例4: add_comment

def add_comment(request, name):
    """Add comment to history of document."""
    doc = get_object_or_404(Document, docalias__name=name)

    login = request.user.person

    if request.method == 'POST':
        form = AddCommentForm(request.POST)
        if form.is_valid():
            c = form.cleaned_data['comment']
            
            e = DocEvent(doc=doc, by=login)
            e.type = "added_comment"
            e.desc = c
            e.save()

            if doc.type_id == "draft":
                email_ad(request, doc, doc.ad, login,
                            "A new comment added by %s" % login.name)
            return redirect("doc_history", name=doc.name)
    else:
        form = AddCommentForm()
  
    return render_to_response('doc/add_comment.html',
                              dict(doc=doc,
                                   form=form),
                              context_instance=RequestContext(request))
开发者ID:algby,项目名称:ietfdb,代码行数:27,代码来源:views_doc.py

示例5: edit_ad

def edit_ad(request, name):
    """Change the responsible Area Director for this charter."""

    charter = get_object_or_404(Document, type="charter", name=name)
    login = request.user.person

    if request.method == 'POST':
        form = AdForm(request.POST)
        if form.is_valid():
            new_ad = form.cleaned_data['ad']
            if new_ad != charter.ad:
                save_document_in_history(charter)
                e = DocEvent(doc=charter, by=login)
                e.desc = "Responsible AD changed to %s" % new_ad.plain_name()
                if charter.ad:
                   e.desc += " from %s" % charter.ad.plain_name()
                e.type = "changed_document"
                e.save()
                charter.ad = new_ad
                charter.time = e.time
                charter.save()

            return redirect('doc_view', name=charter.name)
    else:
        init = { "ad" : charter.ad_id }
        form = AdForm(initial=init)

    return render_to_response('doc/charter/change_ad.html',
                              {'form':   form,
                               'charter': charter,
                              },
                              context_instance = RequestContext(request))
开发者ID:wpjesus,项目名称:codematch,代码行数:32,代码来源:views_charter.py

示例6: edit_notify

def edit_notify(request, name):
    doc = get_object_or_404(Document, type="charter", name=name)
    login = request.user.person

    init = {'notify': doc.notify}

    if request.method == "POST":
        form = NotifyForm(request.POST, initial=init)
        if form.is_valid():
            n = form.cleaned_data["notify"]
            if n != doc.notify:
                save_document_in_history(doc)

                e = DocEvent(doc=doc, by=login)
                e.desc = "Notification list changed to %s" % (escape(n) or "none")
                if doc.notify:
                    e.desc += " from %s" % escape(doc.notify)
                e.type = "changed_document"
                e.save()

                doc.notify = n
                doc.time = e.time
                doc.save()

            return redirect("doc_view", name=doc.name)
    else:
        form = NotifyForm(initial=init)

    return render_to_response('doc/charter/edit_notify.html',
                              dict(doc=doc,
                                   form=form,
                                   user=request.user,
                                   login=login),
                              context_instance=RequestContext(request))
开发者ID:algby,项目名称:ietfdb,代码行数:34,代码来源:views_charter.py

示例7: change_state

def change_state(request, name, option=None):
    """Change state of an IESG review for IETF conflicts in other stream's documents, notifying parties as necessary
    and logging the change as a comment."""
    review = get_object_or_404(Document, type="conflrev", name=name)

    login = request.user.get_profile()

    if request.method == 'POST':
        form = ChangeStateForm(request.POST)
        if form.is_valid():
            clean = form.cleaned_data
            review_state = clean['review_state']
            comment = clean['comment'].rstrip()

            if comment:
                c = DocEvent(type="added_comment", doc=review, by=login)
                c.desc = comment
                c.save()

            if review_state != review.get_state():
                save_document_in_history(review)

                old_description = review.friendly_state()
                review.set_state(review_state)
                new_description = review.friendly_state()

                log_state_changed(request, review, login, new_description, old_description)

                review.time = datetime.datetime.now()
                review.save()

                if review_state.slug == "iesgeval":
                    create_ballot_if_not_open(review, login, "conflrev")
                    ballot = review.latest_event(BallotDocEvent, type="created_ballot")
                    if has_role(request.user, "Area Director") and not review.latest_event(BallotPositionDocEvent, ad=login, ballot=ballot, type="changed_ballot_position"):

                        # The AD putting a conflict review into iesgeval who doesn't already have a position is saying "yes"
                        pos = BallotPositionDocEvent(doc=review, by=login)
                        pos.ballot = ballot
                        pos.type = "changed_ballot_position"
                        pos.ad = login
                        pos.pos_id = "yes"
                        pos.desc = "[Ballot Position Update] New position, %s, has been recorded for %s" % (pos.pos.name, pos.ad.plain_name())
                        pos.save()
                    send_conflict_eval_email(request,review)


            return redirect('doc_view', name=review.name)
    else:
        s = review.get_state()
        init = dict(review_state=s.pk if s else None)
        form = ChangeStateForm(initial=init)

    return render_to_response('doc/change_state.html',
                              dict(form=form,
                                   doc=review,
                                   login=login,
                                   help_url=reverse('help_conflict_review_states'),
                                   ),
                              context_instance=RequestContext(request))
开发者ID:mcr,项目名称:ietfdb,代码行数:60,代码来源:views_conflict_review.py

示例8: edit_title

def edit_title(request, name):
    """Change the title for this status_change document."""

    status_change = get_object_or_404(Document, type="statchg", name=name)

    if request.method == 'POST':
        form = ChangeTitleForm(request.POST)
        if form.is_valid():

            status_change.title = form.cleaned_data['title']
            status_change.save()
    
            login = request.user.person
            c = DocEvent(type="added_comment", doc=status_change, by=login)
            c.desc = "Title changed to '%s'"%status_change.title
            c.save()

            return redirect("doc_view", name=status_change.name)

    else:
        init = { "title" : status_change.title }
        form = ChangeTitleForm(initial=init)

    titletext = '%s-%s.txt' % (status_change.canonical_name(),status_change.rev)
    return render_to_response('doc/change_title.html',
                              {'form': form,
                               'doc': status_change,
                               'titletext' : titletext,
                              },
                              context_instance = RequestContext(request))
开发者ID:wpjesus,项目名称:codematch,代码行数:30,代码来源:views_status_change.py

示例9: expire_draft

def expire_draft(doc):
    # clean up files
    move_draft_files_to_archive(doc, doc.rev)

    system = Person.objects.get(name="(System)")

    # change the state
    save_document_in_history(doc)
    if doc.latest_event(type='started_iesg_process'):
        new_state = State.objects.get(used=True, type="draft-iesg", slug="dead")
        prev_state = doc.get_state(new_state.type_id)
        prev_tags = doc.tags.filter(slug__in=IESG_SUBSTATE_TAGS)
        if new_state != prev_state:
            doc.set_state(new_state)
            doc.tags.remove(*prev_tags)
            e = add_state_change_event(doc, system, prev_state, new_state, prev_tags=prev_tags, new_tags=[])

        e = DocEvent(doc=doc, by=system)
        e.type = "expired_document"
        e.desc = "Document has expired"
        e.save()

    doc.set_state(State.objects.get(used=True, type="draft", slug="expired"))
    doc.time = datetime.datetime.now()
    doc.save()
开发者ID:algby,项目名称:ietfdb,代码行数:25,代码来源:expire.py

示例10: edit_ad

def edit_ad(request, name):
    """Change the shepherding Area Director for this review."""

    review = get_object_or_404(Document, type="conflrev", name=name)

    if request.method == 'POST':
        form = AdForm(request.POST)
        if form.is_valid():

            review.ad = form.cleaned_data['ad']
            review.save()
    
            login = request.user.person
            c = DocEvent(type="added_comment", doc=review, by=login)
            c.desc = "Shepherding AD changed to "+review.ad.name
            c.save()

            return redirect('doc_view', name=review.name)

    else:
        init = { "ad" : review.ad_id }
        form = AdForm(initial=init)

    
    conflictdoc = review.relateddocument_set.get(relationship__slug='conflrev').target.document
    titletext = 'the conflict review of %s-%s' % (conflictdoc.canonical_name(),conflictdoc.rev)
    return render_to_response('doc/change_ad.html',
                              {'form': form,
                               'doc': review,
                               'titletext': titletext
                              },
                              context_instance = RequestContext(request))
开发者ID:algby,项目名称:ietfdb,代码行数:32,代码来源:views_conflict_review.py

示例11: log_state_changed

def log_state_changed(request, doc, by, prev_state):
    e = DocEvent(doc=doc, by=by)
    e.type = "changed_document"
    e.desc = u"State changed to <b>%s</b> from %s" % (
        doc.get_state().name,
        prev_state.name if prev_state else "None")
    e.save()
    return e
开发者ID:mcr,项目名称:ietfdb,代码行数:8,代码来源:utils.py

示例12: update_tags

def update_tags(request, obj, comment, person, set_tags=[], reset_tags=[], extra_notify=[]):
    if settings.USE_DB_REDESIGN_PROXY_CLASSES:
        doc = Document.objects.get(pk=obj.pk)
        save_document_in_history(doc)

        obj.tags.remove(*reset_tags)
        obj.tags.add(*set_tags)

        doc.time = datetime.datetime.now()

        e = DocEvent(type="changed_document", time=doc.time, by=person, doc=doc)
        l = []
        if set_tags:
            l.append(u"Annotation tag%s %s set." % (pluralize(set_tags), ", ".join(x.name for x in set_tags)))
        if reset_tags:
            l.append(u"Annotation tag%s %s cleared." % (pluralize(reset_tags), ", ".join(x.name for x in reset_tags)))
        e.desc = " ".join(l)
        e.save()

        receivers = get_notification_receivers(doc, extra_notify)
        send_mail(request, receivers, settings.DEFAULT_FROM_EMAIL,
                  u"Annotations tags changed for draft %s" % doc.name,
                  'ietfworkflows/annotation_tags_updated_mail.txt',
                  dict(doc=doc,
                       entry=dict(setted=", ".join(x.name for x in set_tags),
                                  unsetted=", ".join(x.name for x in reset_tags),
                                  change_date=doc.time,
                                  person=person,
                                  comment=comment)))
        return

    ctype = ContentType.objects.get_for_model(obj)
    setted = []
    resetted = []
    for tag in set_tags:
        if isinstance(tag, basestring):
            if set_tag_by_name(obj, tag):
                setted.append(tag)
        else:
            if set_tag(obj, tag):
                setted.append(tag.name)
    for tag in reset_tags:
        if isinstance(tag, basestring):
            if reset_tag_by_name(obj, tag):
                resetted.append(tag)
        else:
            if reset_tag(obj, tag):
                resetted.append(tag.name)
    entry = ObjectAnnotationTagHistoryEntry.objects.create(
        content_type=ctype,
        content_id=obj.pk,
        setted=','.join(setted),
        unsetted=','.join(resetted),
        date=datetime.datetime.now(),
        comment=comment,
        person=person)
    notify_tag_entry(entry, extra_notify)
开发者ID:mcr,项目名称:ietfdb,代码行数:57,代码来源:utils.py

示例13: add_review_comment

def add_review_comment(doc_name, review_time, by, comment):
    try:
        e = DocEvent.objects.get(doc__name=doc_name, time=review_time, type="iana_review")
    except DocEvent.DoesNotExist:
        doc = Document.objects.get(name=doc_name)
        e = DocEvent(doc=doc, time=review_time, type="iana_review")

    e.desc = comment
    e.by = by

    e.save()
开发者ID:algby,项目名称:ietfdb,代码行数:11,代码来源:iana.py

示例14: test_review_decisions

    def test_review_decisions(self):
        draft = make_test_data()

        e = DocEvent(type="iesg_approved")
        e.doc = draft
        e.by = Person.objects.get(name="Aread Irector")
        e.save()

        url = urlreverse('ietf.iesg.views.review_decisions')

        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)
        self.assertTrue(draft.name in r.content)
开发者ID:algby,项目名称:ietfdb,代码行数:13,代码来源:tests.py

示例15: edit_relations

def edit_relations(request, name):
    """Change the affected set of RFCs"""

    status_change = get_object_or_404(Document, type="statchg", name=name)

    login = request.user.get_profile()

    relation_slugs = DocRelationshipName.objects.filter(slug__in=RELATION_SLUGS)

    if request.method == 'POST':
        form = EditStatusChangeForm(request.POST)
        if 'Submit' in request.POST and form.is_valid():
    
            old_relations={}
            for rel in status_change.relateddocument_set.filter(relationship__slug__in=RELATION_SLUGS):
                old_relations[rel.target.document.canonical_name()]=rel.relationship.slug
            new_relations=form.cleaned_data['relations']
            status_change.relateddocument_set.filter(relationship__slug__in=RELATION_SLUGS).delete()
            for key in new_relations:
                status_change.relateddocument_set.create(target=DocAlias.objects.get(name=key),
                                                         relationship_id=new_relations[key])
            c = DocEvent(type="added_comment", doc=status_change, by=login)
            c.desc = "Affected RFC list changed.\nOLD:"
            for relname,relslug in (set(old_relations.items())-set(new_relations.items())):
                c.desc += "\n  "+relname+": "+DocRelationshipName.objects.get(slug=relslug).name
            c.desc += "\nNEW:"
            for relname,relslug in (set(new_relations.items())-set(old_relations.items())):
                c.desc += "\n  "+relname+": "+DocRelationshipName.objects.get(slug=relslug).name
            c.desc += "\n"
            c.save()

            return HttpResponseRedirect(status_change.get_absolute_url())

        elif 'Cancel' in request.POST:
            return HttpResponseRedirect(status_change.get_absolute_url())

    else: 
        relations={}
        for rel in status_change.relateddocument_set.filter(relationship__slug__in=RELATION_SLUGS):
            relations[rel.target.document.canonical_name()]=rel.relationship.slug
        init = { "relations":relations, 
               }
        form = EditStatusChangeForm(initial=init)

    return render_to_response('doc/status_change/edit_relations.html',
                              {
                               'doc':            status_change, 
                               'form':           form,
                               'relation_slugs': relation_slugs,
                              },
                              context_instance = RequestContext(request))
开发者ID:mcr,项目名称:ietfdb,代码行数:51,代码来源:views_status_change.py


注:本文中的ietf.doc.models.DocEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。