• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python utils.create_comm_note函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: publish

 def publish(self, request, *args, **kwargs):
     obj = self.get_object()
     obj.publish()
     create_comm_note(obj.extension, obj, request.user,
                      request.DATA.get('message', ''),
                      note_type=comm.APPROVAL)
     return Response(status=status.HTTP_202_ACCEPTED)
开发者ID:SphinxKnight,项目名称:zamboni,代码行数:7,代码来源:views.py


示例2: handle_vip

def handle_vip(addon, version, user):
    msg = u'VIP app updated'

    # Add to escalation queue
    EscalationQueue.objects.get_or_create(addon=addon)

    # Create comm note
    create_comm_note(addon, version, user, msg, note_type=comm.ESCALATION,
                     perms={'developer': False})

    # Log action
    amo.log(amo.LOG.ESCALATION_VIP_APP, addon, version, created=datetime.now(),
            details={'comments': msg})
    log.info(u'[app:%s] escalated - %s' % (addon.name, msg))

    # Special senior reviewer email.
    if not waffle.switch_is_active('comm-dashboard'):
        context = {'name': addon.name,
                   'review_url': absolutify(reverse('reviewers.apps.review',
                                                     args=[addon.app_slug],
                                                     add_prefix=False)),
                   'SITE_URL': settings.SITE_URL}
        send_mail(u'%s: %s' % (msg, addon.name),
                   'developers/emails/vip_escalation.ltxt', context,
                   [settings.MKT_SENIOR_EDITORS_EMAIL])
开发者ID:AALEKH,项目名称:zamboni,代码行数:25,代码来源:utils.py


示例3: app_summary

def app_summary(request, addon_id):
    app = get_object_or_404(Webapp.with_deleted, pk=addon_id)

    if 'prioritize' in request.POST and not app.priority_review:
        app.update(priority_review=True)
        msg = u'Priority Review Requested'
        # Create notes and log entries.
        create_comm_note(app, app.latest_version, request.amo_user, msg,
                         note_type=comm.NO_ACTION)
        amo.log(amo.LOG.PRIORITY_REVIEW_REQUESTED, app, app.latest_version,
                created=datetime.now(), details={'comments': msg})

    authors = (app.authors.filter(addonuser__role__in=(amo.AUTHOR_ROLE_DEV,
                                                       amo.AUTHOR_ROLE_OWNER))
                          .order_by('display_name'))

    if app.premium and app.premium.price:
        price = app.premium.price
    else:
        price = None

    purchases, refunds = _app_purchases_and_refunds(app)
    payment_account = False
    # TODO: fixme for multiple accounts
    if hasattr(app, 'single_pay_account'):
        try:
            payment_account = app.single_pay_account().payment_account
        except ValueError:
            pass
    return render(request, 'lookup/app_summary.html',
                  {'abuse_reports': app.abuse_reports.count(), 'app': app,
                   'authors': authors, 'downloads': _app_downloads(app),
                   'purchases': purchases, 'refunds': refunds, 'price': price,
                   'payment_account': payment_account})
开发者ID:KKcorps,项目名称:zamboni,代码行数:34,代码来源:views.py


示例4: version_edit

def version_edit(request, addon_id, addon, version_id):
    show_features = addon.is_packaged
    formdata = request.POST if request.method == "POST" else None
    version = get_object_or_404(Version, pk=version_id, addon=addon)
    version.addon = addon  # Avoid extra useless query.
    form = AppVersionForm(formdata, instance=version)
    all_forms = [form]

    if show_features:
        appfeatures = version.features
        appfeatures_form = AppFeaturesForm(request.POST or None, instance=appfeatures)
        all_forms.append(appfeatures_form)

    if request.method == "POST" and all(f.is_valid() for f in all_forms):
        [f.save() for f in all_forms]

        if f.data.get("approvalnotes"):
            create_comm_note(addon, version, request.user, f.data["approvalnotes"], note_type=comm.REVIEWER_COMMENT)

        messages.success(request, _("Version successfully edited."))
        return redirect(addon.get_dev_url("versions"))

    context = {"addon": addon, "version": version, "form": form}

    if show_features:
        context.update(
            {
                "appfeatures_form": appfeatures_form,
                "appfeatures": appfeatures,
                "feature_list": [unicode(f) for f in appfeatures.to_list()],
            }
        )

    return render(request, "developers/apps/version_edit.html", context)
开发者ID:ngokevin,项目名称:zamboni,代码行数:34,代码来源:views.py


