odoo/openerp
Xavier Morel 9cefa76988 [ADD] hasclass() xpath function
Server-side, view extension is done via xpath. This includes "template" views
full of HTML.

HTML elements often have a bunch of classes, sometimes even semantic
(!). XPath is generally great, but specifically lousy at dealing with
space-separated values: in standard XPath 1.0 to know if an element has a
class 'foo' the predicate is:

    contains(concat(' ', normalize-space(@class), ' '), ' foo ')

and this has to be fully duplicated if there's a second class involved.

Things are slightly better with EXSLT/XPath 2.0 and tokenize, but still not
great:

    tokenize(@class, '\s+') = 'foo'

and the equality check is very weird when unaware of XPath's evaluation rules.

``hasclass`` makes this much simpler to deal with: to get any ``foo`` node
with the class ``bar`` is as simple as:

    //foo[hasclass('bar')

and it can take multiple class, as with e.g. jquery it will return elements
with all specified classes.

Beware though, the predicate function will be called once for each element to
check, since it's implemented in pure python and not profiled elements should
be filtered as much as possible before this point.
2014-05-19 08:32:23 +02:00
..
addons [ADD] hasclass() xpath function 2014-05-19 08:32:23 +02:00
cli [IMP] do not fail if cannot delete the pidfile. It may have a race-condition when in multi-workers. 2014-04-23 17:01:17 +02:00
conf [MERGE] openerp.pooler is deprecated. 2013-03-27 17:40:45 +01:00
modules [FIX] module: do not crash in case of not found module 2014-05-05 14:18:40 +02:00
osv [FIX] don't blockquote a list of stuff for no reason 2014-05-19 08:32:14 +02:00
report [MERGE] forward port of branch saas-3 up to revid 5112 chs@openerp.com-20140407144238-3s38zadkh7yxpdy7 2014-04-07 18:05:48 +02:00
service [FIX] when runing in prefork mode, empty connection pool *after* the registry preloading 2014-04-22 14:06:48 +02:00
tests [FIX] tests race condition in phanthomjs tests 2014-05-01 17:06:41 +02:00
tools Forward-port of latest saas-4, up to revision 5211 (revid fme@openerp.com-20140509164408-rtml4brrhpiv4zz9) 2014-05-12 10:05:23 +02:00
workflow [IMP] remove useless table/column creations in base.sql. Let the ORM do it job. 2014-04-25 18:28:28 +02:00
PKG-INFO [REM] netrpc: KILL EVERYBODY 2013-02-21 13:18:25 +01:00
__init__.py [IMP] move test cases to tests.py remove deprecated wsgi import 2014-02-09 16:18:22 +01:00
exceptions.py [REF] code review 2013-02-15 15:35:03 +01:00
http.py [FIX] rST warnings & errors 2014-05-19 08:31:09 +02:00
import_xml.rng [IMP] Backport one feature from website: this feature allows to specify a file 2014-01-09 16:43:38 +01:00
loglevels.py [REF] logging: removed pseudo log-level TEST. 2013-03-26 16:58:44 +01:00
netsvc.py [FIX] logging, pg logging use thread db 2014-04-12 15:47:28 +02:00
pooler.py [IMP] registry: avoid every direct access registry.db, and rename attribute as registry._db 2014-04-09 15:35:15 +02:00
release.py [FIX] release.py: correct version number (wrongly forward-ported from saas-4) 2014-04-28 11:39:24 +02:00
sql_db.py [MERGE] forward port of branch 7.0 up to revid 5281 launchpad_translations_on_behalf_of_openerp-20140412094159-mhy3v2prb3ctx32k 2014-04-15 15:36:50 +02:00