Exemple #1
0
 def test_embedded_to_field_ref(self):
     View = self.env['ir.ui.view']
     embedded = h.SPAN("My Company", attrs(expression="bob"))
     self.eq(
         View.to_field_ref(embedded),
         h.SPAN({'t-field': 'bob'})
     )
Exemple #2
0
 def test_embedded_to_field_ref(self):
     View = self.registry('ir.ui.view')
     embedded = h.SPAN("My Company", attrs(expression="bob"))
     self.eq(
         View.to_field_ref(self.cr, self.uid, embedded, context=None),
         h.SPAN({'t-field': 'bob'})
     )
Exemple #3
0
    def render_html(results: Dict[str, Any]) -> str:
        heading = E.H2(
            E.A("Locust", href="https://github.com/simiotics/locust"),
            " summary")
        body_elements = [heading]

        refs = results.get("refs")
        if refs is not None:
            body_elements.extend([E.H3("Git references")])
            body_elements.extend(
                [E.B("Initial: "),
                 E.SPAN(refs["initial"]),
                 E.BR()])
            if refs["terminal"] is not None:
                body_elements.extend(
                    [E.B("Terminal: "),
                     E.SPAN(refs["terminal"]),
                     E.BR()])

        body_elements.append(E.HR())

        changes_by_file = results["locust"]
        for item in changes_by_file:
            item_element = file_section_handler(item)
            body_elements.append(item_element)

        html = E.HTML(E.BODY(*body_elements))
        results_string = lxml.html.tostring(html).decode()
        return results_string
Exemple #4
0
def change_representation_compressed(change: Dict[str, Any], link: str,
                                     filepath: str, current_depth: int,
                                     max_depth: int) -> Optional[Any]:
    """
    Generator of compressed html markdown.
    """
    change_elements: List[Any] = [
        E.B(change["type"]),
        E.SPAN(" "),
        E.A(change["name"], href=link),
        E.B(" changed lines: "),
        E.SPAN(str(change["changed_lines"])),
    ]

    if change["total_lines"]:
        change_elements.extend(
            [E.SPAN("/"), E.SPAN(str(change["total_lines"]))])

    if change["children"]:
        change_elements.extend([E.BR()])
    child_elements = []
    for child in change["children"]:
        child_element = render_change_as_html(child, filepath,
                                              current_depth + 1, max_depth,
                                              True)
        if child_element is not None:
            child_elements.append(child_element)
    change_elements.append(E.UL(*child_elements))

    return change_elements
Exemple #5
0
 def ToHtml(self, parent):
     node = E.LI()
     parent.append(node)
     myLine = "<--" + self.xml.text.replace(' ', nbsp) + "-->"
     while myLine[0] == '\n':
         myLine = myLine[1:]
     while myLine[-1] == '\n':
         myLine = myLine[:-1]
     if self.inserted:
         n = E.SPAN()
         n.attrib['class'] = 'artwork right'
         node.attrib["whereRight"] = SourceFiles.LineFormat(self.xml, True)
         self.fixPreserveSpace(n, myLine)
         node.append(n)
     elif self.deleted:
         n = E.SPAN()
         n.attrib['class'] = 'artwork left'
         node.attrib["whereLeft"] = SourceFiles.LineFormat(self.xml, False)
         self.fixPreserveSpace(n, myLine)
         node.append(n)
     elif self.matchNode is None:
         n = E.SPAN()
         n.attrib['class'] = 'artwork error'
         self.fixPreserveSpace(n, myLine)
         node.append(n)
     else:
         node.attrib["whereLeft"] = SourceFiles.LineFormat(self.xml, False)
         node.attrib["whereRight"] = SourceFiles.LineFormat(
             self.matchNode.xml, True)
         left = myLine
         right = "<--" + self.matchNode.xml.text.replace(' ', nbsp) + "-->"
         self.diffTextToHtml(left, right, node)
