def index_page():
    ctx = context(flask.request)
    all_apps = publisher_services.get_all_apps(ctx)
    return flask.render_template(u'publisher_index.jinja2',
                                 page_title=u'Index',
                                 all_apps=all_apps,
                                 ticket=flask.session.get(u'ticket', u''),
    )
def index_page():
    ctx = context(flask.request)
    all_apps = publisher_services.get_all_apps(ctx)
    return flask.render_template(
        u'publisher_index.jinja2',
        page_title=u'Index',
        all_apps=all_apps,
        ticket=flask.session.get(u'ticket', u''),
    )
def transit_page():
    ctx = context(flask.request)
    all_apps = publisher_services.get_all_apps(ctx)
    app = flask.request.args.get(u'app')
    version = flask.request.args.get(u'version')
    id = flask.request.args.get(u'id')
    return flask.render_template(u'publisher_products_transit.jinja2',
                                 page_title=u'Continue editing?',
                                 all_apps=all_apps,
                                 app=app,
                                 version=version,
                                 id=id,
                                 ticket=flask.session.get(u'ticket', u''),
    )
def transit_page():
    ctx = context(flask.request)
    all_apps = publisher_services.get_all_apps(ctx)
    app = flask.request.args.get(u'app')
    version = flask.request.args.get(u'version')
    id = flask.request.args.get(u'id')
    return flask.render_template(
        u'publisher_products_transit.jinja2',
        page_title=u'Continue editing?',
        all_apps=all_apps,
        app=app,
        version=version,
        id=id,
        ticket=flask.session.get(u'ticket', u''),
    )
def list_products_page():
    ctx = context(flask.request)
    if not ctx.has_borqs_id():
        return redirect_to_signin()

    app = flask.request.args.get(u'app')
    if not app:
        app = flask.session.get(u'current_app')
        if app:
            return flask.redirect(u'/publisher/products/list.html?app=' + app)
        else:
            return _redirect_to_index()

    all_apps = publisher_services.get_all_apps(ctx)
    if not all_apps:
        return _redirect_to_index()

    categories = publisher_services.get_app_categories(ctx, app)
    products = publisher_services.get_app_products(ctx, app)
    category_products = []
    for c in categories:
        c1 = {
            u'app': c[u'app_id'],
            u'category': c[u'category'],
            u'category_name': c[u'category_name'],
            u'products': []
        }
        for p in products:
            if p[u'category'] == c[u'category']:
                c1[u'products'].append(p)
        category_products.append(c1)

    flask.session[u'current_app'] = app
    resp = flask.render_template(
        u'publisher_product_list.jinja2',
        page_title=u'Edit product',
        app_id=app,
        all_apps=all_apps,
        category_products=category_products,
        ticket=flask.session.get(u'ticket', u''),
        nav_paths=[],
    )
    return resp
def list_products_page():
    ctx = context(flask.request)
    if not ctx.has_borqs_id():
        return redirect_to_signin()

    app = flask.request.args.get(u'app')
    if not app:
        app = flask.session.get(u'current_app')
        if app:
            return flask.redirect(u'/publisher/products/list.html?app=' + app)
        else:
            return _redirect_to_index()

    all_apps = publisher_services.get_all_apps(ctx)
    if not all_apps:
        return _redirect_to_index()

    categories = publisher_services.get_app_categories(ctx, app)
    products = publisher_services.get_app_products(ctx, app)
    category_products = []
    for c in categories:
        c1 = {
            u'app': c[u'app_id'],
            u'category': c[u'category'],
            u'category_name': c[u'category_name'],
            u'products': []
        }
        for p in products:
            if p[u'category'] == c[u'category']:
                c1[u'products'].append(p)
        category_products.append(c1)

    flask.session[u'current_app'] = app
    resp = flask.render_template(u'publisher_product_list.jinja2',
                                 page_title=u'Edit product',
                                 app_id=app,
                                 all_apps=all_apps,
                                 category_products=category_products,
                                 ticket=flask.session.get(u'ticket', u''),
                                 nav_paths=[],
    )
    return resp