示例5: reject

 def reject(self, request, *args, **kwargs):
     obj = self.get_object()
     obj.reject()
     create_comm_note(obj.extension, obj, request.user,
                      request.data.get('message', ''),
                      note_type=comm.REJECTION)
     return Response(status=status.HTTP_202_ACCEPTED)
开发者ID:waseem18,项目名称:zamboni,代码行数:7,代码来源:views.py


示例6: prioritize_app

def prioritize_app(app, user):
    app.update(priority_review=True)
    msg = u'Priority Review Requested'
    # Create notes and log entries.
    create_comm_note(app, app.latest_version, user, msg,
                     note_type=comm.PRIORITY_REVIEW_REQUESTED)
    mkt.log(mkt.LOG.PRIORITY_REVIEW_REQUESTED, app, app.latest_version,
            created=datetime.now(), details={'comments': msg})
开发者ID:Witia1,项目名称:zamboni,代码行数:8,代码来源:utils.py


示例7: test_create_note_existing_thread

    def test_create_note_existing_thread(self):
        # Initial note.
        thread, note = create_comm_note(
            self.extension, self.extension.latest_version, self.user, 'huehue')

        # Second person joins thread.
        thread, last_word = create_comm_note(
            self.extension, self.extension.latest_version, user_factory(),
            'euheuh!', note_type=comm.MORE_INFO_REQUIRED)

        eq_(thread.thread_cc.count(), 2)
开发者ID:Fjoerfoks,项目名称:zamboni,代码行数:11,代码来源:test_utils_.py


示例8: save

    def save(self, *args, **kw):
        if self.data['notes']:
            create_comm_note(self.instance, self.instance.versions.latest(),
                             self.request.user, self.data['notes'],
                             note_type=comm.SUBMISSION)
        self.instance = super(AppDetailsBasicForm, self).save(commit=True)

        for tag_text in self.cleaned_data['tags']:
            Tag(tag_text=tag_text).save_tag(self.instance)

        return self.instance
开发者ID:digideskio,项目名称:zamboni,代码行数:11,代码来源:forms.py


示例9: save

    def save(self, *args, **kw):
        if self.data['notes']:
            create_comm_note(self.instance, self.instance.versions.latest(),
                             self.request.user, self.data['notes'],
                             note_type=comm.SUBMISSION)
        self.instance = super(AppDetailsBasicForm, self).save(commit=True)
        uses_flash = self.cleaned_data.get('flash')
        af = self.instance.get_latest_file()
        if af is not None:
            af.update(uses_flash=bool(uses_flash))

        return self.instance
开发者ID:andymckay,项目名称:zamboni,代码行数:12,代码来源:forms.py


示例10: escalate_app

def escalate_app(app, version, user, msg, log_type):
    # Add to escalation queue
    EscalationQueue.objects.get_or_create(addon=app)

    # Create comm note
    create_comm_note(app, version, user, msg,
                     note_type=comm.ACTION_MAP(log_type))

    # Log action
    mkt.log(log_type, app, version, created=datetime.now(),
            details={'comments': msg})
    log.info(u'[app:%s] escalated - %s' % (app.name, msg))
开发者ID:Witia1,项目名称:zamboni,代码行数:12,代码来源:utils.py


示例11: flag

    def flag(cls, addon, event, message=None):
        cls.objects.get_or_create(addon=addon)
        version = addon.current_version or addon.latest_version
        if message:
            mkt.log(event, addon, version, details={"comments": message})
        else:
            mkt.log(event, addon, version)

        # TODO: if we ever get rid of ActivityLog for reviewer notes, replace
        # all flag calls to use the comm constant and not have to use
        # ACTION_MAP.
        create_comm_note(addon, version, None, message, note_type=comm.ACTION_MAP(event))
开发者ID:Jobava,项目名称:zamboni,代码行数:12,代码来源:models.py


示例12: app_summary