Exemple #6
0
    def test_field_tail(self):
        replacement = ET.tostring(h.LI(
            h.SPAN(
                "+12 3456789",
                attrs(model='res.company',
                      id=1,
                      type='char',
                      field='phone',
                      expression="edmund")), "whop whop"),
                                  encoding="utf-8")
        self.view_id.save(value=replacement, xpath='/div/div[2]/ul/li[3]')

        self.eq(
            ET.fromstring(self.view_id.arch.encode('utf-8')),
            h.DIV(
                h.DIV(h.H3("Column 1"),
                      h.UL(h.LI("Item 1"), h.LI("Item 2"), h.LI("Item 3"))),
                h.DIV(
                    h.H3("Column 2"),
                    h.UL(
                        h.LI("Item 1"),
                        h.LI(
                            h.SPAN(
                                "My Company",
                                attrs(model='res.company',
                                      id=1,
                                      field='name',
                                      type='char'))),
                        h.LI(h.SPAN({'t-field': "edmund"}), "whop whop"),
                    ))))
Exemple #7
0
    def ToHtml(self, parent):

        node = E.LI()
        parent.append(node)
        if self.deleted:
            n = E.SPAN()
            n.attrib["class"] = 'left'
            node.attrib["whereLeft"] = SourceFiles.LineFormat(self.xml, False)
            self.fixPreserveSpace(n, self.toText())
            node.append(n)
        elif self.inserted:
            n = E.SPAN()
            n.attrib['class'] = 'right'
            node.attrib["whereRight"] = SourceFiles.LineFormat(self.xml, True)
            self.fixPreserveSpace(n, self.toText())
            node.append(n)
        elif self.matchNode is None:
            n = E.SPAN()
            n.attrib['class'] = 'error'
            self.fixPreserveSpace(n, self.toText())
            node.append(n)
        else:
            self.diffTextToHtml(self.toText(), self.matchNode.toText(), node)
            node.attrib["whereLeft"] = SourceFiles.LineFormat(self.xml, False)
            node.attrib["whereRight"] = SourceFiles.LineFormat(
                self.matchNode.xml, True)
Exemple #8
0
 def ToHtml(self, parent):
     node = E.LI()
     parent.append(node)
     if self.deleted:
         n = E.SPAN()
         n.attrib["class"] = 'left'
         node.attrib['whereLeft'] = SourceFiles.LineFormat(self.xml, False)
         n.text = self.xml.text
         node.append(n)
     elif self.inserted:
         n = E.SPAN()
         n.attrib["class"] = 'right'
         node.attrib['whereRight'] = SourceFiles.LineFormat(self.xml, True)
         n.text = self.xml.text
         node.append(n)
     elif self.matchNode is None:
         n = E.SPAN()
         n.attrib["class"] = 'error'
         n.text = self.xml.text
         node.append(n)
     else:
         node.attrib['whereLeft'] = SourceFiles.LineFormat(self.xml, False)
         node.attrib['whereRight'] = SourceFiles.LineFormat(
             self.matchNode.xml, True)
         if self.xml.text == self.matchNode.xml.text:
             node.text = self.xml.text
         else:
             self.diffTextToHtml(self.xml.text, self.matchNode.xml.text,
                                 node)
Exemple #9
0
    def test_fixup_arch(self):
        replacement = h.H1("I am the greatest title alive!")

        result = self.registry('ir.ui.view').replace_arch_section(
            self.cr, self.uid, self.view_id, '/div/div[1]/h3', replacement)

        self.eq(
            result,
            h.DIV(
                h.DIV(h.H3("I am the greatest title alive!"),
                      h.UL(h.LI("Item 1"), h.LI("Item 2"), h.LI("Item 3"))),
                h.DIV(
                    h.H3("Column 2"),
                    h.UL(
                        h.LI("Item 1"),
                        h.LI(
                            h.SPAN(
                                "My Company",
                                attrs(model='res.company',
                                      id=1,
                                      field='name',
                                      type='char'))),
                        h.LI(
                            h.SPAN(
                                "+00 00 000 00 0 000",
                                attrs(model='res.company',
                                      id=1,
                                      field='phone',
                                      type='char')))))))
