def handle_builtin(self, license): import amo # License.builtin is off by one! data = amo.LICENSE_IDS[license.builtin - 1] license.url = data.url license.on_form = data.on_form if data.icons: license.icons = ' '.join(data.icons) license.some_rights = bool(data.linktext) if data.shortname: license.text = license_text(data.shortname) # Gather all the translated names. activate('en-us') license.name = en_name = unicode(data.name) names = {} for lang in settings.AMO_LANGUAGES: activate(lang) trans = ugettext(en_name) if trans and trans != en_name: names[lang] = trans activate('en-us') license.name = names license.save()
def text(cls): return cls.shortname and license_text(cls.shortname) or None