'Handle creating/editing the LangPack instance and saving it to db,
as well as file operations, from a FileUpload instance. Can throw
a ValidationError or SigningError, so should always be called within a
try/except.'

@classmethod
def from_upload(cls, upload, instance=None):

    parser = LanguagePackParser(instance=instance)
    data = parser.parse(upload)
    allowed_fields = ('language', 'fxos_version', 'version')
    data = dict(((k, v) for (k, v) in data.items() if (k in allowed_fields)))
    data['manifest'] = json.dumps(parser.get_json_data(upload))
    if instance:
        instance.__dict__.update(**data)
    else:
        instance = cls(**data)
    cls._meta.get_field('language').validate(instance.language, instance)
    instance.handle_file_operations(upload)
    instance.save()
    instance.get_minifest_contents(force=True)
    return instance
