Ejemplo n.º 1
0
 def delete(self, request, app_label=None, actor=None, pk=None):
     data = http.QueryDict(request.body)
     ar = action_request(
         app_label, actor, request, data, False,
         renderer=settings.SITE.kernel.extjs_renderer)
     ar.set_selected_pks(pk)
     return settings.SITE.kernel.run_action(ar)
Ejemplo n.º 2
0
 def delete(self, request, app_label=None, actor=None, pk=None):
     data = http.QueryDict(request.body)
     ar = action_request(
         app_label, actor, request, data, False,
         renderer=settings.SITE.kernel.extjs_renderer)
     ar.set_selected_pks(pk)
     return settings.SITE.kernel.run_action(ar)
Ejemplo n.º 3
0
 def put(self, request, app_label=None, actor=None, pk=None):
     data = http.QueryDict(request.body)  # raw_post_data before Django 1.4
     # print("20180712 ApiElement.put() %s" % data)
     ar = action_request(
         app_label, actor, request, data, False,
         renderer=settings.SITE.kernel.extjs_renderer)
     ar.set_selected_pks(pk)
     return settings.SITE.kernel.run_action(ar)
Ejemplo n.º 4
0
 def put(self, request, app_label=None, actor=None, pk=None):
     data = http.QueryDict(request.body)  # raw_post_data before Django 1.4
     # logger.info("20150130 %s", data)
     ar = action_request(
         app_label, actor, request, data, False,
         renderer=settings.SITE.kernel.extjs_renderer)
     ar.set_selected_pks(pk)
     return settings.SITE.kernel.run_action(ar)
Ejemplo n.º 5
0
 def put(self, request, app_label=None, actor=None, pk=None):
     data = http.QueryDict(request.body)  # raw_post_data before Django 1.4
     # logger.info("20150130 %s", data)
     ar = action_request(
         app_label, actor, request, data, False,
         renderer=settings.SITE.kernel.extjs_renderer)
     ar.set_selected_pks(pk)
     return settings.SITE.kernel.run_action(ar)
Ejemplo n.º 6
0
 def put(self, request, app_label=None, actor=None, pk=None):
     data = http.QueryDict(request.body)  # raw_post_data before Django 1.4
     # print("20180712 ApiElement.put() %s" % data)
     ar = action_request(
         app_label, actor, request, data, False,
         renderer=settings.SITE.kernel.extjs_renderer)
     ar.set_selected_pks(pk)
     return settings.SITE.kernel.run_action(ar)
Ejemplo n.º 7
0
 def post(self, request, app_label=None, actor=None, pk=None):
     ar = action_request(
         app_label, actor, request, request.POST, True,
         renderer=settings.SITE.kernel.extjs_renderer)
     if pk == '-99998':
         elem = ar.create_instance()
         ar.selected_rows = [elem]
     else:
         ar.set_selected_pks(pk)
     return settings.SITE.kernel.run_action(ar)
Ejemplo n.º 8
0
 def post(self, request, app_label=None, actor=None):
     ar = action_request(app_label, actor, request, request.POST, True)
     ar.renderer = settings.SITE.kernel.extjs_renderer
     response = settings.SITE.kernel.run_action(ar)
     if request.POST.get('_document_domain', None) and response['Content-Type'] == "text/html":
         # Have same-origin policy work for iframe of file upload. see ticket #2885
         # https://stackoverflow.com/questions/22627392/extjs-fileuplaod-cross-origin-frame
         response.content= """<html><head><script type="text/javascript">document.domain="{}";</script></head><body>{}</body></html>""".format(
                 request.POST["_document_domain"],response.content.decode("utf-8") )
     return response
Ejemplo n.º 9
0
 def post(self, request, app_label=None, actor=None, pk=None):
     ar = action_request(
         app_label, actor, request, request.POST, True,
         renderer=settings.SITE.kernel.extjs_renderer)
     if pk == '-99998':
         elem = ar.create_instance()
         ar.selected_rows = [elem]
     else:
         ar.set_selected_pks(pk)
     return settings.SITE.kernel.run_action(ar)