def update_version_page():
    ctx = context(flask.request)
    if not ctx.has_borqs_id():
        return redirect_to_signin()

    all_apps = publisher_services.get_all_apps(ctx)
    if flask.request.method == u'POST':
        lang = flask.request.form.get(u'lang', u'default')
        ps = merge_request_params(flask.request)
        error_info = _validate_fields(u'update_version', ps)
        if not error_info:
            p = publisher_services.upsert_version_for_lang(
                ctx, ps[u'lang'], ps.get(u'id', None), ps[u'version'],
                ps[u'name'], ps[u'pricetag_id'], ps[u'description'],
                ps[u'update_change'], ps[u'min_app_vc'], ps[u'max_app_vc'],
                ps[u'supported_mod'], ps[u'author_name'], ps[u'author_email'],
                ps[u'logo_file'], ps[u'cover_file'], ps[u'screenshot1_file'],
                ps[u'screenshot2_file'], ps[u'screenshot3_file'],
                ps[u'screenshot4_file'], ps[u'screenshot5_file'], ps[u'file'])
            available_pricetags = publisher_services.get_available_pricetags_for_lang_by_pid(
                ctx, p[u'id'], lang)
            nav_paths = [
                (_find_app_name(all_apps, p[u'app_id']),
                 u'/publisher/products/list.html?app=%s' % p[u'app_id'])
            ]
            return flask.render_template(
                u'publisher_product_edit.jinja2',
                page_title=u'Update version',
                all_apps=all_apps,
                app_id=p[u'app_id'],
                category=p[u'category'],
                lang=lang,
                lang_name=get_locale_name(lang),
                available_pricetags=available_pricetags,
                id=p[u'id'],
                version=p[u'version'],
                name=p[u'name'],
                pricetag_id=p[u'pricetag_id'],
                description=p[u'description'],
                update_change=p[u'update_change'],
                min_app_vc=p[u'min_app_vc'],
                max_app_vc=p[u'max_app_vc'],
                supported_mod=p[u'supported_mod'],
                author_name=p[u'author_name'],
                author_email=p[u'author_email'],
                logo_image=p[u'logo_image'].get(u'url', u''),
                cover_image=p[u'cover_image'].get(u'url', u''),
                screenshot1_image=p[u'screenshot1_image'].get(u'url', u''),
                screenshot2_image=p[u'screenshot2_image'].get(u'url', u''),
                screenshot3_image=p[u'screenshot3_image'].get(u'url', u''),
                screenshot4_image=p[u'screenshot4_image'].get(u'url', u''),
                screenshot5_image=p[u'screenshot5_image'].get(u'url', u''),
                action_url=p.get(u'action_url', u''),
                errors=error_info,
                available_langs=AVAILABLE_LANGS_OPTIONS,
                ticket=flask.session.get(u'ticket', u''),
                nav_paths=nav_paths,
                mod=u'update_version')
        else:
            p = publisher_services.get_product_for_lang(
                ctx, ps[u'id'], ps[u'version'], lang)
            available_pricetags = publisher_services.get_available_pricetags_for_lang_by_pid(
                ctx, ps[u'id'], lang)
            nav_paths = [
                (_find_app_name(all_apps, p[u'app_id']),
                 u'/publisher/products/list.html?app=%s' % p[u'app_id'])
            ]
            return flask.render_template(
                u'publisher_product_edit.jinja2',
                page_title=u'Update version',
                all_apps=all_apps,
                app_id=p[u'app_id'],
                category=p[u'category'],
                lang=lang,
                lang_name=get_locale_name(lang),
                available_pricetags=available_pricetags,
                id=p[u'id'],
                version=p[u'version'],
                name=p[u'name'],
                pricetag_id=p[u'pricetag_id'],
                description=p[u'description'],
                update_change=p[u'update_change'],
                min_app_vc=p[u'min_app_vc'],
                max_app_vc=p[u'max_app_vc'],
                supported_mod=p[u'supported_mod'],
                author_name=p[u'author_name'],
                author_email=p[u'author_email'],
                logo_image=p[u'logo_image'].get(u'url', u''),
                cover_image=p[u'cover_image'].get(u'url', u''),
                screenshot1_image=p[u'screenshot1_image'].get(u'url', u''),
                screenshot2_image=p[u'screenshot2_image'].get(u'url', u''),
                screenshot3_image=p[u'screenshot3_image'].get(u'url', u''),
                screenshot4_image=p[u'screenshot4_image'].get(u'url', u''),
                screenshot5_image=p[u'screenshot5_image'].get(u'url', u''),
                action_url=p.get(u'action_url', u''),
                errors=error_info,
                available_langs=AVAILABLE_LANGS_OPTIONS,
                ticket=flask.session.get(u'ticket', u''),
                nav_paths=nav_paths,
                mod=u'update_version')
    else:
        lang = flask.request.args.get(u'lang', u'default')
        id = flask.request.args.get(u'id')
        version = flask.request.args.get(u'version')
        if not id:
            return error_page(u'Error', u'Missing param "id"')
        if not version:
            return error_page(u'Error', u'Missing param "version"')

        try:
            p = publisher_services.get_product_for_lang(ctx, id, version, lang)
        except:
            p = None
        if not p:
            return error_page(u'Error', u'Invalid product version')

        app, category = publisher_services.get_app_and_category_for_product(id)
        nav_paths = [(_find_app_name(all_apps, app),
                      u'/publisher/products/list.html?app=%s' % app)]
        available_pricetags = publisher_services.get_available_pricetags_for_lang(
            ctx, p[u'app_id'], p[u'category'], lang)
        return flask.render_template(
            u'publisher_product_edit.jinja2',
            page_title=u'Update version',
            all_apps=all_apps,
            app_id=app,
            category=category,
            lang=lang,
            lang_name=get_locale_name(lang),
            available_pricetags=available_pricetags,
            id=p[u'id'],
            version=p[u'version'],
            name=p[u'name'],
            pricetag_id=p[u'pricetag_id'],
            description=p[u'description'],
            update_change=p[u'update_change'],
            min_app_vc=p[u'min_app_vc'],
            max_app_vc=p[u'max_app_vc'],
            supported_mod=p[u'supported_mod'],
            author_name=p[u'author_name'],
            author_email=p[u'author_email'],
            logo_image=p[u'logo_image'].get(u'url', u''),
            cover_image=p[u'cover_image'].get(u'url', u''),
            screenshot1_image=p[u'screenshot1_image'].get(u'url', u''),
            screenshot2_image=p[u'screenshot2_image'].get(u'url', u''),
            screenshot3_image=p[u'screenshot3_image'].get(u'url', u''),
            screenshot4_image=p[u'screenshot4_image'].get(u'url', u''),
            screenshot5_image=p[u'screenshot5_image'].get(u'url', u''),
            action_url=p.get(u'action_url'),
            errors=[],
            available_langs=AVAILABLE_LANGS_OPTIONS,
            ticket=flask.session.get(u'ticket', u''),
            nav_paths=nav_paths,
            mod=u'update_version')
