Exemplo n.º 1
0
    def _gen_thead(self, ctx, cls, parent, name):
        logger.debug("Generate header for %r", cls)

        with parent.element('thead'):
            with parent.element('tr'):
                if issubclass(cls, ComplexModelBase):
                    fti = self.sort_fields(cls)
                    for k, v in fti:
                        cls_attr = self.get_cls_attrs(v)
                        if cls_attr.exc:
                            continue

                        th_attrs = {}
                        self.add_field_attrs(th_attrs, k, cls)

                        if cls_attr.hidden:
                            self.add_style(th_attrs, 'display:None')

                        header_name = self.trc(v, ctx.locale, k)
                        parent.write(E.th(header_name, **th_attrs))

                    m = cls.Attributes.methods
                    if m is not None and len(m) > 0:
                        th_attrs = {'class': 'mrpc-cell'}
                        parent.write(E.th(**th_attrs))

                else:
                    th_attrs = {}
                    self.add_field_attrs(th_attrs, name, cls)

                    header_name = self.trc(cls, ctx.locale, name)

                    parent.write(E.th(header_name, **th_attrs))

                self.extend_header_row(ctx, cls, parent, name)
Exemplo n.º 2
0
    def _gen_thead(self, ctx, cls, name, parent):
        logger.debug("Generate header for %r", cls)

        with parent.element('thead'):
            with parent.element('tr'):
                if issubclass(cls, ComplexModelBase):
                    fti = self.sort_fields(cls)
                    for k, v in fti:
                        attr = self.get_cls_attrs(v)
                        if attr.exc:
                            continue

                        th_attrs = {}
                        if self.field_name_attr is not None:
                            th_attrs[self.field_name_attr] = k
                        if attr.hidden:
                            th_attrs['style'] = 'display:None'

                        header_name = self.trc(v, ctx.locale, k)
                        parent.write(E.th(header_name, **th_attrs))

                    m = cls.Attributes.methods
                    if m is not None and len(m) > 0:
                        parent.write(E.th())

                else:
                    th_attrs = {}
                    if self.field_name_attr is not None:
                        th_attrs[self.field_name_attr] = name
                    header_name = self.trc(cls, ctx.locale, name)
                    parent.write(E.th(header_name, **th_attrs))

                self.extend_header_row(ctx, cls, parent, name)
Exemplo n.º 3
0
    def _gen_header(self, ctx, cls, name, parent):
        logger.debug("Generate header for %r", cls)

        with parent.element('thead'):
            with parent.element('tr'):
                th_attrs = {}
                if self.field_name_attr is not None:
                    th_attrs[self.field_name_attr] = name

                if issubclass(cls, ComplexModelBase):
                    fti = cls.get_flat_type_info(cls)
                    if self.field_name_attr is None:
                        for k, v in fti.items():
                            attr = get_cls_attrs(self, v)
                            if attr.exc:
                                continue
                            header_name = self.trc(v, ctx.locale, k)
                            parent.write(E.th(header_name, **th_attrs))
                    else:
                        for k, v in fti.items():
                            attr = get_cls_attrs(self, v)
                            if attr.exc:
                                continue
                            th_attrs[self.field_name_attr] = k
                            header_name = self.trc(v, ctx.locale, k)
                            parent.write(E.th(header_name, **th_attrs))

                else:
                    if self.field_name_attr is not None:
                        th_attrs[self.field_name_attr] = name
                    header_name = self.trc(cls, ctx.locale, name)
                    parent.write(E.th(header_name, **th_attrs))

                self.extend_header_row(ctx, cls, name, parent)
Exemplo n.º 4
0
    def _gen_header(self, ctx, cls, name, parent):
        logger.debug("Generate header for %r", cls)

        with parent.element('thead'):
            with parent.element('tr'):
                th_attrs = {}
                if self.field_name_attr is not None:
                    th_attrs[self.field_name_attr] = name

                if issubclass(cls, ComplexModelBase):
                    fti = cls.get_flat_type_info(cls)
                    if self.field_name_attr is None:
                        for k, v in fti.items():
                            attr = get_cls_attrs(self, v)
                            if attr.exc:
                                continue
                            header_name = self.trc(v, ctx.locale, k)
                            parent.write(E.th(header_name, **th_attrs))
                    else:
                        for k, v in fti.items():
                            attr = get_cls_attrs(self, v)
                            if attr.exc:
                                continue
                            th_attrs[self.field_name_attr] = k
                            header_name = self.trc(v, ctx.locale, k)
                            parent.write(E.th(header_name, **th_attrs))

                else:
                    if self.field_name_attr is not None:
                        th_attrs[self.field_name_attr] = name
                    header_name = self.trc(cls, ctx.locale, name)
                    parent.write(E.th(header_name, **th_attrs))

                self.extend_header_row(ctx, cls, parent, name)
Exemplo n.º 5
0
    def _gen_thead(self, ctx, cls, parent, name):
        logger.debug("Generate header for %r", cls)

        with parent.element('thead'):
            with parent.element('tr'):
                if issubclass(cls, ComplexModelBase):
                    fti = self.sort_fields(cls)
                    for k, v in fti:
                        cls_attr = self.get_cls_attrs(v)
                        if cls_attr.exc:
                            continue

                        th_attrs = {}
                        self.add_field_attrs(th_attrs, k, cls)

                        if cls_attr.hidden:
                            self.add_style(th_attrs, 'display:None')

                        header_name = self.trc(v, ctx.locale, k)
                        parent.write(E.th(header_name, **th_attrs))

                    m = cls.Attributes.methods
                    if m is not None and len(m) > 0:
                        th_attrs = {'class': 'mrpc-cell'}
                        parent.write(E.th(**th_attrs))

                else:
                    th_attrs = {}
                    self.add_field_attrs(th_attrs, name, cls)

                    header_name = self.trc(cls, ctx.locale, name)

                    parent.write(E.th(header_name, **th_attrs))

                self.extend_header_row(ctx, cls, parent, name)