Ejemplo n.º 10
0
 def post(self, request, app_label=None, actor=None):
     ar = action_request(app_label, actor, request, request.POST, True)
     ar.renderer = settings.SITE.kernel.extjs_renderer
     response = settings.SITE.kernel.run_action(ar)
     if request.POST.get('_document_domain', None) and response['Content-Type'] == "text/html":
         # Have same-origin policy work for iframe of file upload. see ticket #2885
         # https://stackoverflow.com/questions/22627392/extjs-fileuplaod-cross-origin-frame
         response.content= """<html><head><script type="text/javascript">document.domain="{}";</script></head><body>{}</body></html>""".format(
                 request.POST["_document_domain"],response.content.decode("utf-8") )
     return response
Ejemplo n.º 11
0
    def get(self, request, app_label=None, actor=None, pk=None):
        ar = action_request(app_label, actor, request, request.GET, False)
        ar.renderer = settings.SITE.plugins.bootstrap3.renderer

        navigator = None
        if pk and pk != '-99999' and pk != '-99998':
            elem = ar.get_row_by_pk(pk)
            if elem is None:
                raise http.Http404("%s has no row with primary key %r" %
                                   (ar.actor, pk))
                #~ raise Exception("20120327 %s.get_row_by_pk(%r)" % (rpt,pk))
            if ar.actor.show_detail_navigator:

                ni = navinfo(ar.data_iterator, elem)
                if ni:
                    # m = elem.__class__
                    buttons = []
                    #~ buttons.append( ('*',_("Home"), '/' ))

                    buttons.append(
                        ('<<', _("First page"), ar.pk2url(ni['first'])))
                    buttons.append(
                        ('<', _("Previous page"), ar.pk2url(ni['prev'])))
                    buttons.append(
                        ('>', _("Next page"), ar.pk2url(ni['next'])))
                    buttons.append(
                        ('>>', _("Last page"), ar.pk2url(ni['last'])))

                    navigator = buttons2pager(buttons)
                else:
                    navigator = E.p("No navinfo")
        else:
            elem = None

        main = layout2html(ar, elem)
       
        # The `method="html"` argument isn't available in Python 2.6,
        # only 2.7.  It is useful to avoid side effects in case of
        # empty elements: the default method (xml) writes an empty
        # E.div() as "<div/>" while in HTML5 it must be "<div></div>"
        # (and the ending / is ignored).
        
        #~ return tostring(main, method="html")
        #~ return tostring(main)
        # return main

        context = dict(
            title=ar.get_action_title(),
            obj=elem,
            form=main,
            navigator=navigator,
        )
        #~ template = web.jinja_env.get_template('detail.html')
        context.update(ar=ar)
        return http_response(ar, ar.actor.detail_html_template, context)
Ejemplo n.º 12
0
    def get(self, request, app_label=None, actor=None, pk=None):
        ar = action_request(app_label, actor, request, request.GET, False)
        ar.renderer = settings.SITE.plugins.bootstrap3.renderer

        navigator = None
        if pk and pk != '-99999' and pk != '-99998':
            elem = ar.get_row_by_pk(pk)
            if elem is None:
                raise http.Http404("%s has no row with primary key %r" %
                                   (ar.actor, pk))
                #~ raise Exception("20120327 %s.get_row_by_pk(%r)" % (rpt,pk))
            if ar.actor.show_detail_navigator:

                ni = navinfo(ar.data_iterator, elem)
                if ni:
                    # m = elem.__class__
                    buttons = []
                    #~ buttons.append( ('*',_("Home"), '/' ))

                    buttons.append(
                        ('<<', _("First page"), ar.pk2url(ni['first'])))
                    buttons.append(
                        ('<', _("Previous page"), ar.pk2url(ni['prev'])))
                    buttons.append(
                        ('>', _("Next page"), ar.pk2url(ni['next'])))
                    buttons.append(
                        ('>>', _("Last page"), ar.pk2url(ni['last'])))

                    navigator = buttons2pager(buttons)
                else:
                    navigator = E.p("No navinfo")
        else:
            elem = None

        main = layout2html(ar, elem)

        # The `method="html"` argument isn't available in Python 2.6,
        # only 2.7.  It is useful to avoid side effects in case of
        # empty elements: the default method (xml) writes an empty
        # E.div() as "<div/>" while in HTML5 it must be "<div></div>"
        # (and the ending / is ignored).

        #~ return tostring(main, method="html")
        #~ return tostring(main)
        # return main

        context = dict(
            title=ar.get_action_title(),
            obj=elem,
            form=main,
            navigator=navigator,
        )
        #~ template = web.jinja_env.get_template('detail.html')
        context.update(ar=ar)
        return http_response(ar, ar.actor.detail_html_template, context)
