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

Python mkt.log函数代码示例

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

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



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

示例1: delete

    def delete(self):
        log.info(u'Version deleted: %r (%s)' % (self, self.id))
        mkt.log(mkt.LOG.DELETE_VERSION, self.webapp, str(self.version))

        models.signals.pre_delete.send(sender=Version, instance=self)

        was_current = False
        if self == self.webapp.current_version:
            was_current = True

        self.update(deleted=True)

        # Set file status to disabled.
        f = self.all_files[0]
        f.update(status=mkt.STATUS_DISABLED, _signal=False)
        f.hide_disabled_file()

        # If version deleted was the current version and there now exists
        # another current_version, we need to call some extra methods to update
        # various bits for packaged apps.
        if was_current and self.webapp.current_version:
            self.webapp.update_name_from_package_manifest()
            self.webapp.update_supported_locales()

        if self.webapp.is_packaged:
            # Unlink signed packages if packaged app.
            public_storage.delete(f.signed_file_path)
            log.info(u'Unlinked file: %s' % f.signed_file_path)
            private_storage.delete(f.signed_reviewer_file_path)
            log.info(u'Unlinked file: %s' % f.signed_reviewer_file_path)

        models.signals.post_delete.send(sender=Version, instance=self)
开发者ID:shahbaz17,项目名称:zamboni,代码行数:32,代码来源:models.py


示例2: test_rejected

    def test_rejected(self):
        comments = "oh no you di'nt!!"
        mkt.set_user(UserProfile.objects.get(email='[email protected]'))
        mkt.log(mkt.LOG.REJECT_VERSION, self.webapp,
                self.webapp.current_version, user_id=999,
                details={'comments': comments, 'reviewtype': 'pending'})
        self.webapp.update(status=mkt.STATUS_REJECTED)
        make_rated(self.webapp)
        (self.webapp.versions.latest()
                             .all_files[0].update(status=mkt.STATUS_REJECTED))

        r = self.client.get(self.url)
        eq_(r.status_code, 200)
        doc = pq(r.content)('#version-status')
        eq_(doc('.status-rejected').length, 1)
        eq_(doc('#rejection').length, 1)
        eq_(doc('#rejection blockquote').text(), comments)

        my_reply = 'fixed just for u, brah'
        r = self.client.post(self.url, {'notes': my_reply,
                                        'resubmit-app': ''})
        self.assert3xx(r, self.url, 302)

        webapp = self.get_webapp()
        eq_(webapp.status, mkt.STATUS_PENDING,
            'Reapplied apps should get marked as pending')
        eq_(webapp.versions.latest().all_files[0].status, mkt.STATUS_PENDING,
            'Files for reapplied apps should get marked as pending')
        action = mkt.LOG.WEBAPP_RESUBMIT
        assert AppLog.objects.filter(
            addon=webapp, activity_log__action=action.id).exists(), (
                "Didn't find `%s` action in logs." % action.short)
开发者ID:pkdevboxy,项目名称:zamboni,代码行数:32,代码来源:test_views_versions.py


示例3: test_empty_comment

 def test_empty_comment(self):
     mkt.log(mkt.LOG.REQUEST_VERSION, self.app, self.version,
             user=self.user, details={})
     call_command('migrate_activity_log')
     note = CommunicationNote.objects.get()
     eq_(note.thread.addon, self.app)
     eq_(note.body, '')
开发者ID:atiqueahmedziad,项目名称:zamboni,代码行数:7,代码来源:test_commands.py


示例4: 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


示例5: save

 def save(self):
     for form in self.forms:
         if form.cleaned_data:
             mark_read = form.cleaned_data.get('action', False)
             inst = form.instance
             if mark_read:
                 for report in inst.abuse_reports.all().filter(read=False):
                     report.read = True
                     report.save()
                     if report.addon:
                         mkt.log(mkt.LOG.APP_ABUSE_MARKREAD, report.addon,
                                 report,
                                 details=dict(
                                     body=unicode(report.message),
                                     addon_id=report.addon.id,
                                     addon_title=unicode(
                                         report.addon.name)))
                     elif report.user:
                         # Not possible on Marketplace currently.
                         pass
                     elif report.website:
                         mkt.log(mkt.LOG.WEBSITE_ABUSE_MARKREAD,
                                 report.website, report,
                                 details=dict(
                                     body=unicode(report.message),
                                     website_id=report.website.id,
                                     website_title=unicode(
                                         report.website.name)))
开发者ID:atiqueahmedziad,项目名称:zamboni,代码行数:28,代码来源:forms.py


示例6: perform_create

 def perform_create(self, serializer):
     serializer.save()
     app = serializer.instance.addon
     mkt.log(mkt.LOG.ADD_REVIEW, app, serializer.instance)
     log.debug('[Review:%s] Created by user %s ' %
               (serializer.instance.pk, self.request.user.id))
     record_action('new-review', self.request, {'app-id': app.id})