Exemplo n.º 6
0
    def _gen_header(self, ctx, cls, name, parent):
        with parent.element('thead'):
            with parent.element('tr'):
                th_attrs = {}
                if self.field_name_attr is not None:
                    th_attrs[self.field_name_attr] = name

                # fti is none when the type inside Array is not a ComplexModel.
                if issubclass(cls, ComplexModelBase):
                    fti = cls.get_flat_type_info(cls)
                    if self.field_name_attr is None:
                        for k, v in fti.items():
                            if getattr(v.Attributes, 'exc_html', None):
                                continue
                            header_name = self.translate(v, ctx.locale, k)
                            parent.write(E.th(header_name, **th_attrs))
                    else:
                        for k, v in fti.items():
                            if getattr(v.Attributes, 'exc_html', None):
                                continue
                            th_attrs[self.field_name_attr] = k
                            header_name = self.translate(v, ctx.locale, k)
                            parent.write(E.th(header_name, **th_attrs))

                else:
                    if self.field_name_attr is not None:
                        th_attrs[self.field_name_attr] = name
                    header_name = self.translate(cls, ctx.locale, name)
                    parent.write(E.th(header_name, **th_attrs))

                self.extend_header_row(ctx, cls, name, parent)
Exemplo n.º 7
0
    def _gen_header(self, ctx, cls, name, parent):
        with parent.element('thead'):
            with parent.element('tr'):
                th_attrs = {}
                if self.field_name_attr is not None:
                    th_attrs[self.field_name_attr] = name

                # fti is none when the type inside Array is not a ComplexModel.
                if issubclass(cls, ComplexModelBase):
                    fti = cls.get_flat_type_info(cls)
                    if self.field_name_attr is None:
                        for k, v in fti.items():
                            if getattr(v.Attributes, 'exc_html', None):
                                continue
                            header_name = self.translate(v, ctx.locale, k)
                            parent.write(E.th(header_name, **th_attrs))
                    else:
                        for k, v in fti.items():
                            if getattr(v.Attributes, 'exc_html', None):
                                continue
                            th_attrs[self.field_name_attr] = k
                            header_name = self.translate(v, ctx.locale, k)
                            parent.write(E.th(header_name, **th_attrs))

                else:
                    if self.field_name_attr is not None:
                        th_attrs[self.field_name_attr] = name
                    header_name = self.translate(cls, ctx.locale, name)
                    parent.write(E.th(header_name, **th_attrs))

                self.extend_header_row(ctx, cls, name, parent)
Exemplo n.º 8
0
    def _gen_thead(self, ctx, cls, name, parent):
        logger.debug("Generate header for %r", cls)

        with parent.element('thead'):
            with parent.element('tr'):
                if issubclass(cls, ComplexModelBase):
                    fti = self.sort_fields(cls)
                    for k, v in fti:
                        attr = self.get_cls_attrs(v)
                        if attr.exc:
                            continue

                        th_attrs = {}
                        if self.field_name_attr is not None:
                            th_attrs[self.field_name_attr] = k
                        if attr.hidden:
                            th_attrs['style'] = 'display:None'

                        header_name = self.trc(v, ctx.locale, k)
                        parent.write(E.th(header_name, **th_attrs))

                    m = cls.Attributes.methods
                    if m is not None and len(m) > 0:
                        parent.write(E.th())

                else:
                    th_attrs = {}
                    if self.field_name_attr is not None:
                        th_attrs[self.field_name_attr] = name
                    header_name = self.trc(cls, ctx.locale, name)
                    parent.write(E.th(header_name, **th_attrs))

                self.extend_header_row(ctx, cls, parent, name)
Exemplo n.º 9
0
    def build_title_content(self):
        content = E.table(
            E.tr(
                E.th(self.T('Time')),
                E.th(self.T('Message')),
                E.th(self.T('Count'))
            )
        )

        for message in self._messages:
            message_dict = dict(message.data_iter)

            row = E.tr(
                E.td(self.handler.locale.format_date(message.datetime),
                    rowspan=str(len(message_dict)))
            )

            for key, count in sorted(message_dict.items()):
                row.extend([E.td(to_hex(key)), E.td(str(count))])
                content.append(row)
                row = E.tr()

        self.elements.content.append(content)

        if self._pager_next:
            self.elements.content.append(
                E.a(self.T('Older'), href='?before=' + str(self._pager_next))
            )

        self.add_footer()
Exemplo n.º 10
0
    def serialize_complex_model(self, cls, value):
        sti = None
        fti = cls.get_flat_type_info(cls)

        first_child = iter(fti.values()).next()
        if len(fti) == 1:
            fti = first_child.get_flat_type_info(first_child)
            first_child = iter(fti.values()).next()
            if len(fti) == 1 and first_child.Attributes.max_occurs > 1:
                if issubclass(first_child, ComplexModelBase):
                    sti = first_child.get_simple_type_info(first_child)
                value = value[0]
            else:
                raise Exception("Can only serialize Array(...) types")
        else:
            raise Exception("Can only serialize single Array(...) return types")

        header_row = E.tr()
        class_name = first_child.get_type_name()
        if sti is None:
            header_row.append(E.th(class_name))
        else:
            if self.field_name_attr is None:
                for k, v in sti.items():
                    header_row.append(E.th(k))
            else:
                for k, v in sti.items():
                    header_row.append(E.th(k,
                                        **{self.field_name_attr: k}))

        yield header_row

        if sti is None:
            if self.field_name_attr is None:
                for val in value:
                    yield E.tr(E.td(first_child.to_string(val)), )
            else:
                for val in value:
                    yield E.tr(E.td(first_child.to_string(val)),
                                           **{self.field_name_attr: class_name})

        else:
            for val in value:
                row = E.tr()
                print val
                for k, v in sti.items():
                    subvalue = val
                    for p in v.path:
                        subvalue = getattr(subvalue, p, "`%s`" % k)
                    if self.field_name_attr is None:
                        row.append(E.td(v.type.to_string(subvalue)))
                    else:
                        row.append(E.td(v.type.to_string(subvalue),
                                                   **{self.field_name_attr: k}))
                yield row