Ejemplo n.º 13
0
 def post(self, request, app_label=None, actor=None, pk=None):
     data = http.QueryDict(request.body)
     ar = action_request(app_label,
                         actor,
                         request,
                         data,
                         True,
                         renderer=settings.SITE.plugins.react.renderer)
     if pk == '-99998':
         elem = ar.create_instance()
         ar.selected_rows = [elem]
     else:
         ar.set_selected_pks(pk)
     return settings.SITE.kernel.run_action(ar)
Ejemplo n.º 14
0
    def get(self, request, app_label=None, actor=None):
        ar = action_request(app_label, actor, request, request.GET, True)
        ar.renderer = dd.plugins.bootstrap3.renderer

        context = dict(
            title=ar.get_title(),
            heading=ar.get_title(),
        )

        if isinstance(ar, TableRequest):
            context.update(main=table2html(ar))
        else:
            context.update(main=layout2html(ar, None))

        context.update(ar=ar)
        return http_response(ar, ar.actor.list_html_template, context)
Ejemplo n.º 15
0
    def get(self, request, app_label=None, actor=None):
        ar = action_request(app_label, actor, request, request.GET, True)
        # Add this hack to support the 'sort' param which is different in Extjs6.
        # if ar.order_by and ar.order_by[0]:
        #     _sort = ast.literal_eval(ar.order_by[0])
        #     sort = _sort[0]['property']
        #     if _sort[0]['direction'] and _sort[0]['direction'] == 'DESC':
        #         sort = '-' + sort
        #     ar.order_by = [str(sort)]
        if not ar.get_permission():
            msg = "No permission to run {}".format(ar)
            # raise Exception(msg)
            raise PermissionDenied(msg)

        ar.renderer = settings.SITE.kernel.default_renderer
        rh = ar.ah

        fmt = request.GET.get(constants.URL_PARAM_FORMAT,
                              ar.bound_action.action.default_format)

        action_name = request.GET.get(constants.URL_PARAM_ACTION_NAME)

        if action_name:
            return settings.SITE.kernel.run_action(ar)

        if fmt == constants.URL_FORMAT_JSON:

            window_type = request.GET.get(constants.URL_PARAM_WINDOW_TYPE, "g")

            def serialize(ar, row):
                """Use window_type to determin which serizlisation store metod and fields to use"""
                if window_type == "g":
                    return rh.store.row2list(ar, row)
                else:
                    return rh.store.row2dict(
                        ar,
                        row,
                        fields=rh.store.card_fields
                        if window_type == "c" else rh.store.detail_fields,
                        card_title=ar.get_card_title(row))

            rows = [serialize(ar, row) for row in ar.sliced_data_iterator]

            total_count = ar.get_total_count()
            if window_type == "g":
                for row in ar.create_phantom_rows():
                    if ar.limit is None or len(
                            rows) + 1 < ar.limit or ar.limit == total_count + 1:
                        d = serialize(ar, row)
                        rows.append(d)
                    total_count += 1
            # assert len(rows) <= ar.limit
            kw = dict(count=total_count,
                      rows=rows,
                      success=True,
                      no_data_text=ar.no_data_text,
                      title=ar.get_title())
            if window_type != "g":
                mc = ar.get_main_card()
                if mc is not None:
                    rows.insert(0, mc)
            if ar.actor.parameters:
                kw.update(
                    param_values=ar.actor.params_layout.params_store.pv2dict(
                        ar, ar.param_values))
            return json_response(kw)

        return settings.SITE.kernel.run_action(ar)