def new_product_page():
    ctx = context(flask.request)
    if not ctx.has_borqs_id():
        return redirect_to_signin()
    app = flask.request.args.get(u'app')
    category = flask.request.args.get(u'category')
    lang = u'default'
    if not app:
        return error_page(u'Error', u'Missing param app')
    if not category:
        return error_page(u'Error', u'Missing param category')

    all_apps = publisher_services.get_all_apps(ctx)
    available_pricetags = publisher_services.get_available_pricetags_for_lang(
        ctx, app, category, lang)
    nav_paths = [(_find_app_name(all_apps, app),
                  u'/publisher/products/list.html?app=%s' % app)]
    if flask.request.method == u'POST':
        ps = merge_request_params(flask.request)
        error_info = _validate_fields(u'new_product', ps)
        if not error_info:
            p = publisher_services.upsert_version_for_lang(
                ctx, ps[u'lang'], ps.get(u'id', None), ps[u'version'],
                ps[u'name'], ps[u'pricetag_id'], ps[u'description'],
                ps[u'update_change'], ps[u'min_app_vc'], ps[u'max_app_vc'],
                ps[u'supported_mod'], ps[u'author_name'], ps[u'author_email'],
                ps[u'logo_file'], ps[u'cover_file'], ps[u'screenshot1_file'],
                ps[u'screenshot2_file'], ps[u'screenshot3_file'],
                ps[u'screenshot4_file'], ps[u'screenshot5_file'], ps[u'file'])
            return flask.redirect(
                u'/publisher/products/transit.html?app=%s&version=%s&id=%s' %
                (p[u'app_id'], p[u'version'], p[u'id']))
        else:
            return flask.render_template(
                u'publisher_product_edit.jinja2',
                page_title=u'New product',
                all_apps=all_apps,
                app_id=app,
                category=category,
                lang=lang,
                lang_name=get_locale_name(lang),
                available_pricetags=available_pricetags,
                id=ps.get(u'id'),
                version=ps.get(u'version'),
                name=ps.get(u'name'),
                pricetag_id=ps.get(u'pricetag_id'),
                description=ps.get(u'description'),
                update_change=ps.get(u'update_change'),
                min_app_vc=ps.get(u'min_app_vc'),
                max_app_vc=ps.get(u'max_app_vc'),
                supported_mod=ps.get(u'supported_mod'),
                author_name=ps.get(u'author_name'),
                author_email=ps.get(u'author_email'),
                logo_image=u'',
                cover_image=u'',
                screenshot1_image=u'',
                screenshot2_image=u'',
                screenshot3_image=u'',
                screenshot4_image=u'',
                screenshot5_image=u'',
                action_url=u'',
                errors=error_info,
                ticket=flask.session.get(u'ticket', u''),
                mod=u'new_product',
                nav_paths=nav_paths,
            )
    else:
        return flask.render_template(
            u'publisher_product_edit.jinja2',
            page_title=u'New',
            all_apps=all_apps,
            app_id=app,
            category=category,
            lang=lang,
            lang_name=get_locale_name(lang),
            available_pricetags=available_pricetags,
            id=u'',
            version=u'',
            name=u'',
            pricetag_id=u'',
            description=u'',
            update_change=u'',
            min_app_vc=u'0',
            max_app_vc=u'',
            supported_mod=u'',
            author_name=u'',
            author_email=u'',
            logo_image=u'',
            cover_image=u'',
            screenshot1_image=u'',
            screenshot2_image=u'',
            screenshot3_image=u'',
            screenshot4_image=u'',
            screenshot5_image=u'',
            action_url=u'',
            ticket=flask.session.get(u'ticket', u''),
            errors=[],
            nav_paths=nav_paths,
            mod=u'new_product',
        )
 def process(req):
     ctx = context(req)
     return publisher_services.get_all_apps(ctx)
