Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
fix UnicodeDecodeError for trap duplicate (bug 747062)
Browse files Browse the repository at this point in the history
  • Loading branch information
cvan committed Apr 19, 2012
1 parent b5a9898 commit ef2a3a3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
34 changes: 17 additions & 17 deletions mkt/developers/forms.py
Expand Up @@ -191,29 +191,29 @@ def trap_duplicate(request, manifest_url):
error_url = app.get_dev_url()
msg = None
if app.status == amo.STATUS_PUBLIC:
msg = _('Oops, looks like you already submitted that manifest '
'for %s, which is currently public. '
'<a href="%s">Edit app</a>')
msg = _(u'Oops, looks like you already submitted that manifest '
'for %s, which is currently public. '
'<a href="%s">Edit app</a>')
elif app.status == amo.STATUS_PENDING:
msg = _('Oops, looks like you already submitted that manifest '
'for %s, which is currently pending. '
'<a href="%s">Edit app</a>')
msg = _(u'Oops, looks like you already submitted that manifest '
'for %s, which is currently pending. '
'<a href="%s">Edit app</a>')
elif app.status == amo.STATUS_NULL:
msg = _('Oops, looks like you already submitted that manifest '
'for %s, which is currently incomplete. '
'<a href="%s">Resume app</a>')
msg = _(u'Oops, looks like you already submitted that manifest '
'for %s, which is currently incomplete. '
'<a href="%s">Resume app</a>')
elif app.status == amo.STATUS_REJECTED:
msg = _('Oops, looks like you already submitted that manifest '
'for %s, which is currently rejected. '
msg = _(u'Oops, looks like you already submitted that manifest '
'for %s, which is currently rejected. '
'<a href="%s">Edit app</a>')
elif app.status == amo.STATUS_DISABLED:
msg = _('Oops, looks like you already submitted that manifest '
'for %s, which is currently disabled by Mozilla. '
'<a href="%s">Edit app</a>')
msg = _(u'Oops, looks like you already submitted that manifest '
'for %s, which is currently disabled by Mozilla. '
'<a href="%s">Edit app</a>')
elif app.disabled_by_user:
msg = _('Oops, looks like you already submitted that manifest '
'for %s, which is currently disabled. '
'<a href="%s">Edit app</a>')
msg = _(u'Oops, looks like you already submitted that manifest '
'for %s, which is currently disabled. '
'<a href="%s">Edit app</a>')
if msg:
return msg % (app.name, error_url)

Expand Down
11 changes: 5 additions & 6 deletions mkt/submit/tests/test_views.py
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import json
import os

Expand Down Expand Up @@ -231,10 +232,8 @@ def test_hint_for_same_manifest(self):
r = self.client.post(reverse('mkt.developers.upload_manifest'),
dict(manifest=self.manifest_url))
data = json.loads(r.content)
eq_(data['validation']['messages'][0]['message'],
'Oops, looks like you already submitted that manifest for '
'MozillaBall, which is currently incomplete. '
'<a href="/en-US/developers/app/mozillaball/edit">Resume app</a>')
assert 'Oops' in data['validation']['messages'][0]['message'], (
'Expected oops')

def test_no_hint_for_same_manifest_different_author(self):
waffle.models.Switch.objects.create(name='webapps-unique-by-domain',
Expand All @@ -257,9 +256,9 @@ def test_app_from_uploaded_manifest(self):
addon = self.post_addon()
eq_(addon.type, amo.ADDON_WEBAPP)
eq_(addon.guid, None)
eq_(unicode(addon.name), 'MozillaBall')
eq_(unicode(addon.name), u'MozillaBall')
eq_(addon.slug, 'app-%s' % addon.id)
eq_(addon.app_slug, 'mozillaball')
eq_(addon.app_slug, u'mozillaball-ょ')
eq_(addon.summary, u'Exciting Open Web development action!')
eq_(Translation.objects.get(id=addon.summary.id, locale='it'),
u'Azione aperta emozionante di sviluppo di fotoricettore!')
Expand Down
2 changes: 1 addition & 1 deletion mkt/submit/tests/webapps/mozball.webapp
@@ -1,6 +1,6 @@
{
"version": "1.0",
"name": "MozillaBall",
"name": "MozillaBall",
"description": "Exciting Open Web development action!",
"icons": {
"16": "/img/icon-16.png",
Expand Down

0 comments on commit ef2a3a3

Please sign in to comment.