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


Python DocEvent.desc方法代码示例

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


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

示例1: build_conflict_review_document

# 需要导入模块: from ietf.doc.models import DocEvent [as 别名]
# 或者: from ietf.doc.models.DocEvent import desc [as 别名]
def build_conflict_review_document(login, doc_to_review, ad, notify, create_in_state):
    if doc_to_review.name.startswith('draft-'):
        review_name = 'conflict-review-'+doc_to_review.name[6:]
    else:
        # This is a failsafe - and might be treated better as an error
        review_name = 'conflict-review-'+doc_to_review.name

    iesg_group = Group.objects.get(acronym='iesg')

    conflict_review=Document( type_id = "conflrev",
                              title = "IETF conflict review for %s" % doc_to_review.name,
                              name = review_name,
                              rev = "00",
                              ad = ad,
                              notify = notify,
		              stream_id = 'ietf',
                              group = iesg_group,
                            )
    conflict_review.save()
    conflict_review.set_state(create_in_state)

    DocAlias.objects.create( name=review_name , document=conflict_review )
            
    conflict_review.relateddocument_set.create(target=DocAlias.objects.get(name=doc_to_review.name),relationship_id='conflrev')

    c = DocEvent(type="added_comment", doc=conflict_review, by=login)
    c.desc = "IETF conflict review requested"
    c.save()

    c = DocEvent(type="added_comment", doc=doc_to_review, by=login)
    # Is it really OK to put html tags into comment text?
    c.desc = 'IETF conflict review initiated - see <a href="%s">%s</a>' % (reverse('doc_view', kwargs={'name':conflict_review.name}),conflict_review.name)
    c.save()

    return conflict_review
开发者ID:algby,项目名称:ietfdb,代码行数:37,代码来源:views_conflict_review.py

示例2: assign_shepherd

# 需要导入模块: from ietf.doc.models import DocEvent [as 别名]
# 或者: from ietf.doc.models.DocEvent import desc [as 别名]
def assign_shepherd(user, internetdraft, shepherd):
    if internetdraft.shepherd == shepherd:
        return
    
    from ietf.doc.models import save_document_in_history, DocEvent, Document

    # saving the proxy object is a bit of a mess, so convert it to a
    # proper document
    doc = Document.objects.get(name=internetdraft.name)
    
    save_document_in_history(doc)

    doc.time = datetime.datetime.now()
    doc.shepherd = shepherd
    doc.save()

    e = DocEvent(type="changed_document")
    e.time = doc.time
    e.doc = doc
    e.by = user.get_profile()
    if not shepherd:
        e.desc = u"Unassigned shepherd"
    else:
        e.desc = u"Changed shepherd to %s" % shepherd.plain_name()
    e.save()

    # update proxy too
    internetdraft.shepherd = shepherd
开发者ID:mcr,项目名称:ietfdb,代码行数:30,代码来源:forms.py

示例3: approve

# 需要导入模块: from ietf.doc.models import DocEvent [as 别名]
# 或者: from ietf.doc.models.DocEvent import desc [as 别名]
def approve(request, name):
    """Approve this conflict review, setting the appropriate state and send the announcement to the right parties."""
    review = get_object_or_404(Document, type="conflrev", name=name)

    if review.get_state('conflrev').slug not in ('appr-reqnopub-pend','appr-noprob-pend'):
      raise Http404

    login = request.user.get_profile()

    if request.method == 'POST':

        form = AnnouncementForm(request.POST)

        if form.is_valid():

            new_state_slug = 'appr-reqnopub-sent' if review.get_state('conflrev').slug=='appr-reqnopub-pend' else 'appr-noprob-sent'
            new_review_state = State.objects.get(used=True, type="conflrev", slug=new_state_slug)
            save_document_in_history(review)
            old_description = review.friendly_state()
            review.set_state(new_review_state)
            new_description = review.friendly_state()

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

            close_open_ballots(review, login)

            e = DocEvent(doc=review, by=login)
            e.type = "iesg_approved"
            e.desc = "IESG has approved the conflict review response"
            e.save()

            review.time = e.time
            review.save()

            # send announcement
            send_mail_preformatted(request, form.cleaned_data['announcement_text'])

            c = DocEvent(type="added_comment", doc=review, by=login)
            c.desc = "The following approval message was sent\n"+form.cleaned_data['announcement_text']
            c.save()

            return HttpResponseRedirect(review.get_absolute_url())

    else:

        init = { "announcement_text" : default_approval_text(review) }
        form = AnnouncementForm(initial=init)
    
    return render_to_response('doc/conflict_review/approve.html',
                              dict(
                                   review = review,
                                   conflictdoc = review.relateddocument_set.get(relationship__slug='conflrev').target.document,   
                                   form = form,
                                   ),
                              context_instance=RequestContext(request))
开发者ID:mcr,项目名称:ietfdb,代码行数:57,代码来源:views_conflict_review.py

示例4: edit_material_presentations