def template(name, contents):

    cpu_class = 'active' if name == 'cpu' else ''
    wc_class = 'active' if name == 'wc' else ''
    help_class = 'active' if name == 'help' else ''

    return E.HTML(
        E.HEAD(
            E.LINK(rel='stylesheet',
                   type='text/css',
                   href='bootstrap/css/bootstrap.css'),
            E.LINK(rel='stylesheet', type='text/css', href='profile.css'),
            E.SCRIPT(src='bootstrap/js/bootstrap.min.js'),
            E.TITLE('RUM Job Profile')),
        E.BODY(
            E.DIV(E.DIV(E.DIV(E.A(E.SPAN(CLASS='icon-bar'),
                                  E.SPAN(CLASS='icon-bar'),
                                  E.SPAN(CLASS='icon-bar'),
                                  CLASS='btn btn-navbar'),
                              E.A('RUM Profile', CLASS='brand', href='#'),
                              E.DIV(E.UL(E.LI(E.A('CPU time', href='cpu.html'),
                                              CLASS=cpu_class),
                                         E.LI(E.A('Wallclock time',
                                                  href='wc.html'),
                                              CLASS=wc_class),
                                         E.LI(E.A('Help', href='help.html'),
                                              CLASS=help_class),
                                         CLASS='nav'),
                                    CLASS='nav-collapse collapse'),
                              CLASS='container'),
                        CLASS='navbar-inner'),
                  CLASS='navbar navbar-inverse navbar-fixed-top'), E.BR(),
            E.BR(), E.BR(), E.DIV(contents, CLASS='container')))
Exemple #11
0
 def setUp(self):
     super(TestViewSaving, self).setUp()
     self.arch = h.DIV(
         h.DIV(h.H3("Column 1"),
               h.UL(h.LI("Item 1"), h.LI("Item 2"), h.LI("Item 3"))),
         h.DIV(
             h.H3("Column 2"),
             h.UL(
                 h.LI("Item 1"),
                 h.LI(
                     h.SPAN(
                         "My Company",
                         attrs(model='res.company',
                               id=1,
                               field='name',
                               type='char'))),
                 h.LI(
                     h.SPAN(
                         "+00 00 000 00 0 000",
                         attrs(model='res.company',
                               id=1,
                               field='phone',
                               type='char'))))))
     self.view_id = self.registry('ir.ui.view').create(
         self.cr, self.uid, {
             'name': "Test View",
             'type': 'qweb',
             'arch': ET.tostring(self.arch,
                                 encoding='utf-8').decode('utf-8')
         })
Exemple #12
0
    def test_embedded_extraction(self):
        fields = self.env['ir.ui.view'].extract_embedded_fields(self.arch)

        expect = [
            h.SPAN("My Company", attrs(model='res.company', id=1, field='name', type='char')),
            h.SPAN("+00 00 000 00 0 000", attrs(model='res.company', id=1, field='phone', type='char')),
        ]
        for actual, expected in itertools.izip_longest(fields, expect):
            self.eq(actual, expected)
Exemple #13
0
def generate_right_up_corner_menu():
    html = E.SPAN(
        E.CLASS('rightupmenu'),
        E.SPAN('[', E.A('Стили', href='#', onclick='stylechanger(this);'),
               ']'),
        E.SPAN('[', E.A('Главная', href='/'), ']'),
        E.SPAN('[', E.A('A', href='/admin'), ']'),
    )
    return html
Exemple #14
0
    def test_to_field_ref_keep_attributes(self):
        View = self.env['ir.ui.view']

        att = attrs(expression="bob", model="res.company", id=1, field="name")
        att['id'] = "whop"
        att['class'] = "foo bar"
        embedded = h.SPAN("My Company", att)

        self.eq(View.to_field_ref(embedded), h.SPAN({'t-field': 'bob', 'class': 'foo bar', 'id': 'whop'}))