def update_version_page():
    ctx = context(flask.request)
    if not ctx.has_borqs_id():
        return redirect_to_signin()

    all_apps = publisher_services.get_all_apps(ctx)
    if flask.request.method == u'POST':
        lang = flask.request.form.get(u'lang', u'default')
        ps = merge_request_params(flask.request)
        error_info = _validate_fields(u'update_version', ps)
        if not error_info:
            p = publisher_services.upsert_version_for_lang(ctx, ps[u'lang'],
                                                           ps.get(u'id', None), ps[u'version'],
                                                           ps[u'name'], ps[u'pricetag_id'], ps[u'description'],
                                                           ps[u'update_change'],
                                                           ps[u'min_app_vc'], ps[u'max_app_vc'], ps[u'supported_mod'],
                                                           ps[u'author_name'], ps[u'author_email'],
                                                           ps[u'logo_file'], ps[u'cover_file'], ps[u'screenshot1_file'],
                                                           ps[u'screenshot2_file'], ps[u'screenshot3_file'],
                                                           ps[u'screenshot4_file'], ps[u'screenshot5_file'],
                                                           ps[u'file']
            )
            available_pricetags = publisher_services.get_available_pricetags_for_lang_by_pid(ctx, p[u'id'], lang)
            nav_paths = [
                (_find_app_name(all_apps, p[u'app_id']), u'/publisher/products/list.html?app=%s' % p[u'app_id'])]
            return flask.render_template(u'publisher_product_edit.jinja2',
                                         page_title=u'Update version',
                                         all_apps=all_apps,
                                         app_id=p[u'app_id'],
                                         category=p[u'category'],
                                         lang=lang,
                                         lang_name=get_locale_name(lang),
                                         available_pricetags=available_pricetags,
                                         id=p[u'id'],
                                         version=p[u'version'],
                                         name=p[u'name'],
                                         pricetag_id=p[u'pricetag_id'],
                                         description=p[u'description'],
                                         update_change=p[u'update_change'],
                                         min_app_vc=p[u'min_app_vc'],
                                         max_app_vc=p[u'max_app_vc'],
                                         supported_mod=p[u'supported_mod'],
                                         author_name=p[u'author_name'],
                                         author_email=p[u'author_email'],
                                         logo_image=p[u'logo_image'].get(u'url', u''),
                                         cover_image=p[u'cover_image'].get(u'url', u''),
                                         screenshot1_image=p[u'screenshot1_image'].get(u'url', u''),
                                         screenshot2_image=p[u'screenshot2_image'].get(u'url', u''),
                                         screenshot3_image=p[u'screenshot3_image'].get(u'url', u''),
                                         screenshot4_image=p[u'screenshot4_image'].get(u'url', u''),
                                         screenshot5_image=p[u'screenshot5_image'].get(u'url', u''),
                                         action_url=p.get(u'action_url', u''),
                                         errors=error_info,
                                         available_langs=AVAILABLE_LANGS_OPTIONS,
                                         ticket=flask.session.get(u'ticket', u''),
                                         nav_paths=nav_paths,
                                         mod=u'update_version'
            )
        else:
            p = publisher_services.get_product_for_lang(ctx, ps[u'id'], ps[u'version'], lang)
            available_pricetags = publisher_services.get_available_pricetags_for_lang_by_pid(ctx, ps[u'id'], lang)
            nav_paths = [
                (_find_app_name(all_apps, p[u'app_id']), u'/publisher/products/list.html?app=%s' % p[u'app_id'])]
            return flask.render_template(u'publisher_product_edit.jinja2',
                                         page_title=u'Update version',
                                         all_apps=all_apps,
                                         app_id=p[u'app_id'],
                                         category=p[u'category'],
                                         lang=lang,
                                         lang_name=get_locale_name(lang),
                                         available_pricetags=available_pricetags,
                                         id=p[u'id'],
                                         version=p[u'version'],
                                         name=p[u'name'],
                                         pricetag_id=p[u'pricetag_id'],
                                         description=p[u'description'],
                                         update_change=p[u'update_change'],
                                         min_app_vc=p[u'min_app_vc'],
                                         max_app_vc=p[u'max_app_vc'],
                                         supported_mod=p[u'supported_mod'],
                                         author_name=p[u'author_name'],
                                         author_email=p[u'author_email'],
                                         logo_image=p[u'logo_image'].get(u'url', u''),
                                         cover_image=p[u'cover_image'].get(u'url', u''),
                                         screenshot1_image=p[u'screenshot1_image'].get(u'url', u''),
                                         screenshot2_image=p[u'screenshot2_image'].get(u'url', u''),
                                         screenshot3_image=p[u'screenshot3_image'].get(u'url', u''),
                                         screenshot4_image=p[u'screenshot4_image'].get(u'url', u''),
                                         screenshot5_image=p[u'screenshot5_image'].get(u'url', u''),
                                         action_url=p.get(u'action_url', u''),
                                         errors=error_info,
                                         available_langs=AVAILABLE_LANGS_OPTIONS,
                                         ticket=flask.session.get(u'ticket', u''),
                                         nav_paths=nav_paths,
                                         mod=u'update_version'
            )
    else:
        lang = flask.request.args.get(u'lang', u'default')
        id = flask.request.args.get(u'id')
        version = flask.request.args.get(u'version')
        if not id:
            return error_page(u'Error', u'Missing param "id"')
        if not version:
            return error_page(u'Error', u'Missing param "version"')

        try:
            p = publisher_services.get_product_for_lang(ctx, id, version, lang)
        except:
            p = None
        if not p:
            return error_page(u'Error', u'Invalid product version')

        app, category = publisher_services.get_app_and_category_for_product(id)
        nav_paths = [(_find_app_name(all_apps, app), u'/publisher/products/list.html?app=%s' % app)]
        available_pricetags = publisher_services.get_available_pricetags_for_lang(ctx, p[u'app_id'], p[u'category'],
                                                                                  lang)
        return flask.render_template(u'publisher_product_edit.jinja2',
                                     page_title=u'Update version',
                                     all_apps=all_apps,
                                     app_id=app,
                                     category=category,
                                     lang=lang,
                                     lang_name=get_locale_name(lang),
                                     available_pricetags=available_pricetags,
                                     id=p[u'id'],
                                     version=p[u'version'],
                                     name=p[u'name'],
                                     pricetag_id=p[u'pricetag_id'],
                                     description=p[u'description'],
                                     update_change=p[u'update_change'],
                                     min_app_vc=p[u'min_app_vc'],
                                     max_app_vc=p[u'max_app_vc'],
                                     supported_mod=p[u'supported_mod'],
                                     author_name=p[u'author_name'],
                                     author_email=p[u'author_email'],
                                     logo_image=p[u'logo_image'].get(u'url', u''),
                                     cover_image=p[u'cover_image'].get(u'url', u''),
                                     screenshot1_image=p[u'screenshot1_image'].get(u'url', u''),
                                     screenshot2_image=p[u'screenshot2_image'].get(u'url', u''),
                                     screenshot3_image=p[u'screenshot3_image'].get(u'url', u''),
                                     screenshot4_image=p[u'screenshot4_image'].get(u'url', u''),
                                     screenshot5_image=p[u'screenshot5_image'].get(u'url', u''),
                                     action_url=p.get(u'action_url'),
                                     errors=[],
                                     available_langs=AVAILABLE_LANGS_OPTIONS,
                                     ticket=flask.session.get(u'ticket', u''),
                                     nav_paths=nav_paths,
                                     mod=u'update_version'
        )