def app_summary(request, addon_id):
    app = get_object_or_404(Webapp.with_deleted, pk=addon_id)

    if 'prioritize' in request.POST and not app.priority_review:
        app.update(priority_review=True)
        msg = u'Priority Review Requested'
        # Create notes and log entries.
        create_comm_note(app, app.latest_version, request.user, msg,
                         note_type=comm.PRIORITY_REVIEW_REQUESTED)
        amo.log(amo.LOG.PRIORITY_REVIEW_REQUESTED, app, app.latest_version,
                created=datetime.now(), details={'comments': msg})

    authors = (app.authors.filter(addonuser__role__in=(amo.AUTHOR_ROLE_DEV,
                                                       amo.AUTHOR_ROLE_OWNER))
                          .order_by('display_name'))

    if app.premium and app.premium.price:
        price = app.premium.price
    else:
        price = None

    purchases, refunds = _app_purchases_and_refunds(app)
    provider_portals = get_payment_provider_portals(app=app)
    versions = None

    status_form = APIStatusForm(initial={
        'status': amo.STATUS_CHOICES_API[app.status]
    })
    version_status_forms = {}
    if app.is_packaged:
        versions = app.versions.all().order_by('-created')
        for v in versions:
            version_status_forms[v.pk] = APIFileStatusForm(initial={
                'status': amo.STATUS_CHOICES_API[v.all_files[0].status]
            })

    permissions = {}
    if app.latest_version:
        permissions = app.latest_version.manifest.get('permissions', {})

    return render(request, 'lookup/app_summary.html', {
        'abuse_reports': app.abuse_reports.count(), 'app': app,
        'authors': authors, 'downloads': _app_downloads(app),
        'purchases': purchases, 'refunds': refunds, 'price': price,
        'provider_portals': provider_portals,
        'status_form': status_form, 'versions': versions,
        'is_tarako': app.tags.filter(tag_text=QUEUE_TARAKO).exists(),
        'tarako_review':
            app.additionalreview_set.latest_for_queue(QUEUE_TARAKO),
        'version_status_forms': version_status_forms,
        'permissions': permissions,
    })
开发者ID:j-barron,项目名称:zamboni,代码行数:52,代码来源:views.py


示例13: test_create_note_existing_thread

    def test_create_note_existing_thread(self):
        # Initial note.
        thread, note = create_comm_note(self.app, self.app.current_version, self.user, "huehue")

        # Second note from contact.
        thread, reply = create_comm_note(
            self.app, self.app.current_version, self.contact, "euheuh!", note_type=comm.REJECTION
        )

        # Third person joins thread.
        thread, last_word = create_comm_note(
            self.app, self.app.current_version, user_factory(), "euheuh!", note_type=comm.MORE_INFO_REQUIRED
        )

        eq_(thread.thread_cc.count(), 3)
开发者ID:shahbaz17,项目名称:zamboni,代码行数:15,代码来源:test_utils_.py


示例14: test_create_thread

    def test_create_thread(self):
        # Default permissions.
        thread, note = create_comm_note(
            self.app, self.app.current_version, self.user, 'huehue',
            note_type=comm.APPROVAL)

        # Check Thread.
        eq_(thread.addon, self.app)
        eq_(thread.version, self.app.current_version)
        expected = {
            'public': False, 'developer': True, 'reviewer': True,
            'senior_reviewer': True, 'mozilla_contact': True, 'staff': True}
        for perm, has_perm in expected.items():
            eq_(getattr(thread, 'read_permission_%s' % perm), has_perm, perm)

        # Check Note.
        eq_(note.thread, thread)
        eq_(note.author, self.user)
        eq_(note.body, 'huehue')
        eq_(note.note_type, comm.APPROVAL)

        # Check CC.
        eq_(thread.thread_cc.count(), 2)
        assert thread.thread_cc.filter(user=self.contact).exists()
        assert thread.thread_cc.filter(user=self.user).exists()

        # Check Reads.
        eq_(note.read_by_users.count(), 2)
开发者ID:AALEKH,项目名称:zamboni,代码行数:28,代码来源:test_utils_.py


示例15: create_note

    def create_note(self, action):
        """
        Permissions default to developers + reviewers + Mozilla contacts.
        For escalation/comment, exclude the developer from the conversation.
        """
        details = {'comments': self.data['comments'],
                   'reviewtype': self.review_type}
        if self.files:
            details['files'] = [f.id for f in self.files]

        tested = self.get_tested()  # You really should...
        if tested:
            self.data['comments'] += '\n\n%s' % tested

        # Commbadge (the future).
        note_type = comm.ACTION_MAP(action.id)
        self.comm_thread, self.comm_note = create_comm_note(
            self.addon, self.version, self.request.user,
            self.data['comments'], note_type=note_type,
            attachments=self.attachment_formset)

        # ActivityLog (ye olde).
        mkt.log(action, self.addon, self.version, user=self.user,
                created=datetime.now(), details=details,
                attachments=self.attachment_formset)
开发者ID:Jobava,项目名称:zamboni,代码行数:25,代码来源:utils.py