开发者ID:mathjazz,项目名称:zamboni,代码行数:7,代码来源:views.py


示例7: 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


示例8: test_display

 def test_display(self):
     mkt.log(mkt.LOG.PURCHASE_ADDON, self.app, user=self.user)
     mkt.log(mkt.LOG.ADMIN_USER_EDITED, self.user, 'spite', user=self.user)
     self.login(self.reviewer)
     res = self.client.get(self.url)
     eq_(res.status_code, 200)
     doc = pq(res.content)
     assert 'purchased' in doc('li.item').eq(0).text()
     assert 'edited' in doc('li.item').eq(1).text()
开发者ID:jamesthechamp,项目名称:zamboni,代码行数:9,代码来源:test_views.py


示例9: record

def record(request, app):
    mkt.log(mkt.LOG.INSTALL_WEBAPP, app)
    domain = app.domain_from_url(app.origin, allow_none=True)
    record_action('install', request, {
        'app-domain': domain,
        'app-id': app.pk,
        'region': request.REGION.slug,
        'anonymous': request.user.is_anonymous(),
    })
开发者ID:shahbaz17,项目名称:zamboni,代码行数:9,代码来源:utils.py


示例10: destroy

 def destroy(self, request, *args, **kwargs):
     obj = self.get_object()
     mkt.log(mkt.LOG.DELETE_REVIEW, obj.addon, obj,
             details=dict(title=unicode(obj.title),
                          body=unicode(obj.body),
                          addon_id=obj.addon.id,
                          addon_title=unicode(obj.addon.name)))
     log.debug('[Review:%s] Deleted by %s' %
               (obj.pk, self.request.user.id))
     return super(RatingViewSet, self).destroy(request, *args, **kwargs)
开发者ID:Witia1,项目名称:zamboni,代码行数:10,代码来源:views.py


示例11: process_iarc_changes

def process_iarc_changes(date=None):
    """
    Queries IARC for recent changes in the past 24 hours (or date provided).

    If date provided use it. It should be in the form YYYY-MM-DD.

    NOTE: Get_Rating_Changes only sends the diff of the changes
    by rating body. They only send data for the ratings bodies that
    changed.
    """
    if not date:
        date = datetime.date.today()
    else:
        date = datetime.datetime.strptime(date, '%Y-%m-%d').date()

    client = lib.iarc.client.get_iarc_client('services')
    xml = lib.iarc.utils.render_xml('get_rating_changes.xml', {
        'date_from': date - datetime.timedelta(days=1),
        'date_to': date,
    })
    resp = client.Get_Rating_Changes(XMLString=xml)
    data = lib.iarc.utils.IARC_XML_Parser().parse_string(resp)

    for row in data.get('rows', []):
        iarc_id = row.get('submission_id')
        if not iarc_id:
            log.debug('IARC changes contained no submission ID: %s' % row)
            continue

        try:
            app = Webapp.objects.get(iarc_info__submission_id=iarc_id)
        except Webapp.DoesNotExist:
            log.debug('Could not find app associated with IARC submission ID: '
                      '%s' % iarc_id)
            continue

        try:
            # Fetch and save all IARC info.
            refresh_iarc_ratings([app.id])

            # Flag for rereview if it changed to adult.
            ratings_body = row.get('rating_system')
            rating = RATINGS[ratings_body.id].get(row['new_rating'])
            _flag_rereview_adult(app, ratings_body, rating)

            # Log change reason.
            reason = row.get('change_reason')
            mkt.log(mkt.LOG.CONTENT_RATING_CHANGED, app,
                    details={'comments': '%s:%s, %s' %
                             (ratings_body.name, rating.name, reason)})

        except Exception as e:
            # Any exceptions we catch, log, and keep going.
            log.debug('Exception: %s' % e)
            continue
开发者ID:shahbaz17,项目名称:zamboni,代码行数:55,代码来源:cron.py


示例12: _record

def _record(request, addon):
    logged = request.user.is_authenticated()
    premium = addon.is_premium()

    # Require login for premium.
    if not logged and premium:
        return http.HttpResponseRedirect(reverse('users.login'))

    ctx = {'addon': addon.pk}

    # Don't generate receipts if we're allowing logged-out install.
    if logged:
        is_dev = request.check_ownership(addon, require_owner=False,
                                         ignore_disabled=True, admin=False)
        is_reviewer = acl.check_reviewer(request)
        if (not addon.is_public() and not (is_reviewer or is_dev)):
            raise http.Http404

        if (premium and
                not addon.has_purchased(request.user) and
                not is_reviewer and not is_dev):
            raise PermissionDenied

        # If you are reviewer, you get a user receipt. Use the reviewer tools
        # to get a reviewer receipt. App developers still get their special
        # receipt.
        install = (apps.INSTALL_TYPE_DEVELOPER if is_dev
                   else apps.INSTALL_TYPE_USER)
        # Log the install.
        installed, c = Installed.objects.get_or_create(
            addon=addon, user=request.user, install_type=install)

        # Get a suitable uuid for this receipt.
        uuid = get_uuid(addon, request.user)

        error = ''
        receipt_cef.log(request, addon, 'sign', 'Receipt requested')
        try:
            receipt = create_receipt(addon, request.user, uuid)
        except SigningError:
            error = _('There was a problem installing the app.')

        ctx.update(receipt=receipt, error=error)
    else:
        if not addon.is_public():
            raise http.Http404

    mkt.log(mkt.LOG.INSTALL_ADDON, addon)
    record_action('install', request, {
        'app-domain': addon.domain_from_url(addon.origin, allow_none=True),
        'app-id': addon.pk,
        'anonymous': request.user.is_anonymous(),
    })

    return ctx
开发者ID:waseem18,项目名称:zamboni,代码行数:55,代码来源:views.py


示例13: save

 def save(self):
     version = self.product.versions.latest()
     notes = self.cleaned_data["notes"]
     if notes:
         mkt.log(mkt.LOG.WEBAPP_RESUBMIT, self.product, version, details={"comments": notes})
     else:
         mkt.log(mkt.LOG.WEBAPP_RESUBMIT, self.product, version)
     # Mark app and file as pending again.
     self.product.update(status=mkt.WEBAPPS_UNREVIEWED_STATUS)
     version.all_files[0].update(status=mkt.WEBAPPS_UNREVIEWED_STATUS)
     return version
开发者ID:Hitechverma,项目名称:zamboni,代码行数:11,代码来源:forms.py


示例14: post_save

 def post_save(self, obj, created=False):
     app = obj.addon
     if created:
         mkt.log(mkt.LOG.ADD_REVIEW, app, obj)
         log.debug('[Review:%s] Created by user %s ' %
                   (obj.pk, self.request.user.id))
         record_action('new-review', self.request, {'app-id': app.id})
     else:
         mkt.log(mkt.LOG.EDIT_REVIEW, app, obj)
         log.debug('[Review:%s] Edited by %s' %
                   (obj.pk, self.request.user.id))
开发者ID:Witia1,项目名称:zamboni,代码行数:11,代码来源:views.py


示例15: 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


示例16: test_logs

    def test_logs(self):
        # Admin log.
        mkt.log(mkt.LOG.COMMENT_VERSION, self.app, self.app.current_version,
                user=self.user)
        # Regular log.
        mkt.log(mkt.LOG.MANIFEST_UPDATED, self.app, user=self.user)

        self.login(self.reviewer)
        res = self.client.get(self.url)
        doc = pq(res.content)
        assert 'manifest updated' in doc('li.item').eq(0).text()
        assert 'Comment on' in doc('li.item').eq(1).text()
开发者ID:jamesthechamp,项目名称:zamboni,代码行数:12,代码来源:test_views.py


示例17: 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


示例18: record

def record(request, app):
    mkt.log(mkt.LOG.INSTALL_ADDON, app)
    domain = app.domain_from_url(app.origin, allow_none=True)
    record_action(
        "install",
        request,
        {
            "app-domain": domain,
            "app-id": app.pk,
            "region": request.REGION.slug,
            "anonymous": request.user.is_anonymous(),
        },
    )
开发者ID:ujdhesa,项目名称:zamboni,代码行数:13,代码来源:utils.py


示例19: test_get_or_create

    def test_get_or_create(self):
        mkt.log(mkt.LOG.REQUEST_VERSION, self.app, self.version,
                user=self.user, details={'comments': 'something'})
        self._assert(comm.NO_ACTION)
        call_command('migrate_activity_log')
        call_command('migrate_activity_log')
        eq_(CommunicationNote.objects.count(), 1)

        mkt.log(mkt.LOG.REQUEST_VERSION, self.app, self.version,
                user=self.user, details={'comments': 'somethingNEW'})
        call_command('migrate_activity_log')
        eq_(CommunicationNote.objects.count(), 2)

        eq_(CommunicationThread.objects.count(), 1)
开发者ID:atiqueahmedziad,项目名称:zamboni,代码行数:14,代码来源:test_commands.py


示例20: user_delete

def user_delete(request, user_id):
    delete_form = DeleteUserForm(request.POST)
    if not delete_form.is_valid():
        messages.error(request, delete_form.errors)
        return HttpResponseRedirect(reverse('lookup.user_summary',
                                            args=[user_id]))

    user = get_object_or_404(UserProfile, pk=user_id)
    user.deleted = True
    user.save()  # Must call the save function to delete user.
    mkt.log(mkt.LOG.DELETE_USER_LOOKUP, user,
            details={'reason': delete_form.cleaned_data['delete_reason']},
            user=request.user)

    return HttpResponseRedirect(reverse('lookup.user_summary', args=[user_id]))
开发者ID:waseem18,项目名称:zamboni,代码行数:15,代码来源:views.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python mkt.set_user函数代码示例发布时间:2022-05-27
下一篇:
Python mkl.set_num_threads函数代码示例发布时间: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