Exemplo n.º 11
0
    def array_to_parent(self, ctx, cls, inst, parent, name, **kwargs):
        with parent.element('div'):
            if issubclass(cls, ComplexModelBase):
                ret = super(HtmlRowTable, self).array_to_parent(
                                         ctx, cls, inst, parent, name, **kwargs)
                if isgenerator(ret):
                    try:
                        while True:
                            sv2 = (yield)
                            ret.send(sv2)
                    except Break as b:
                        try:
                            ret.throw(b)
                        except StopIteration:
                            pass
            else:
                table_attrib = {}
                if self.table_name_attr:
                    table_attrib = {self.table_name_attr: name}
                if self.table_width is not None:
                    table_attrib['width'] = self.table_width

                with parent.element('table', table_attrib):
                    tr_attrib = {}
                    if self.row_class is not None:
                        tr_attrib['class'] = self.row_class
                    with parent.element('tr', tr_attrib):
                        if self.header:
                            parent.write(E.th(self.trc(cls, ctx.locale,
                                                          cls.get_type_name())))
                        td_attrs = {}

                        if self.cell_class is not None:
                            self.add_html_attr('class', td_attrs,
                                                                self.cell_class)

                        self.add_field_attrs(td_attrs, name, cls)

                        cls_attrs = self.get_cls_attrs(cls)

                        if cls_attrs.hidden:
                            self.add_style(td_attrs, 'display:None')

                        with parent.element('td', td_attrs):
                            with parent.element('table'):
                                ret = super(HtmlRowTable, self) \
                                    .array_to_parent(ctx, cls, inst, parent,
                                                                 name, **kwargs)
                                if isgenerator(ret):
                                    try:
                                        while True:
                                            sv2 = (yield)
                                            ret.send(sv2)
                                    except Break as b:
                                        try:
                                            ret.throw(b)
                                        except StopIteration:
                                            pass
Exemplo n.º 12
0
    def complex_model_to_parent(self, ctx, cls, inst, parent, name,
                                                      from_arr=False, **kwargs):
        attrib = {}
        if self.table_name_attr is not None:
            attrib[self.table_name_attr] = cls.get_type_name()

        with parent.element('table', attrib, nsmap=NSMAP):
            with parent.element('tbody'):
                for k, v in cls.get_flat_type_info(cls).items():
                    try:
                        sub_value = getattr(inst, k, None)
                    except: # to guard against e.g. SQLAlchemy throwing NoSuchColumnError
                        sub_value = None

                    sub_name = v.Attributes.sub_name
                    if sub_name is None:
                        sub_name = k

                    if sub_value is None and cls.Attributes.min_occurs == 0:
                        self.null_to_parent(ctx, cls, sub_value, parent,
                                                             sub_name, **kwargs)
                        continue

                    tr_attrib = {}
                    if self.row_class is not None:
                        tr_attrib['class'] = self.row_class
                    with parent.element('tr', tr_attrib):
                        th_attrib = {}
                        if self.header_cell_class is not None:
                            th_attrib['class'] = self.header_cell_class
                        if self.field_name_attr is not None:
                            th_attrib[self.field_name_attr] = sub_name
                        if self.produce_header:
                            parent.write(E.th(
                                self.trc(v, ctx.locale, sub_name),
                                **th_attrib
                            ))

                        td_attrib = {}
                        if self.cell_class is not None:
                            td_attrib['class'] = self.cell_class
                        if self.field_name_attr is not None:
                            td_attrib[self.field_name_attr] = sub_name

                        with parent.element('td', td_attrib):
                            ret = self.to_parent(ctx, v, sub_value, parent,
                                                            sub_name, **kwargs)
                            if isgenerator(ret):
                                try:
                                    while True:
                                        sv2 = (yield)
                                        ret.send(sv2)
                                except Break as b:
                                    try:
                                        ret.throw(b)
                                    except StopIteration:
                                        pass
Exemplo n.º 13
0
    def complex_model_to_parent(self, ctx, cls, inst, parent, name,
                                                      from_arr=False, **kwargs):
        attrib = {}
        if self.table_name_attr is not None:
            attrib[self.table_name_attr] = cls.get_type_name()

        with parent.element('table', attrib):
            with parent.element('tbody'):
                for k, v in cls.get_flat_type_info(cls).items():
                    try:
                        sub_value = getattr(inst, k, None)
                    except: # to guard against e.g. SQLAlchemy throwing NoSuchColumnError
                        sub_value = None

                    sub_name = v.Attributes.sub_name
                    if sub_name is None:
                        sub_name = k

                    if sub_value is None and cls.Attributes.min_occurs == 0:
                        self.null_to_parent(ctx, cls, sub_value, parent,
                                                             sub_name, **kwargs)
                        continue

                    tr_attrib = {}
                    if self.row_class is not None:
                        tr_attrib['class'] = self.row_class
                    with parent.element('tr', tr_attrib):
                        th_attrib = {}
                        if self.header_cell_class is not None:
                            th_attrib['class'] = self.header_cell_class
                        if self.field_name_attr is not None:
                            th_attrib[self.field_name_attr] = sub_name
                        if self.produce_header:
                            parent.write(E.th(
                                self.trc(v, ctx.locale, sub_name),
                                **th_attrib
                            ))

                        td_attrib = {}
                        if self.cell_class is not None:
                            td_attrib['class'] = self.cell_class
                        if self.field_name_attr is not None:
                            td_attrib[self.field_name_attr] = sub_name

                        with parent.element('td', td_attrib):
                            ret = self.to_parent(ctx, v, sub_value, parent,
                                                            sub_name, **kwargs)
                            if isgenerator(ret):
                                try:
                                    while True:
                                        sv2 = (yield)
                                        ret.send(sv2)
                                except Break as b:
                                    try:
                                        ret.throw(b)
                                    except StopIteration:
                                        pass
Exemplo n.º 14
0
    def array_to_parent(self, ctx, cls, inst, parent, name, **kwargs):
        with parent.element('div'):
            if issubclass(cls, ComplexModelBase):
                ret = super(HtmlRowTable,
                            self).array_to_parent(ctx, cls, inst, parent, name,
                                                  **kwargs)
                if isgenerator(ret):
                    try:
                        while True:
                            sv2 = (yield)
                            ret.send(sv2)
                    except Break as b:
                        try:
                            ret.throw(b)
                        except StopIteration:
                            pass
            else:
                table_attrib = {}
                if self.table_name_attr:
                    table_attrib = {self.table_name_attr: name}
                if self.table_width is not None:
                    table_attrib['width'] = self.table_width

                with parent.element('table', table_attrib):
                    tr_attrib = {}
                    if self.row_class is not None:
                        tr_attrib['class'] = self.row_class
                    with parent.element('tr', tr_attrib):
                        if self.header:
                            parent.write(
                                E.th(
                                    self.trc(cls, ctx.locale,
                                             cls.get_type_name())))
                        td_attrib = {}
                        cls_attrs = self.get_cls_attrs(cls)
                        if self.cell_class is not None:
                            td_attrib['class'] = self.cell_class
                        if cls_attrs.hidden:
                            td_attrib['style'] = 'display:None'

                        with parent.element('td', td_attrib):
                            with parent.element('table'):
                                ret = super(HtmlRowTable, self) \
                                    .array_to_parent(ctx, cls, inst, parent,
                                                                 name, **kwargs)
                                if isgenerator(ret):
                                    try:
                                        while True:
                                            sv2 = (yield)
                                            ret.send(sv2)
                                    except Break as b:
                                        try:
                                            ret.throw(b)
                                        except StopIteration:
                                            pass