def new_product_page():
    ctx = context(flask.request)
    if not ctx.has_borqs_id():
        return redirect_to_signin()
    app = flask.request.args.get(u'app')
    category = flask.request.args.get(u'category')
    lang = u'default'
    if not app:
        return error_page(u'Error', u'Missing param app')
    if not category:
        return error_page(u'Error', u'Missing param category')

    all_apps = publisher_services.get_all_apps(ctx)
    available_pricetags = publisher_services.get_available_pricetags_for_lang(ctx, app, category, lang)
    nav_paths = [(_find_app_name(all_apps, app), u'/publisher/products/list.html?app=%s' % app)]
    if flask.request.method == u'POST':
        ps = merge_request_params(flask.request)
        error_info = _validate_fields(u'new_product', ps)
        if not error_info:
            p = publisher_services.upsert_version_for_lang(ctx, ps[u'lang'],
                                                           ps.get(u'id', None), ps[u'version'],
                                                           ps[u'name'], ps[u'pricetag_id'], ps[u'description'],
                                                           ps[u'update_change'],
                                                           ps[u'min_app_vc'], ps[u'max_app_vc'], ps[u'supported_mod'],
                                                           ps[u'author_name'], ps[u'author_email'],
                                                           ps[u'logo_file'], ps[u'cover_file'], ps[u'screenshot1_file'],
                                                           ps[u'screenshot2_file'], ps[u'screenshot3_file'],
                                                           ps[u'screenshot4_file'], ps[u'screenshot5_file'],
                                                           ps[u'file']
            )
            return flask.redirect(
                u'/publisher/products/transit.html?app=%s&version=%s&id=%s' % (p[u'app_id'], p[u'version'], p[u'id']))
        else:
            return flask.render_template(u'publisher_product_edit.jinja2',
                                         page_title=u'New product',
                                         all_apps=all_apps,
                                         app_id=app,
                                         category=category,
                                         lang=lang,
                                         lang_name=get_locale_name(lang),
                                         available_pricetags=available_pricetags,
                                         id=ps.get(u'id'),
                                         version=ps.get(u'version'),
                                         name=ps.get(u'name'),
                                         pricetag_id=ps.get(u'pricetag_id'),
                                         description=ps.get(u'description'),
                                         update_change=ps.get(u'update_change'),
                                         min_app_vc=ps.get(u'min_app_vc'),
                                         max_app_vc=ps.get(u'max_app_vc'),
                                         supported_mod=ps.get(u'supported_mod'),
                                         author_name=ps.get(u'author_name'),
                                         author_email=ps.get(u'author_email'),
                                         logo_image=u'',
                                         cover_image=u'',
                                         screenshot1_image=u'',
                                         screenshot2_image=u'',
                                         screenshot3_image=u'',
                                         screenshot4_image=u'',
                                         screenshot5_image=u'',
                                         action_url=u'',
                                         errors=error_info,
                                         ticket=flask.session.get(u'ticket', u''),
                                         mod=u'new_product',
                                         nav_paths=nav_paths,
            )
    else:
        return flask.render_template(u'publisher_product_edit.jinja2',
                                     page_title=u'New',
                                     all_apps=all_apps,
                                     app_id=app,
                                     category=category,
                                     lang=lang,
                                     lang_name=get_locale_name(lang),
                                     available_pricetags=available_pricetags,
                                     id=u'',
                                     version=u'',
                                     name=u'',
                                     pricetag_id=u'',
                                     description=u'',
                                     update_change=u'',
                                     min_app_vc=u'0',
                                     max_app_vc=u'',
                                     supported_mod=u'',
                                     author_name=u'',
                                     author_email=u'',
                                     logo_image=u'',
                                     cover_image=u'',
                                     screenshot1_image=u'',
                                     screenshot2_image=u'',
                                     screenshot3_image=u'',
                                     screenshot4_image=u'',
                                     screenshot5_image=u'',
                                     action_url=u'',
                                     ticket=flask.session.get(u'ticket', u''),
                                     errors=[],
                                     nav_paths=nav_paths,
                                     mod=u'new_product',
        )
 def process(req):
     ctx = context(req)
     return publisher_services.get_all_apps(ctx)