def approve_files(files_with_review_type): """Approve the files (and sign them). A file will be fully approved if: - it's waiting for a full review - it's preliminary reviewed, and its addon is waiting for a full review A file will be prelim approved if: - it's waiting for a prelim review """ for file_, review_type in files_with_review_type: version = file_.version addon = version.addon helper = ReviewHelper(request=None, addon=addon, version=file_.version) # Provide the file to review/sign to the helper. helper.set_data({'addon_files': [file_], 'comments': u'bulk approval'}) if review_type == 'full': # Already fully reviewed, or waiting for a full review. helper.handler.process_public() log.info(u'File %s (addon %s) fully reviewed', file_.pk, addon.pk) elif review_type == 'prelim': # Already prelim reviewed, or waiting for a prelim review. helper.handler.process_preliminary() log.info(u'File %s (addon %s) prelim reviewed', file_.pk, addon.pk) else: log.info(u'File %s (addon %s) not reviewed: ' u'addon status: %s, file status: %s', file_.pk, addon.pk, addon.status, file_.status)
def get_review_form(data, request=None, addon=None, version=None): helper = ReviewHelper(request=request, addon=addon, version=version) form = { ReviewAddon: ReviewAddonForm, ReviewFiles: ReviewFileForm }[helper.handler.__class__] return form(data, helper=helper)
def get_review_form(data, request=None, addon=None, version=None): helper = ReviewHelper(request=request, addon=addon, version=version) FormClass = ReviewAddonForm if addon and addon.type == amo.ADDON_WEBAPP: FormClass = ReviewAppForm form = { ReviewAddon: FormClass, ReviewFiles: ReviewFileForm }[helper.handler.__class__] return form(data, helper=helper)
def get_review_form(data, request=None, addon=None, version=None): helper = ReviewHelper(request=request, addon=addon, version=version) return ReviewAddonForm(data, helper=helper)