Exemplo n.º 15
0
    def model_base_to_parent(self, ctx, cls, inst, parent, name, **kwargs):
        retval = E.tr()
        attr = {}
        if self.field_name_attr is not None:
            attr = {self.field_name_attr: name}

        if self.produce_header:
            retval.append(E.th(self.translate(cls, ctx.locale, name), **attr))

        retval.append(E.td(self.to_string(cls, inst), **attr))
        parent.write(retval)
Exemplo n.º 16
0
    def model_base_to_parent(self, ctx, cls, inst, parent, name, **kwargs):
        retval = E.tr()
        attr = {}
        if self.field_name_attr is not None:
            attr = {self.field_name_attr: name}

        if self.produce_header:
            retval.append(E.th(self.translate(cls, ctx.locale, name), **attr))

        retval.append(E.td(self.to_string(cls, inst), **attr))
        parent.write(retval)
Exemplo n.º 17
0
    def array_to_parent(self, ctx, cls, inst, parent, name, **kwargs):
        with parent.element('div', nsmap=NSMAP):
            if issubclass(cls, ComplexModelBase):
                ret = super(HtmlRowTable,
                            self).array_to_parent(ctx, cls, inst, parent, name,
                                                  **kwargs)
                if isgenerator(ret):
                    try:
                        while True:
                            sv2 = (yield)
                            ret.send(sv2)
                    except Break as b:
                        try:
                            ret.throw(b)
                        except StopIteration:
                            pass
            else:
                table_attrs = {}
                if self.table_name_attr:
                    table_attrs = {self.table_name_attr: name}

                with parent.element('table', table_attrs, nsmap=NSMAP):
                    tr_attrs = {}
                    if self.row_class is not None:
                        tr_attrs['class'] = self.row_class
                    with parent.element('tr', tr_attrs):
                        if self.produce_header:
                            parent.write(
                                E.th(
                                    self.translate(cls, ctx.locale,
                                                   cls.get_type_name())))
                        td_attrs = {}
                        if self.cell_class is not None:
                            td_attrs['class'] = self.cell_class
                        with parent.element('td', td_attrs):
                            with parent.element('table'):
                                ret = super(HtmlRowTable, self) \
                                    .array_to_parent(ctx, cls, inst, parent,
                                                                 name, **kwargs)
                                if isgenerator(ret):
                                    try:
                                        while True:
                                            sv2 = (yield)
                                            ret.send(sv2)
                                    except Break as b:
                                        try:
                                            ret.throw(b)
                                        except StopIteration:
                                            pass
Exemplo n.º 18
0
    def complex_model_to_parent(self,
                                ctx,
                                cls,
                                inst,
                                parent,
                                name,
                                tr_child=False,
                                **kwargs):
        attrs = {}
        if tr_child is False:
            ret = self._get_members(ctx,
                                    cls,
                                    inst,
                                    parent,
                                    tr_child=True,
                                    **kwargs)
            if isgenerator(ret):
                try:
                    while True:
                        sv2 = (yield)
                        ret.send(sv2)
                except Break as b:
                    try:
                        ret.throw(b)
                    except StopIteration:
                        pass

        else:
            if self.table_name_attr is not None:
                attrs[self.table_name_attr] = name

            with parent.element('tr', attrs):
                if self.produce_header:
                    parent.write(
                        E.th(self.translate(cls, ctx.locale, name),
                             **{self.field_name_attr: name}))
                with parent.element('td', attrs):
                    ret = self.subserialize(ctx, cls, inst, parent, None, name)
                    if isgenerator(ret):
                        try:
                            while True:
                                sv2 = (yield)
                                ret.send(sv2)
                        except Break as b:
                            try:
                                ret.throw(b)
                            except StopIteration:
                                pass
Exemplo n.º 19
0
    def array_to_parent(self, ctx, cls, inst, parent, name, **kwargs):
        with parent.element('div', nsmap=NSMAP):
            if issubclass(cls, ComplexModelBase):
                ret = super(HtmlRowTable, self).array_to_parent(
                                         ctx, cls, inst, parent, name, **kwargs)
                if isgenerator(ret):
                    try:
                        while True:
                            sv2 = (yield)
                            ret.send(sv2)
                    except Break as b:
                        try:
                            ret.throw(b)
                        except StopIteration:
                            pass
            else:
                table_attrib = {}
                if self.table_name_attr:
                    table_attrib = {self.table_name_attr: name}

                with parent.element('table', table_attrib, nsmap=NSMAP):
                    tr_attrib = {}
                    if self.row_class is not None:
                        tr_attrib['class'] = self.row_class
                    with parent.element('tr', tr_attrib):
                        if self.produce_header:
                            parent.write(E.th(self.trc(cls, ctx.locale,
                                                          cls.get_type_name())))
                        td_attrib = {}
                        if self.cell_class is not None:
                            td_attrib['class'] = self.cell_class
                        with parent.element('td', td_attrib):
                            with parent.element('table'):
                                ret = super(HtmlRowTable, self) \
                                    .array_to_parent(ctx, cls, inst, parent,
                                                                 name, **kwargs)
                                if isgenerator(ret):
                                    try:
                                        while True:
                                            sv2 = (yield)
                                            ret.send(sv2)
                                    except Break as b:
                                        try:
                                            ret.throw(b)
                                        except StopIteration:
                                            pass
Exemplo n.º 20
0
    def complex_model_to_parent(self, ctx, cls, inst, parent, name, 
                                                    tr_child=False, **kwargs):
        attrs = {}
        if tr_child is False:
            ret = self._get_members(ctx, cls, inst, parent, 
                                                tr_child=True, **kwargs)
            if isgenerator(ret):
                try:
                    while True:
                        sv2 = (yield)
                        ret.send(sv2)
                except Break as b:
                    try:
                        ret.throw(b)
                    except StopIteration:
                        pass

        else:
            if self.table_name_attr is not None:
                attrs[self.table_name_attr] = name

            with parent.element('tr', attrs):
                if self.produce_header:
                    parent.write(E.th(self.translate(cls, ctx.locale, name),
                                                **{self.field_name_attr: name}))
                with parent.element('td', attrs):
                    ret = self.subserialize(ctx, cls, inst, parent, None, name)
                    if isgenerator(ret):
                        try:
                            while True:
                                sv2 = (yield)
                                ret.send(sv2)
                        except Break as b:
                            try:
                                ret.throw(b)
                            except StopIteration:
                                pass