# 需要导入模块: from ietf.doc.models import DocEvent [as 别名]
# 或者: from ietf.doc.models.DocEvent import desc [as 别名]
def edit_material_presentations(request, name, acronym=None, date=None, seq=None, week_day=None):

    doc = get_object_or_404(Document, name=name)
    if not (doc.type_id=='slides' and doc.get_state('slides').slug=='active'):
        raise Http404

    group = doc.group
    if not (group.features.has_materials and can_manage_materials(request.user,group)):
        raise Http404

    sorted_sessions = get_upcoming_manageable_sessions(request.user, doc, acronym, date, seq, week_day)

    if len(sorted_sessions)!=1:
        raise Http404

    session = sorted_sessions[0]
    choices = [('notpresented','Not Presented')]
    choices.extend([(x,x) for x in doc.docevent_set.filter(type='new_revision').values_list('newrevisiondocevent__rev',flat=True)])
    initial = {'version' : session.version if hasattr(session,'version') else 'notpresented'}

    if request.method == 'POST':
        form = MaterialVersionForm(request.POST,choices=choices)
        if form.is_valid():
            new_selection = form.cleaned_data['version']
            if initial['version'] != new_selection:
                if initial['version'] == 'notpresented':
                    doc.sessionpresentation_set.create(session=session,rev=new_selection)
                    c = DocEvent(type="added_comment", doc=doc, by=request.user.person)
                    c.desc = "Added version %s to session: %s" % (new_selection,session)
                    c.save()
                elif new_selection == 'notpresented':
                    doc.sessionpresentation_set.filter(session=session).delete()
                    c = DocEvent(type="added_comment", doc=doc, by=request.user.person)
                    c.desc = "Removed from session: %s" % (session)
                    c.save()
                else:
                    doc.sessionpresentation_set.filter(session=session).update(rev=new_selection)
                    c = DocEvent(type="added_comment", doc=doc, by=request.user.person)
                    c.desc = "Revision for session %s changed to  %s" % (session,new_selection)
                    c.save()
            return redirect('doc_view',name=doc.name)
    else:
        form = MaterialVersionForm(choices=choices,initial=initial)

    return render(request, 'doc/material/edit_material_presentations.html', {
        'session': session,
        'doc': doc,
        'form': form,
        })
开发者ID:wpjesus,项目名称:codematch,代码行数:51,代码来源:views_material.py

示例5: add_comment

# 需要导入模块: from ietf.doc.models import DocEvent [as 别名]
# 或者: from ietf.doc.models.DocEvent import desc [as 别名]
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,代码行数:29,代码来源:views_doc.py

示例6: edit_title

# 需要导入模块: from ietf.doc.models import DocEvent [as 别名]
# 或者: from ietf.doc.models.DocEvent import desc [as 别名]
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,代码行数:32,代码来源:views_status_change.py

示例7: edit_ad

# 需要导入模块: from ietf.doc.models import DocEvent [as 别名]
# 或者: from ietf.doc.models.DocEvent import desc [as 别名]
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,代码行数:34,代码来源:views_conflict_review.py

示例8: edit_notices

# 需要导入模块: from ietf.doc.models import DocEvent [as 别名]
# 或者: from ietf.doc.models.DocEvent import desc [as 别名]
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,代码行数:34,代码来源:views_conflict_review.py

示例9: edit_ad

# 需要导入模块: from ietf.doc.models import DocEvent [as 别名]
# 或者: from ietf.doc.models.DocEvent import desc [as 别名]
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,代码行数:34,代码来源:views_charter.py

示例10: edit_notices

# 需要导入模块: from ietf.doc.models import DocEvent [as 别名]
# 或者: from ietf.doc.models.DocEvent import desc [as 别名]
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,代码行数:32,代码来源:views_status_change.py

示例11: edit_ad

# 需要导入模块: from ietf.doc.models import DocEvent [as 别名]
# 或者: from ietf.doc.models.DocEvent import desc [as 别名]
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,代码行数:32,代码来源:views_status_change.py

示例12: expire_draft

# 需要导入模块: from ietf.doc.models import DocEvent [as 别名]
# 或者: from ietf.doc.models.DocEvent import desc [as 别名]
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,代码行数:27,代码来源:expire.py

示例13: edit_notify

# 需要导入模块: from ietf.doc.models import DocEvent [as 别名]
# 或者: from ietf.doc.models.DocEvent import desc [as 别名]
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,代码行数:36,代码来源:views_charter.py

示例14: change_state

# 需要导入模块: from ietf.doc.models import DocEvent [as 别名]
# 或者: from ietf.doc.models.DocEvent import desc [as 别名]
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,代码行数:62,代码来源:views_conflict_review.py

示例15: log_state_changed

# 需要导入模块: from ietf.doc.models import DocEvent [as 别名]
# 或者: from ietf.doc.models.DocEvent import desc [as 别名]
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,代码行数:10,代码来源:utils.py


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