Browse Source

[MIG][10.0][html_text] Migrate

pull/874/head
Jairo Llopis 8 years ago
parent
commit
6bead1323e
  1. 2
      html_text/README.rst
  2. 2
      html_text/__init__.py
  3. 4
      html_text/__manifest__.py
  4. 2
      html_text/models/__init__.py
  5. 6
      html_text/models/ir_fields_converter.py
  6. 1
      html_text/tests/__init__.py
  7. 10
      html_text/tests/test_extractor.py

2
html_text/README.rst

@ -38,7 +38,7 @@ QWeb example::
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/9.0
:target: https://runbot.odoo-community.org/runbot/149/10.0
Known issues / Roadmap
======================

2
html_text/__init__.py

@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# Copyright 2016 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models

4
html_text/__openerp__.py → html_text/__manifest__.py

@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com>
# Copyright 2016 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Text from HTML field",
"summary": "Generate excerpts from any HTML field",
"version": "9.0.1.0.0",
"version": "10.0.1.0.0",
"category": "Tools",
"website": "https://tecnativa.com",
"author": "Grupo ESOC Ingeniería de Servicios, "

2
html_text/models/__init__.py

@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# Copyright 2016 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import ir_fields_converter

6
html_text/models/ir_fields_converter.py

@ -1,16 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com>
# Copyright 2016 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import logging
from lxml import etree, html
from openerp import api, models
from odoo import api, models
_logger = logging.getLogger(__name__)
class IrFieldsConverter(models.Model):
class IrFieldsConverter(models.AbstractModel):
_inherit = "ir.fields.converter"
@api.model

1
html_text/tests/__init__.py

@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_extractor

10
html_text/tests/test_extractor.py

@ -1,15 +1,16 @@
# -*- coding: utf-8 -*-
# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from lxml import etree
from openerp.tests.common import TransactionCase
from odoo.tools import mute_logger
from odoo.tests.common import TransactionCase
from ..models import ir_fields_converter
class ExtractorCase(TransactionCase):
def setUp(self):
super(ExtractorCase, self).setUp()
# Shortcut
self.text_from_html = self.env["ir.fields.converter"].text_from_html
@ -40,18 +41,21 @@ class ExtractorCase(TransactionCase):
self.text_from_html(html, 7, ellipsis=""),
u"I'm a title I'm a paragraph ¡Pues")
@mute_logger(ir_fields_converter.__name__)
def test_empty_html(self):
"""Empty HTML handled correctly."""
self.assertEqual(self.text_from_html(""), "")
with self.assertRaises(etree.XMLSyntaxError):
self.text_from_html("", fail=True)
@mute_logger(ir_fields_converter.__name__)
def test_false_html(self):
"""``False`` HTML handled correctly."""
self.assertEqual(self.text_from_html(False), "")
with self.assertRaises(TypeError):
self.text_from_html(False, fail=True)
@mute_logger(ir_fields_converter.__name__)
def test_bad_html(self):
"""Bad HTML handled correctly."""
self.assertEqual(self.text_from_html("<<bad>"), "")

Loading…
Cancel
Save