Exemple #15
0
    def test_save(self):
        Company = self.env['res.company']
        View = self.env['ir.ui.view']

        # create a view with an xmlid, like the file import would
        with self.env.norecompute():
            self.view_id = View.create({
                'name': "Test View",
                'type': 'qweb',
                'arch': ET.tostring(self.arch, encoding='utf-8').decode('utf-8')
            })
        imd = self.env['ir.model.data'].create({
            'module': 'website',
            'name': 'test_view',
            'model': 'ir.ui.view',
            'res_id': self.view_id,
        })

        # the xml_id of the view should not be flagged as 'noupdate'
        self.assertEqual(self.view_id.model_data_id, imd)
        self.assertFalse(imd.noupdate)

        replacement = ET.tostring(h.DIV(
            h.H3("Column 2"),
            h.UL(
                h.LI("wob wob wob"),
                h.LI(h.SPAN("Acme Corporation", attrs(model='res.company', id=1, field='name', expression="bob", type='char'))),
                h.LI(h.SPAN("+12 3456789", attrs(model='res.company', id=1, field='phone', expression="edmund", type='char'))),
            )
        ), encoding='utf-8')
        self.view_id.save(value=replacement, xpath='/div/div[2]')

        # the xml_id of the view should be flagged as 'noupdate'
        self.assertTrue(imd.noupdate)

        company = Company.browse(1)
        self.assertEqual(company.name, "Acme Corporation")
        self.assertEqual(company.phone, "+12 3456789")
        self.eq(
            ET.fromstring(self.view_id.arch.encode('utf-8')),
            h.DIV(
                h.DIV(
                    h.H3("Column 1"),
                    h.UL(
                        h.LI("Item 1"),
                        h.LI("Item 2"),
                        h.LI("Item 3"))),
                h.DIV(
                    h.H3("Column 2"),
                    h.UL(
                        h.LI("wob wob wob"),
                        h.LI(h.SPAN({'t-field': "bob"})),
                        h.LI(h.SPAN({'t-field': "edmund"}))
                    ))
            )
        )
Exemple #16
0
    def test_embedded_conflict(self):
        e1 = h.SPAN("My Company", attrs(model='res.company', id=1, field='name'))
        e2 = h.SPAN("Leeroy Jenkins", attrs(model='res.company', id=1, field='name'))

        View = self.registry('ir.ui.view')

        View.save_embedded_field(self.cr, self.uid, e1)
        # FIXME: more precise exception
        with self.assertRaises(Exception):
            View.save_embedded_field(self.cr, self.uid, e2)
Exemple #17
0
    def test_save(self):
        Company = self.env['res.company']

        # create an xmlid for the view
        imd = self.env['ir.model.data'].create({
            'module': 'website',
            'name': 'test_view',
            'model': self.view_id._name,
            'res_id': self.view_id.id,
        })
        self.assertEqual(self.view_id.model_data_id, imd)
        self.assertFalse(imd.noupdate)

        replacement = ET.tostring(h.DIV(
            h.H3("Column 2"),
            h.UL(
                h.LI("wob wob wob"),
                h.LI(
                    h.SPAN(
                        "Acme Corporation",
                        attrs(model='res.company',
                              id=1,
                              field='name',
                              expression="bob",
                              type='char'))),
                h.LI(
                    h.SPAN(
                        "+12 3456789",
                        attrs(model='res.company',
                              id=1,
                              field='phone',
                              expression="edmund",
                              type='char'))),
            )),
                                  encoding='unicode')
        self.view_id.save(value=replacement, xpath='/div/div[2]')

        # the xml_id of the view should be flagged as 'noupdate'
        self.assertTrue(imd.noupdate)

        company = Company.browse(1)
        self.assertEqual(company.name, "Acme Corporation")
        self.assertEqual(company.phone, "+12 3456789")
        self.eq(
            ET.fromstring(self.view_id.arch),
            h.DIV(
                h.DIV(h.H3("Column 1"),
                      h.UL(h.LI("Item 1"), h.LI("Item 2"), h.LI("Item 3"))),
                h.DIV(
                    h.H3("Column 2"),
                    h.UL(h.LI("wob wob wob"), h.LI(h.SPAN({'t-field': "bob"})),
                         h.LI(h.SPAN({'t-field': "edmund"}))))))