Ejemplo n.º 16
0
    def get(self, request, app_label=None, actor=None):
        ar = action_request(app_label, actor, request, request.GET, True)
        ar.renderer = settings.SITE.kernel.extjs_renderer
        rh = ar.ah

        fmt = request.GET.get(constants.URL_PARAM_FORMAT,
                              ar.bound_action.action.default_format)

        if fmt == constants.URL_FORMAT_JSON:
            rows = [
                rh.store.row2list(ar, row) for row in ar.sliced_data_iterator
            ]
            total_count = ar.get_total_count()
            for row in ar.create_phantom_rows():
                d = rh.store.row2list(ar, row)
                rows.append(d)
                total_count += 1
            kw = dict(count=total_count,
                      rows=rows,
                      success=True,
                      no_data_text=ar.no_data_text,
                      title=str(ar.get_title()))
            if ar.actor.parameters:
                kw.update(param_values=ar.actor.params_layout.params_store.
                          pv2dict(ar.param_values))
            return json_response(kw)

        if fmt == constants.URL_FORMAT_HTML:
            after_show = ar.get_status()

            sp = request.GET.get(constants.URL_PARAM_SHOW_PARAMS_PANEL, None)
            if sp is not None:
                #~ after_show.update(show_params_panel=sp)
                after_show.update(
                    show_params_panel=constants.parse_boolean(sp))

            # if isinstance(ar.bound_action.action, actions.ShowInsert):
            #     elem = ar.create_instance()
            #     rec = ar.elem2rec_insert(rh, elem)
            #     after_show.update(data_record=rec)

            kw = dict(on_ready=ar.renderer.action_call(
                ar.request, ar.bound_action, after_show))
            #~ print '20110714 on_ready', params
            kw.update(title=ar.get_title())
            return http.HttpResponse(ar.renderer.html_page(request, **kw))

        if fmt == 'csv':
            #~ response = HttpResponse(mimetype='text/csv')
            charset = settings.SITE.csv_params.get('encoding', 'utf-8')
            response = http.HttpResponse(content_type='text/csv;charset="%s"' %
                                         charset)
            if False:
                response['Content-Disposition'] = \
                    'attachment; filename="%s.csv"' % ar.actor
            else:
                #~ response = HttpResponse(content_type='application/csv')
                response['Content-Disposition'] = \
                    'inline; filename="%s.csv"' % ar.actor

            #~ response['Content-Disposition'] = 'attachment; filename=%s.csv' % ar.get_base_filename()
            w = ucsv.UnicodeWriter(response, **settings.SITE.csv_params)
            w.writerow(ar.ah.store.column_names())
            if True:  # 20130418 : also column headers, not only internal names
                column_names = None
                fields, headers, cellwidths = ar.get_field_info(column_names)
                w.writerow(headers)

            for row in ar.data_iterator:
                w.writerow([str(v) for v in rh.store.row2list(ar, row)])
            return response

        if fmt == constants.URL_FORMAT_PRINTER:
            if ar.get_total_count() > MAX_ROW_COUNT:
                raise Exception(
                    _("List contains more than %d rows") % MAX_ROW_COUNT)
            response = http.HttpResponse(
                content_type='text/html;charset="utf-8"')
            doc = xghtml.Document(force_text(ar.get_title()))
            doc.body.append(E.h1(doc.title))
            t = doc.add_table()
            #~ settings.SITE.kernel.ar2html(ar,t,ar.data_iterator)
            ar.dump2html(t, ar.data_iterator)
            doc.write(response, encoding='utf-8')
            return response

        return settings.SITE.kernel.run_action(ar)
Ejemplo n.º 17
0
 def post(self, request, app_label=None, actor=None):
     ar = action_request(app_label, actor, request, request.POST, True)
     ar.renderer = settings.SITE.kernel.extjs_renderer
     return settings.SITE.kernel.run_action(ar)
Ejemplo n.º 18
0
 def post(self, request, app_label=None, actor=None):
     ar = action_request(app_label, actor, request, request.POST, True)
     ar.renderer = settings.SITE.kernel.extjs_renderer
     return settings.SITE.kernel.run_action(ar)