Exemplo n.º 21
0
    def serialize_complex_model(self, cls, value, locale):
        sti = None
        fti = cls.get_flat_type_info(cls)

        first_child = iter(fti.values()).next()
        if len(fti) == 1:
            fti = first_child.get_flat_type_info(first_child)
            first_child = iter(fti.values()).next()

            if len(fti) == 1 and first_child.Attributes.max_occurs > 1:
                if issubclass(first_child, ComplexModelBase):
                    sti = first_child.get_simple_type_info(first_child)

            else:
                raise NotImplementedError(
                    "Can only serialize Array(...) types")

            value = value[0]

        else:
            raise NotImplementedError("Can only serialize single Array(...) "
                                      "return types")

        # Here, sti can be None when the return type does not have _type_info
        # attribute
        tr = {}
        if self.row_class is not None:
            tr['class'] = self.row_class

        td = {}
        if self.cell_class is not None:
            td['class'] = self.cell_class

        class_name = first_child.get_type_name()
        if self.produce_header:
            header_row = E.tr(**tr)

            th = {}
            if self.header_cell_class is not None:
                th['class'] = self.header_cell_class

            if sti is None:
                header_row.append(E.th(class_name, **th))

            else:
                if self.field_name_attr is None:
                    for k, v in sti.items():
                        header_name = translate(v.type, locale, k)
                        header_row.append(E.th(header_name, **th))

                else:
                    for k, v in sti.items():
                        th[self.field_name_attr] = k
                        header_name = translate(v.type, locale, k)
                        header_row.append(E.th(header_name, **th))

            yield header_row

        if sti is None:
            if self.field_name_attr is None:
                for val in value:
                    yield E.tr(E.td(first_child.to_string(val), **td), **tr)

            else:
                for val in value:
                    td[self.field_name_attr] = class_name
                    yield E.tr(E.td(first_child.to_string(val), **td), **tr)

        else:
            for val in value:
                row = E.tr()
                for k, v in sti.items():
                    subvalue = val
                    for p in v.path:
                        subvalue = getattr(subvalue, p, None)

                    if subvalue is None:
                        if v.type.Attributes.min_occurs == 0:
                            continue
                        else:
                            subvalue = ""
                    else:
                        subvalue = _subvalue_to_html(v, subvalue)

                    if self.field_name_attr is None:
                        row.append(E.td(subvalue, **td))
                    else:
                        td[self.field_name_attr] = k
                        row.append(E.td(subvalue, **td))

                yield row
Exemplo n.º 22
0
    def subserialize(self, ctx, cls, inst, parent, ns=None, name=None):
        attrs = {}
        if self.table_name_attr is not None:
            attrs[self.table_name_attr] = name

        locale = ctx.locale
        with parent.element('table', attrs):
            fti = None
            if issubclass(cls, ComplexModelBase):
                fti = cls.get_flat_type_info(cls)
            if self.produce_header:
                with parent.element('thead'):
                    header_row = E.tr()

                    th = {}
                    if self.header_cell_class is not None:
                        th['class'] = self.header_cell_class

                    # fti is none when the type inside Array is not a ComplexModel.
                    if fti is None:
                        if self.field_name_attr is not None:
                            th[self.field_name_attr] = name
                        header_name = self.translate(cls, ctx.locale, name)
                        header_row.append(E.th(header_name, **th))

                    else:
                        if self.field_name_attr is None:
                            for k, v in fti.items():
                                header_name = self.translate(v, ctx.locale, k)
                                header_row.append(E.th(header_name, **th))

                        else:
                            for k, v in fti.items():
                                th[self.field_name_attr] = k
                                header_name = self.translate(v, ctx.locale, k)
                                header_row.append(E.th(header_name, **th))

                    parent.write(header_row)

            with parent.element('tbody'):
                if cls.Attributes.max_occurs > 1:
                    ret = self.array_to_parent(ctx, cls, inst, parent, name)
                    if isgenerator(ret):
                        try:
                            while True:
                                y = (yield)
                                ret.send(y)
                        except Break as b:
                            try:
                                ret.throw(b)
                            except StopIteration:
                                pass

                else:
                    with parent.element('tr'):
                        ret = self.to_parent(ctx, cls, inst, parent, name)
                        if isgenerator(ret):
                            try:
                                while True:
                                    y = (yield)
                                    ret.send(y)
                            except Break as b:
                                try:
                                    ret.throw(b)
                                except StopIteration:
                                    pass
Exemplo n.º 23
0
    def serialize_complex_model(self, cls, value, locale):
        sti = None
        fti = cls.get_flat_type_info(cls)
        is_array = False

        if len(fti) == 1:
            first_child, = fti.values()

            try:
                fti = first_child.get_flat_type_info(first_child)
            except AttributeError:
                raise NotImplementedError("Can only serialize complex return types")

            first_child_2 = iter(fti.values()).next()

            if len(fti) == 1 and first_child_2.Attributes.max_occurs > 1:
                if issubclass(first_child_2, ComplexModelBase):
                    sti = first_child_2.get_simple_type_info(first_child_2)
                is_array = True

            else:
                if issubclass(first_child, ComplexModelBase):
                    sti = first_child.get_simple_type_info(first_child)

            value = value[0]

        else:
            raise NotImplementedError("Can only serialize single return types")

        tr = {}
        if self.row_class is not None:
            tr['class'] = self.row_class

        td = {}
        if self.cell_class is not None:
            td['class'] = self.cell_class

        th = {}
        if self.header_cell_class is not None:
            th['class'] = self.header_cell_class

        class_name = first_child.get_type_name()
        if sti is None:
            if self.field_name_attr is not None:
                td[self.field_name_attr] = class_name

            if is_array:
                for val in value:
                    yield E.tr(E.td(first_child_2.to_string(val), **td), **tr)
            else:
                yield E.tr(E.td(first_child_2.to_string(value), **td), **tr)

        else:
            for k, v in sti.items():
                row = E.tr(**tr)
                subvalue = value
                for p in v.path:
                    subvalue = getattr(subvalue, p, None)
                    if subvalue is None:
                        break

                if subvalue is None:
                    if v.type.Attributes.min_occurs == 0:
                        continue
                    else:
                        subvalue = ""
                else:
                    subvalue = _subvalue_to_html(v, subvalue)

                if self.produce_header:
                    header_text = translate(v.type, locale, k)
                    if self.field_name_attr is None:
                        row.append(E.th(header_text, **th))
                    else:
                        th[self.field_name_attr] = k
                        row.append(E.th(header_text, **th))

                if self.field_name_attr is None:
                    row.append(E.td(subvalue, **td))

                else:
                    td[self.field_name_attr] = k
                    row.append(E.td(subvalue, **td))

                yield row