Exemple #18
0
    def header(self):
        """Make the header bar of the webpage"""

        return E.E.header(
            E.ATTR(id='header'),
            E.DIV(
                E.ATTR(id='title'),
                E.H1(
                    E.A(
                        'GCC Python Plugin',
                        href='http://gcc-python-plugin.readthedocs.org/',
                    ),
                ),
                E.DIV(
                    E.ATTR(id='info'),
                    E.SPAN(
                        E.CLASS('label'),
                        'Filename: ',
                    ),
                    self.data['filename'],
                    E.SPAN(
                        E.CLASS('label'),
                        'Function: ',
                    ),
                    self.data['function']['name'],
                ),
                E.DIV(
                    E.ATTR(id='report-pagination'),
                    E.SPAN(
                        E.CLASS('label'),
                        'Report: ',
                    ),
                    *(
                        E.A(str(i + 1), href="#state{0}".format(i + 1))
                        for i in range(len(self.data['reports']))
                    )
                ),
                E.DIV(
                    E.ATTR(id='prev'),
                    E.IMG(
                        src=data_uri('image/png', 'images/arrow-180.png'),
                    ),
                ),
                E.DIV(
                    E.ATTR(id='next'),
                    E.IMG(
                        src=data_uri('image/png', 'images/arrow.png'),
                    ),
                ),
            ),
        )
Exemple #19
0
    def test_embedded_extraction(self):
        fields = self.registry('ir.ui.view').extract_embedded_fields(
            self.cr, self.uid, self.arch, context=None)

        expect = [
            h.SPAN("My Company",
                   attrs(model='res.company', id=1, field='name',
                         type='char')),
            h.SPAN(
                "+00 00 000 00 0 000",
                attrs(model='res.company', id=1, field='phone', type='char')),
        ]
        for actual, expected in itertools.zip_longest(fields, expect):
            self.eq(actual, expected)
Exemple #20
0
def generate_main_page_board_list(boards):
    #categories = {}
    #for b in boards:
        #if b.hidden = none
        #should add for hidden boards
        #if b.category in categories:
            #categories[b.category].append((b.address, b.name))
        #else:
            #categories[b.category] = [((b.address, b.name))]
    divs = []
    #iter_list = list(categories.keys())
    #iter_list.sort()
    #for category in iter_list: #probably another order would be better
    blocks = []
    for b in boards:
        blocks.append(
                      E.A(
                          E.DIV(E.CLASS("mainboardlistitem"),
                                        E.DIV(E.CLASS("mbldiv"),
                                              E.SPAN(E.CLASS("mblboardaddress"),
                                                     '/'+b.address
                                                     ),
                                              E.SPAN(E.CLASS("mbldash"),
                                                     '-'
                                                     ),
                                              E.SPAN(E.CLASS("mblfullname"),
                                                     b.fullname
                                                     ),
                                              ),
                                        E.DIV(E.CLASS("mbldiv"),
                                              E.SPAN(E.CLASS("mbldescription"),
                                                     b.description
                                                     )
                                              ),
                                        E.DIV(E.CLASS("mbldiv"),
                                              E.SPAN(E.CLASS("mblstatdiv"),
                                                     "Постов за",
                                                     style="display: none;",
                                                     id = "mblstat"+b.address),
                                              ),
                                ),
                          href = '/' + b.address + '/',
                          )
                      )
    for i in range(4):
        blocks.append(E.DIV(E.CLASS("mblemptyfillers")))
    code = E.DIV(E.CLASS('mainboardlist'),
                 *blocks
                 )
    return code