Ejemplo n.º 19
0
    def get(self, request, name=None):
        # ar = action_request(None, None, request, request.GET, True)
        ar = BaseRequest(
            # user=user,
            request=request,
            renderer=settings.SITE.plugins.openui5.renderer)
        u = ar.get_user()

        context = dict(
            menu=settings.SITE.get_site_menu(None, u.user_type)
        )

        device_type = request.device_type
        print ("device_type", device_type)
        # print(u)
        # print(name)
        if name.startswith("dialog/SignInActionFormPanel"):
            tplname = "openui5/fragment/SignInActionFormPanel.fragment.xml"

        elif name.startswith("menu/user/user.fragment.xml"):
            tplname = "openui5/fragment/UserMenu.fragment.xml"

        elif name.startswith("menu/"):
            tplname = "openui5/fragment/Menu.fragment.xml"
            sel_menu = name.split("/", 1)[1].split('.', 1)[0]
            # [05/Feb/2018 09:32:25] "GET /ui/menu/mailbox.fragment.xml HTTP/1.1" 200 325
            for i in context['menu'].items:
                if i.name == sel_menu:
                    context.update(dict(
                        opened_menu=i
                    ))
                    break
            else:
                raise Exception("No Menu with name %s" % sel_menu)
        elif name.startswith("grid/") or name.startswith("slavetable/") or \
                name.startswith("view/grid/") or name.startswith("view/slavetable/"):  # Table/grid view
            # todo Get table data
            # "grid/tickets/AllTickets.view.xml"
            # or
            # "slavetable/tickets/AllTickets.view.xml
            app_label, actor = re.match(r"(?:(?:view\/)?grid|slavetable)\/(.+)\/(.+).view.xml$", name).groups()
            ar = action_request(app_label, actor, request, request.GET, True)
            actor = rt.models.resolve(app_label + "." + actor)
            store = ar.ah.store
            columns = actor.get_handle().get_columns()
            store.list_fields
            # todo match columns's field.name with store.list_fields storefield's index.
            index_mod = 0
            for c in columns:
                c.fields_index = find(store.list_fields, c.field.name,
                                      key=lambda f: f.name) + index_mod
                if isinstance(c, ComboFieldElement):
                    # Skip the data value for multi value columns, such as choices and FK fields.
                    # use c.fields_index -1 for data value
                    index_mod += 1
            # print(ar.ah.store.pk_index) # indexk of PK in detail row data

            if settings.SITE.is_installed('contenttypes'):
                # Used in slave tables of gfks relations
                m = getattr(store.pk, 'model', None)
                # e.g. pk may be the VALUE_FIELD of a choicelist which
                # has no model
                if m is not None:
                    ct = ContentType.objects.get_for_model(m).pk
                    context.update(content_type=ct)

            context.update({
                "actor": actor,
                "columns": columns,
                "actions": actor.get_actions(),
                "title": actor.label,
                "pk_index": store.pk_index,
                "is_slave": name.startswith("slavetable/") or actor.master is not None,
            })
            if name.startswith("slavetable/"):
                tplname = "openui5/view/slaveTable.view.xml"
            else:
                # if device_type == 'desktop':
                if not actor.tablet_columns and not actor.mobile_columns:
                    tplname = "openui5/view/table.view.xml"  # Change to "grid" to match action?
                else:
                    tplname = "openui5/view/table.mview.xml"

                    # ar = action_request(app_label, actor, request, request.GET, True)
                    # add to context

        elif name.startswith("detail") or name.startswith("view/detail"):  # Detail view
            # "detail/tickets/AllTickets.view.xml"
            app_label, actor = re.match(r"(?:view\/)?detail\/(.+)\/(.+).view.xml$", name).groups()
            actor = rt.models.resolve(app_label + "." + actor)
            # detail_action = actor.actions['detail']
            detail_action = actor.detail_action
            window_layout = detail_action.get_window_layout()
            layout_handle = window_layout.get_layout_handle(settings.SITE.plugins.openui5)
            layout_handle.main.elements  # elems # Refactor into actor get method?
            ba_actions = actor.get_toolbar_actions(actor.detail_action.action)
            context.update({
                "actor": actor,
                # "columns": actor.get_handle().get_columns(),
                "actions": actor.get_actions(),
                'ba_actions': ba_actions,
                "title": actor.label,  #
                # "main_elems": layout_handle.main.elements,
                "main": layout_handle.main,
                "layout_handle": layout_handle

            })
            tplname = "openui5/view/detail.view.xml"  # Change to "grid" to match action?
            # ar = action_request(app_label, actor, request, request.GET, True)
            # add to context

        elif name.startswith("view/") or \
                name.startswith("controller/") or \
                name.startswith("core/") or name.startswith("fragment/"):
            tplname = "openui5/" + name

            if "manifest.json" in name:
                ## List all master tables for routing
                actors_list = [
                    rpt for rpt in kernel.master_tables
                                   + kernel.slave_tables
                                   + list(kernel.generic_slaves.values())
                                   + kernel.virtual_tables
                                   + kernel.frames_list
                ]
                detail_list = set()

                def add(res, collector, fl, formpanel_name):
                    if fl is None or fl._datasource is None:
                        return  # 20130804
                    if fl._datasource != res:
                        fl._other_datasources.add(res)
                    if fl not in collector:
                        collector.add(res)

                for res in actors_list:
                    add(res, detail_list, res.detail_layout, "detail.%s" % res)

                    # self.actors_list.extend(
                #     [a for a in list(kernel.CHOICELISTS.values())
                #      if settings.SITE.is_installed(a.app_label)])

                # don't include for abstract actors
                actors_list = [a for a in actors_list
                               if not a.is_abstract()]

                context.update(actors_list=actors_list,
                               detail_list=detail_list,
                               )



        else:
            raise Exception("Can't find a view for path: {}".format(name))

        return XML_response(ar, tplname, context)