Exemplo n.º 24
0
    def serialize_complex_model(self, cls, value, locale):
        sti = None
        fti = cls.get_flat_type_info(cls)

        first_child = iter(fti.values()).next()
        if len(fti) == 1:
            fti = first_child.get_flat_type_info(first_child)
            first_child = iter(fti.values()).next()

            if len(fti) == 1 and first_child.Attributes.max_occurs > 1:
                if issubclass(first_child, ComplexModelBase):
                    sti = first_child.get_simple_type_info(first_child)

            else:
                raise NotImplementedError("Can only serialize Array(...) types")

            value = value[0]

        else:
            raise NotImplementedError("Can only serialize single Array(...) "
                                                                 "return types")

        # Here, sti can be None when the return type does not have _type_info
        # attribute
        tr = {}
        if self.row_class is not None:
            tr['class'] = self.row_class

        td = {}
        if self.cell_class is not None:
            td['class'] = self.cell_class

        class_name = first_child.get_type_name()
        if self.produce_header:
            header_row = E.tr(**tr)

            th = {}
            if self.header_cell_class is not None:
                th['class'] = self.header_cell_class

            if sti is None:
                header_row.append(E.th(class_name, **th))

            else:
                if self.field_name_attr is None:
                    for k, v in sti.items():
                        header_name = translate(v.type, locale, k)
                        header_row.append(E.th(header_name, **th))

                else:
                    for k, v in sti.items():
                        th[self.field_name_attr] = k
                        header_name = translate(v.type, locale, k)
                        header_row.append(E.th(header_name, **th))

            yield header_row

        if sti is None:
            if self.field_name_attr is None:
                for val in value:
                    yield E.tr(E.td(first_child.to_string(val), **td), **tr)

            else:
                for val in value:
                    td[self.field_name_attr] = class_name
                    yield E.tr(E.td(first_child.to_string(val), **td), **tr)

        else:
            for val in value:
                row = E.tr()
                for k, v in sti.items():
                    subvalue = val
                    for p in v.path:
                        subvalue = getattr(subvalue, p, None)

                    if subvalue is None:
                        if v.type.Attributes.min_occurs == 0:
                            continue
                        else:
                            subvalue = ""
                    else:
                        subvalue = _subvalue_to_html(v, subvalue)

                    if self.field_name_attr is None:
                        row.append(E.td(subvalue, **td))
                    else:
                        td[self.field_name_attr] = k
                        row.append(E.td(subvalue, **td))

                yield row
Exemplo n.º 25
0
    def subserialize(self, ctx, cls, inst, parent, ns=None, name=None):
        attrs = {}
        if self.table_name_attr is not None:
            attrs[self.table_name_attr] = name

        locale = ctx.locale
        with parent.element('table', attrs):
            fti = None
            if issubclass(cls, ComplexModelBase):
                fti = cls.get_flat_type_info(cls)
            if self.produce_header:
                with parent.element('thead'):
                    header_row = E.tr()

                    th = {}
                    if self.header_cell_class is not None:
                        th['class'] = self.header_cell_class

                    # fti is none when the type inside Array is not a ComplexModel.
                    if fti is None:
                        if self.field_name_attr is not None:
                            th[self.field_name_attr] = name
                        header_name = self.translate(cls, ctx.locale, name)
                        header_row.append(E.th(header_name, **th))

                    else:
                        if self.field_name_attr is None:
                            for k, v in fti.items():
                                header_name = self.translate(v, ctx.locale, k)
                                header_row.append(E.th(header_name, **th))

                        else:
                            for k, v in fti.items():
                                th[self.field_name_attr] = k
                                header_name = self.translate(v, ctx.locale, k)
                                header_row.append(E.th(header_name, **th))

                    parent.write(header_row)

            with parent.element('tbody'):
                if cls.Attributes.max_occurs > 1:
                    ret = self.array_to_parent(ctx, cls, inst, parent, name)
                    if isgenerator(ret):
                        try:
                            while True:
                                y = (yield)
                                ret.send(y)
                        except Break as b:
                            try:
                                ret.throw(b)
                            except StopIteration:
                                pass

                else:
                    with parent.element('tr'):
                        ret = self.to_parent(ctx, cls, inst, parent, name)
                        if isgenerator(ret):
                            try:
                                while True:
                                    y = (yield)
                                    ret.send(y)
                            except Break as b:
                                try:
                                    ret.throw(b)
                                except StopIteration:
                                    pass
Exemplo n.º 26
0
    def complex_model_to_parent(self,
                                ctx,
                                cls,
                                inst,
                                parent,
                                name,
                                from_arr=False,
                                **kwargs):
        attrib = {}
        if self.table_name_attr is not None:
            attrib[self.table_name_attr] = cls.get_type_name()
        if self.table_width is not None:
            attrib['width'] = self.table_width

        with parent.element('table', attrib):
            with parent.element('tbody'):
                for k, v in self.sort_fields(cls):
                    sub_attrs = self.get_cls_attrs(v)
                    try:
                        sub_value = getattr(inst, k, None)
                    except:  # e.g. SQLAlchemy could throw NoSuchColumnError
                        sub_value = None

                    sub_name = v.Attributes.sub_name
                    if sub_name is None:
                        sub_name = k

                    if sub_value is None and cls.Attributes.min_occurs == 0:
                        self.null_to_parent(ctx, cls, sub_value, parent,
                                            sub_name, **kwargs)
                        continue

                    tr_attrib = {}
                    if self.row_class is not None:
                        tr_attrib['class'] = self.row_class
                    with parent.element('tr', tr_attrib):
                        th_attrib = {}
                        if self.header_cell_class is not None:
                            th_attrib['class'] = self.header_cell_class
                        if self.field_name_attr is not None:
                            th_attrib[self.field_name_attr] = sub_name
                        if sub_attrs.hidden:
                            th_attrib['style'] = 'display:None'
                        if self.header:
                            parent.write(
                                E.th(self.trc(v, ctx.locale, sub_name),
                                     **th_attrib))

                        td_attrib = {}
                        if self.cell_class is not None:
                            td_attrib['class'] = self.cell_class
                        if self.field_name_attr is not None:
                            td_attrib[self.field_name_attr] = sub_name
                        if sub_attrs.hidden:
                            td_attrib['style'] = 'display:None'

                        with parent.element('td', td_attrib):
                            ret = self.to_parent(ctx, v, sub_value, parent,
                                                 sub_name, **kwargs)
                            if isgenerator(ret):
                                try:
                                    while True:
                                        sv2 = (yield)
                                        ret.send(sv2)
                                except Break as b:
                                    try:
                                        ret.throw(b)
                                    except StopIteration:
                                        pass