Exemple #21
0
def loadpage(webpage, path, data=DATA):
    '''
    input template and populate the HTML with data array

    eventually client-side JavaScript will perform many of these functions.
    '''
    parsed = html.fromstring(webpage)
    postdict = data.get('postdict', {})
    set_values(parsed, postdict, ['username', 'groupname', 'httpsession_key'])
    if 'groups' in data:
        groups = populate_grouplist(parsed, data)
    else:
        groups = None
    # only show load indicator if no path specified;
    # get rid of meta refresh if path has already been chosen
    if path == '':
        hide_except('loading', parsed)
        return html.tostring(parsed).decode()
    else:
        for tag in parsed.xpath('//meta[@http-equiv="refresh"]'):
            tag.getparent().remove(tag)
    if 'text' in postdict:
        span = builder.SPAN(cgi.escape(postdict['text']))
        parsed.xpath('//div[@id="error-text"]')[0].append(span)
        hide_except('error', parsed)
    elif 'joined' in postdict:
        logging.debug('found "joined": %s', data['postdict'])
        hide_except('talksession', parsed)
    elif groups:
        hide_except('joinform', parsed)
    else:
        hide_except('groupform', parsed)
    return html.tostring(parsed).decode()
Exemple #22
0
def generate_navigation_board_list(boards): #would be redone
    categories = {}
    for b in boards:
        #if b.hidden = none
        #should add for hidden boards
        if b.category in categories:
            categories[b.category].append((b.address, b.name))
        else:
            categories[b.category] = [((b.address, b.name))]
    spans = []
    iter_list = list(categories.keys())
    iter_list.sort()
    for category in iter_list: #probably another order would be better
        urls = []
        for params in categories[category]:
            urls.append(
                E.A(
                    params[0], #the name
                    title = params[1],#bydlocode, better to find another way
                    href = '/' + params[0] + '/',
                    )
                )
            urls.append('/')
        urls.pop()
        if category is None:
            category = ''
        urls = [E.CLASS('boardcategory'), category+' ['] + urls + [']']
        spans.append(E.SPAN(*urls))
    code = EM('nav',
        E.CLASS('boardlist'),
        *spans
        )
    return code
Exemple #23
0
def fix_spoilers_in_html(content: str, language: str) -> str:
    with override_language(language):
        spoiler_title: str = _("Open Zulip to see the spoiler content")
    fragment = lxml.html.fromstring(content)
    spoilers = fragment.find_class("spoiler-block")
    for spoiler in spoilers:
        header = spoiler.find_class("spoiler-header")[0]
        spoiler_content = spoiler.find_class("spoiler-content")[0]
        header_content = header.find("p")
        if header_content is None:
            # Create a new element to append the spoiler to)
            header_content = E.P()
            header.append(header_content)
        else:
            # Add a space.
            rear = header_content[-1] if len(
                header_content) else header_content
            rear.tail = (rear.tail or "") + " "
        span_elem = E.SPAN(f"({spoiler_title})",
                           **E.CLASS("spoiler-title"),
                           title=spoiler_title)
        header_content.append(span_elem)
        header.drop_tag()
        spoiler_content.drop_tree()
    content = lxml.html.tostring(fragment, encoding="unicode")
    return content
Exemple #24
0
 def span(self):
     """Assemble the HTML cell object for the match"""
     section = B.B(self.section)
     section.tail = ' - "' + self.prefix.lstrip()
     term = B.B(self.text, B.CLASS("error"))
     term.tail = self.suffix.rstrip() + '"'
     return B.SPAN(section, term)
Exemple #25
0
    def test_save(self):
        Company = self.registry('res.company')
        View = self.registry('ir.ui.view')

        replacement = ET.tostring(h.DIV(
            h.H3("Column 2"),
            h.UL(
                h.LI("wob wob wob"),
                h.LI(
                    h.SPAN(
                        "Acme Corporation",
                        attrs(model='res.company',
                              id=1,
                              field='name',
                              expression="bob",
                              type='char'))),
                h.LI(
                    h.SPAN(
                        "+12 3456789",
                        attrs(model='res.company',
                              id=1,
                              field='phone',
                              expression="edmund",
                              type='char'))),
            )),
                                  encoding='utf-8')
        View.save(self.cr,
                  self.uid,
                  res_id=self.view_id,
                  value=replacement,
                  xpath='/div/div[2]')

        company = Company.browse(self.cr, self.uid, 1)
        self.assertEqual(company.name, "Acme Corporation")
        self.assertEqual(company.phone, "+12 3456789")
        self.eq(
            ET.fromstring(
                View.browse(self.cr, self.uid,
                            self.view_id).arch.encode('utf-8')),
            h.DIV(
                h.DIV(h.H3("Column 1"),
                      h.UL(h.LI("Item 1"), h.LI("Item 2"), h.LI("Item 3"))),
                h.DIV(
                    h.H3("Column 2"),
                    h.UL(h.LI("wob wob wob"), h.LI(h.SPAN({'t-field': "bob"})),
                         h.LI(h.SPAN({'t-field': "edmund"}))))))