示例16: create

    def create(self, request, *args, **kwargs):
        if not waffle.switch_is_active('comm-dashboard'):
            return Response(status=status.HTTP_403_FORBIDDEN)

        thread = get_object_or_404(CommunicationThread, id=kwargs['thread_id'])

        # Validate note.
        form = forms.CreateCommNoteForm(request.DATA)
        if not form.is_valid():
            return Response(form.errors, status=status.HTTP_400_BAD_REQUEST)
        note_type = form.cleaned_data['note_type']

        if (note_type == comm.DEVELOPER_COMMENT and not
            request.user.addonuser_set.filter(
                addon=thread.addon).exists()):
            # Developer comment only for developers.
            return Response('Only developers can make developer comments',
                            status=status.HTTP_403_FORBIDDEN)
        elif (note_type == comm.REVIEWER_COMMENT and not
              acl.check_reviewer(request)):
            # Reviewer comment only for reviewers.
            return Response('Only reviewers can make reviewer comments',
                            status=status.HTTP_403_FORBIDDEN)

        # Create notes.
        thread, note = create_comm_note(
            thread.addon, thread.version, self.request.user,
            form.cleaned_data['body'], note_type=note_type)

        return Response(
            NoteSerializer(note, context={'request': request}).data,
            status=status.HTTP_201_CREATED)
开发者ID:rachelhathaway,项目名称:zamboni,代码行数:32,代码来源:views.py


示例17: create_note

    def create_note(self, action):
        """
        Permissions default to developers + reviewers + Mozilla contacts.
        For escalation/comment, exclude the developer from the conversation.
        """
        details = {'comments': self.data['comments'],
                   'reviewtype': self.review_type}
        if self.files:
            details['files'] = [f.id for f in self.files]

        # Commbadge (the future).
        perm_overrides = {
            comm.ESCALATION: {'developer': False},
            comm.REVIEWER_COMMENT: {'developer': False},
        }
        note_type = comm.ACTION_MAP(action.id)
        self.comm_thread, self.comm_note = create_comm_note(
            self.addon, self.version, self.request.amo_user,
            self.data['comments'], note_type=note_type,
            # Ignore switch so we don't have to re-migrate new notes.
            perms=perm_overrides.get(note_type), no_switch=True,
            attachments=self.attachment_formset)

        # ActivityLog (ye olde).
        amo.log(action, self.addon, self.version, user=self.user.get_profile(),
                created=datetime.now(), details=details,
                attachments=self.attachment_formset)
开发者ID:amitdash,项目名称:zamboni,代码行数:27,代码来源:utils.py


示例18: test_create_thread

    def test_create_thread(self):
        # Default permissions.
        thread, note = create_comm_note(
            self.app, self.app.current_version, self.user, "huehue", note_type=comm.APPROVAL
        )

        # Check Thread.
        eq_(thread.webapp, self.app)
        eq_(thread.version, self.app.current_version)
        expected = {
            "public": False,
            "developer": True,
            "reviewer": True,
            "senior_reviewer": True,
            "mozilla_contact": True,
            "staff": True,
        }
        for perm, has_perm in expected.items():
            eq_(getattr(thread, "read_permission_%s" % perm), has_perm, perm)

        # Check Note.
        eq_(note.thread, thread)
        eq_(note.author, self.user)
        eq_(note.body, "huehue")
        eq_(note.note_type, comm.APPROVAL)

        # Check CC.
        eq_(thread.thread_cc.count(), 2)
        assert thread.thread_cc.filter(user=self.contact).exists()
        assert thread.thread_cc.filter(user=self.user).exists()
开发者ID:shahbaz17,项目名称:zamboni,代码行数:30,代码来源:test_utils_.py


示例19: test_no_author

    def test_no_author(self):
        app = amo.tests.app_factory()
        thread, note = create_comm_note(app, app.current_version, None, 'hue')

        data = serializers.NoteSerializer(note, context={
            'request': amo.tests.req_factory_factory()
        }).data
        eq_(data['author_meta']['name'], 'Mozilla')
        eq_(data['author_meta']['gravatar_hash'], '')
开发者ID:JaredKerim-Mozilla,项目名称:zamboni,代码行数:9,代码来源:test_serializers.py


示例20: test_author

    def test_author(self):
        app = app_factory()
        user = user_factory(display_name='Bob')
        thread, note = create_comm_note(app, app.current_version, user, 'hue')

        data = serializers.NoteSerializer(note, context={
            'request': req_factory_factory()
        }).data
        eq_(data['author_meta']['name'], 'Bob')
        ok_(data['author_meta']['gravatar_hash'])
开发者ID:Fjoerfoks,项目名称:zamboni,代码行数:10,代码来源:test_serializers.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils_mail.save_from_email_reply函数代码示例发布时间:2022-05-27
下一篇:
Python serializers.CollectionSerializer类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap