本文整理汇总了Python中mkt.log函数的典型用法代码示例。如果您正苦于以下问题:Python log函数的具体用法?Python log怎么用?Python log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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)
示例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, '')
示例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)
示例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)))
示例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})
示例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})
示例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()
示例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(),
})
示例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)
示例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
示例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
示例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
示例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))
示例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))