Exemplo n.º 27
0
    def complex_model_to_parent(self, ctx, cls, inst, parent, name,
                                                      from_arr=False, **kwargs):
        attrib = {}
        if self.table_name_attr is not None:
            attrib[self.table_name_attr] = cls.get_type_name()
        if self.table_width is not None:
            attrib['width'] = self.table_width

        with parent.element('table', attrib):
            with parent.element('tbody'):
                for k, v in self.sort_fields(cls):
                    sub_attrs = self.get_cls_attrs(v)
                    if sub_attrs.exc:
                        logger.debug("\tExclude table cell %r type %r for %r",
                                                                      k, v, cls)
                        continue
                    try:
                        sub_value = getattr(inst, k, None)
                    except:  # e.g. SQLAlchemy could throw NoSuchColumnError
                        sub_value = None

                    sub_name = v.Attributes.sub_name
                    if sub_name is None:
                        sub_name = k

                    tr_attrs = {}
                    if self.row_class is not None:
                        self.add_html_attr('class', tr_attrs, self.row_class)

                    with parent.element('tr', tr_attrs):
                        th_attrs = {}

                        if self.header_cell_class is not None:
                            self.add_html_attr('class', th_attrs,
                                                         self.header_cell_class)

                        self.add_field_attrs(th_attrs, sub_name, v)

                        if sub_attrs.hidden:
                            self.add_style(th_attrs, 'display:None')

                        if self.header:
                            parent.write(E.th(
                                self.trc(v, ctx.locale, sub_name),
                                **th_attrs
                            ))

                        td_attrs = {}
                        if self.cell_class is not None:
                            self.add_html_attr('class', td_attrs,
                                                                self.cell_class)

                        self.add_field_attrs(td_attrs, sub_name, v)

                        if sub_attrs.hidden:
                            self.add_style(td_attrs, 'display:None')

                        with parent.element('td', td_attrs):
                            ret = self.to_parent(ctx, v, sub_value, parent,
                                                             sub_name, **kwargs)
                            if isgenerator(ret):
                                try:
                                    while True:
                                        sv2 = (yield)
                                        ret.send(sv2)
                                except Break as b:
                                    try:
                                        ret.throw(b)
                                    except StopIteration:
                                        pass
Exemplo n.º 28
0
    def complex_model_to_parent(self,
                                ctx,
                                cls,
                                inst,
                                parent,
                                name,
                                from_arr=False,
                                **kwargs):
        attrib = {}
        if self.table_name_attr is not None:
            attrib[self.table_name_attr] = cls.get_type_name()
        if self.table_width is not None:
            attrib['width'] = self.table_width

        with parent.element('table', attrib):
            with parent.element('tbody'):
                for k, v in self.sort_fields(cls):
                    sub_attrs = self.get_cls_attrs(v)
                    if sub_attrs.exc:
                        logger.debug("\tExclude table cell %r type %r for %r",
                                     k, v, cls)
                        continue
                    try:
                        sub_value = getattr(inst, k, None)
                    except:  # e.g. SQLAlchemy could throw NoSuchColumnError
                        sub_value = None

                    sub_name = v.Attributes.sub_name
                    if sub_name is None:
                        sub_name = k

                    tr_attrs = {}
                    if self.row_class is not None:
                        self.add_html_attr('class', tr_attrs, self.row_class)

                    with parent.element('tr', tr_attrs):
                        th_attrs = {}

                        if self.header_cell_class is not None:
                            self.add_html_attr('class', th_attrs,
                                               self.header_cell_class)

                        self.add_field_attrs(th_attrs, sub_name, v)

                        if sub_attrs.hidden:
                            self.add_style(th_attrs, 'display:None')

                        if self.header:
                            parent.write(
                                E.th(self.trc(v, ctx.locale, sub_name),
                                     **th_attrs))

                        td_attrs = {}
                        if self.cell_class is not None:
                            self.add_html_attr('class', td_attrs,
                                               self.cell_class)

                        self.add_field_attrs(td_attrs, sub_name, v)

                        if sub_attrs.hidden:
                            self.add_style(td_attrs, 'display:None')

                        with parent.element('td', td_attrs):
                            ret = self.to_parent(ctx, v, sub_value, parent,
                                                 sub_name, **kwargs)
                            if isgenerator(ret):
                                try:
                                    while True:
                                        sv2 = (yield)
                                        ret.send(sv2)
                                except Break as b:
                                    try:
                                        ret.throw(b)
                                    except StopIteration:
                                        pass