Exemple #26
0
    def test_embedded_save(self):
        embedded = h.SPAN("+00 00 000 00 0 000", attrs(
            model='res.company', id=1, field='phone', type='char'))

        self.registry('ir.ui.view').save_embedded_field(self.cr, self.uid, embedded)

        company = self.registry('res.company').browse(self.cr, self.uid, 1)
        self.assertEqual(company.phone, "+00 00 000 00 0 000")
Exemple #27
0
def main_page_gen(default_style):
    html = E.HTML(
        E.HEAD(
            E.META(**{'http-equiv':"Default-Style", 'content':default_style, 'id':'stylemetatag'}),
            E.TITLE("U2ch - Main Page"),
            E.SCRIPT(type = 'text/javascript', src = '/mainscript.js'), #js
	    *initiate.style_cache
            ),
        E.BODY(
            E.UL(initiate.stats_cache,
                 style = "display: none;",
                 id = "mblstatscache"),
	    E.TABLE(
                E.CLASS("maintable"),
                E.THEAD(E.TR(E.TD(E.DIV(E.CLASS("mainslogandiv"),
                                        E.SPAN("U2CH"),
                                        E.SPAN("",
                                               style="display: inline-block; width: 5em;"),
                                        E.SPAN("Viewing above imageboards"),
                                        ),
                                  E.DIV(E.CLASS("mainimagediv"),
                                        E.IMG(src="u-2.jpg", style="width:496px;height:334px;"),
                                        ),
                                  )), id = 'header'),
                E.TBODY(E.TR(E.TD(
                    E.HR(E.CLASS("delimeter")),
                    E.DIV(E.CLASS("mblcontainer"),
                          E.DIV(E.CLASS("mblcentering"),
                                initiate.board_cache_main_page,
                                ),
                          ),
                    E.HR(E.CLASS("delimeter")),
                    )), id = 'mainpart'),
                E.TFOOT(E.TR(E.TD(
                    E.DIV('powered by ',
                        E.A('Farlight Imageboard Engine',
                            href='https://github.com/Alpherie/farlight_board_engine',
                            target='_blank',
                            ),
                        id='credentials'),
                    )), id = 'footer'),
                ),
            onload = 'mainpagefunc()'
            )
        )
    return lxml.html.tostring(html)
Exemple #28
0
    def test_embedded_save(self):
        embedded = h.SPAN("+00 00 000 00 0 000", attrs(
            model='res.company', id=1, field='phone', type='char'))

        self.env['ir.ui.view'].save_embedded_field(embedded)

        company = self.env['res.company'].browse(1)
        self.assertEqual(company.phone, "+00 00 000 00 0 000")
Exemple #29
0
    def htm(self, data):
        aut = 'Czyzycki, W.; Filo, G.; Domagala, M.;'
        html = E.DIV(
            E.CLASS("iso-690"),
            E.SPAN('' + data[3] + '.', E.I(' ' + data[2] + '.'),
                   ' ' + data[5] + '.', ' ' + str(data[4]) + '.'))

        fo = open('biblografia.html', 'a')
        fo.write(lxml.html.tostring(html) + '\n')
        fo.close()
Exemple #30
0
 def _expand_u(self, element):
     try:
         text = expand_unicode_element(element)
     except (RuntimeError, ValueError) as exc:
         text = ''
         xml2rfc.log.error('%s'%exc)
     if text:
         span = E.SPAN(text)
         span.set('class', 'unicode')
         return [span]
     return []