Ejemplo n.º 20
0
    def get(self, request, app_label=None, actor=None):
        ar = action_request(app_label, actor, request, request.GET, True)
        ar.renderer = settings.SITE.kernel.extjs_renderer
        rh = ar.ah

        fmt = request.GET.get(
            constants.URL_PARAM_FORMAT,
            ar.bound_action.action.default_format)

        if fmt == constants.URL_FORMAT_JSON:
            rows = [rh.store.row2list(ar, row)
                    for row in ar.sliced_data_iterator]
            total_count = ar.get_total_count()
            for row in ar.create_phantom_rows():
                d = rh.store.row2list(ar, row)
                rows.append(d)
                total_count += 1
            kw = dict(count=total_count,
                      rows=rows,
                      success=True,
                      no_data_text=ar.no_data_text,
                      title=unicode(ar.get_title()))
            if ar.actor.parameters:
                kw.update(
                    param_values=ar.actor.params_layout.params_store.pv2dict(
                        ar.param_values))
            return json_response(kw)

        if fmt == constants.URL_FORMAT_HTML:
            after_show = ar.get_status()

            sp = request.GET.get(
                constants.URL_PARAM_SHOW_PARAMS_PANEL, None)
            if sp is not None:
                #~ after_show.update(show_params_panel=sp)
                after_show.update(
                    show_params_panel=constants.parse_boolean(sp))

            # if isinstance(ar.bound_action.action, actions.InsertRow):
            #     elem = ar.create_instance()
            #     rec = ar.elem2rec_insert(rh, elem)
            #     after_show.update(data_record=rec)

            kw = dict(on_ready=
                      ar.renderer.action_call(
                          ar.request,
                          ar.bound_action, after_show))
            #~ print '20110714 on_ready', params
            kw.update(title=ar.get_title())
            return http.HttpResponse(ar.renderer.html_page(request, **kw))

        if fmt == 'csv':
            #~ response = HttpResponse(mimetype='text/csv')
            charset = settings.SITE.csv_params.get('encoding', 'utf-8')
            response = http.HttpResponse(
                content_type='text/csv;charset="%s"' % charset)
            if False:
                response['Content-Disposition'] = \
                    'attachment; filename="%s.csv"' % ar.actor
            else:
                #~ response = HttpResponse(content_type='application/csv')
                response['Content-Disposition'] = \
                    'inline; filename="%s.csv"' % ar.actor

            #~ response['Content-Disposition'] = 'attachment; filename=%s.csv' % ar.get_base_filename()
            w = ucsv.UnicodeWriter(response, **settings.SITE.csv_params)
            w.writerow(ar.ah.store.column_names())
            if True:  # 20130418 : also column headers, not only internal names
                column_names = None
                fields, headers, cellwidths = ar.get_field_info(column_names)
                w.writerow(headers)

            for row in ar.data_iterator:
                w.writerow([unicode(v) for v in rh.store.row2list(ar, row)])
            return response

        if fmt == constants.URL_FORMAT_PRINTER:
            if ar.get_total_count() > MAX_ROW_COUNT:
                raise Exception(_("List contains more than %d rows") %
                                MAX_ROW_COUNT)
            response = http.HttpResponse(
                content_type='text/html;charset="utf-8"')
            doc = xghtml.Document(force_unicode(ar.get_title()))
            doc.body.append(E.h1(doc.title))
            t = doc.add_table()
            #~ settings.SITE.kernel.ar2html(ar,t,ar.data_iterator)
            ar.dump2html(t, ar.data_iterator)
            doc.write(response, encoding='utf-8')
            return response

        return settings.SITE.kernel.run_action(ar)