Exemplo n.º 29
0
    def serialize_complex_model(self, cls, value, locale):
        fti = cls.get_flat_type_info(cls)
        if cls.Attributes._wrapper and not issubclass(cls, Array):
            if len(fti) > 1:
                raise NotImplementedError("Can only serialize one array at a time")
            cls, = cls._type_info.values()
            value, = value

        fti = cls.get_flat_type_info(cls)
        first_child = iter(fti.values()).next()
        if not issubclass(cls, Array):
            raise NotImplementedError("Can only serialize Array(...) types")

        sti = None
        if issubclass(first_child, ComplexModelBase):
            sti = first_child.get_simple_type_info(first_child)

        # Here, sti can be None when the return type does not have _type_info
        # attribute
        tr = {}
        if self.row_class is not None:
            tr['class'] = self.row_class

        td = {}
        if self.cell_class is not None:
            td['class'] = self.cell_class

        class_name = first_child.get_type_name()
        if self.produce_header:
            header_row = E.tr(**tr)

            th = {}
            if self.header_cell_class is not None:
                th['class'] = self.header_cell_class

            # sti is none when the type inside Array is not a ComplexModel.
            if sti is None:
                header_row.append(E.th(class_name, **th))

            else:
                if self.field_name_attr is None:
                    for k, v in sti.items():
                        header_name = translate(v.type, locale, k)
                        header_row.append(E.th(header_name, **th))

                else:
                    for k, v in sti.items():
                        th[self.field_name_attr] = k
                        header_name = translate(v.type, locale, k)
                        header_row.append(E.th(header_name, **th))

            yield header_row

        if value is None:
            raise StopIteration()

        if sti is None:
            if self.field_name_attr is None:
                for val in value:
                    yield E.tr(E.td(self.to_string(first_child, val),**td),**tr)

            else:
                for val in value:
                    td[self.field_name_attr] = class_name
                    yield E.tr(E.td(self.to_string(first_child, val),**td),**tr)

        else:
            for val in value:
                row = E.tr()
                for k, v in sti.items():
                    subvalue = val
                    for p in v.path:
                        subvalue = getattr(subvalue, p, None)

                    if subvalue is None:
                        subvalue = ""
                    else:
                        subvalue = _subvalue_to_html(self, v, subvalue)

                    if self.field_name_attr is None:
                        row.append(E.td(subvalue, **td))
                    else:
                        td[self.field_name_attr] = k
                        row.append(E.td(subvalue, **td))

                yield row
Exemplo n.º 30
0
    def serialize_complex_model(self, cls, value, locale):
        sti = None
        fti = cls.get_flat_type_info(cls)
        is_array = False

        if len(fti) == 1:
            first_child, = fti.values()

            try:
                fti = first_child.get_flat_type_info(first_child)
            except AttributeError:
                raise NotImplementedError(
                    "Can only serialize complex return types")

            first_child_2 = iter(fti.values()).next()

            if len(fti) == 1 and first_child_2.Attributes.max_occurs > 1:
                if issubclass(first_child_2, ComplexModelBase):
                    sti = first_child_2.get_simple_type_info(first_child_2)
                is_array = True

            else:
                if issubclass(first_child, ComplexModelBase):
                    sti = first_child.get_simple_type_info(first_child)

            value = value[0]

        else:
            raise NotImplementedError("Can only serialize single return types")

        tr = {}
        if self.row_class is not None:
            tr['class'] = self.row_class

        td = {}
        if self.cell_class is not None:
            td['class'] = self.cell_class

        th = {}
        if self.header_cell_class is not None:
            th['class'] = self.header_cell_class

        class_name = first_child.get_type_name()
        if sti is None:
            if self.field_name_attr is not None:
                td[self.field_name_attr] = class_name

            if is_array:
                for val in value:
                    yield E.tr(E.td(first_child_2.to_string(val), **td), **tr)
            else:
                yield E.tr(E.td(first_child_2.to_string(value), **td), **tr)

        else:
            for k, v in sti.items():
                row = E.tr(**tr)
                subvalue = value
                for p in v.path:
                    subvalue = getattr(subvalue, p, None)
                    if subvalue is None:
                        break

                if subvalue is None:
                    if v.type.Attributes.min_occurs == 0:
                        continue
                    else:
                        subvalue = ""
                else:
                    subvalue = _subvalue_to_html(v, subvalue)

                if self.produce_header:
                    header_text = translate(v.type, locale, k)
                    if self.field_name_attr is None:
                        row.append(E.th(header_text, **th))
                    else:
                        th[self.field_name_attr] = k
                        row.append(E.th(header_text, **th))

                if self.field_name_attr is None:
                    row.append(E.td(subvalue, **td))

                else:
                    td[self.field_name_attr] = k
                    row.append(E.td(subvalue, **td))

                yield row
Exemplo n.º 31
0
 def column_table_gen_header(self, ctx, cls, parent, name):
     parent.write(E.thead(E.th("Search",
                                        **{'class': 'search-link'})))
Exemplo n.º 32
0
    def complex_model_to_parent(self, ctx, cls, inst, parent, name,
                                                      from_arr=False, **kwargs):
        attrib = {}
        if self.table_name_attr is not None:
            attrib[self.table_name_attr] = cls.get_type_name()

        with parent.element('table', attrib):
            with parent.element('tbody'):
                for k, v in self.sort_fields(cls):
                    sub_attrs = self.get_cls_attrs(v)
                    try:
                        sub_value = getattr(inst, k, None)
                    except:  # e.g. SQLAlchemy could throw NoSuchColumnError
                        sub_value = None

                    sub_name = v.Attributes.sub_name
                    if sub_name is None:
                        sub_name = k

                    if sub_value is None and cls.Attributes.min_occurs == 0:
                        self.null_to_parent(ctx, cls, sub_value, parent,
                                                             sub_name, **kwargs)
                        continue

                    tr_attrib = {}
                    if self.row_class is not None:
                        tr_attrib['class'] = self.row_class
                    with parent.element('tr', tr_attrib):
                        th_attrib = {}
                        if self.header_cell_class is not None:
                            th_attrib['class'] = self.header_cell_class
                        if self.field_name_attr is not None:
                            th_attrib[self.field_name_attr] = sub_name
                        if sub_attrs.hidden:
                            th_attrib['style'] = 'display:None'
                        if self.header:
                            parent.write(E.th(
                                self.trc(v, ctx.locale, sub_name),
                                **th_attrib
                            ))

                        td_attrib = {}
                        if self.cell_class is not None:
                            td_attrib['class'] = self.cell_class
                        if self.field_name_attr is not None:
                            td_attrib[self.field_name_attr] = sub_name
                        if sub_attrs.hidden:
                            td_attrib['style'] = 'display:None'

                        with parent.element('td', td_attrib):
                            ret = self.to_parent(ctx, v, sub_value, parent,
                                                            sub_name, **kwargs)
                            if isgenerator(ret):
                                try:
                                    while True:
                                        sv2 = (yield)
                                        ret.send(sv2)
                                except Break as b:
                                    try:
                                        ret.throw(b)
                                    except StopIteration:
                                        pass
Exemplo n.º 33
0
 def column_table_gen_header(self, ctx, cls, parent, name):
     parent.write(
         E.thead(E.th("Search", **{'class': 'search-link'})))