4 :copyright: 2007-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
4 :copyright: 2007-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
6 """ |
6 """ |
7 import re |
7 import re |
8 |
8 |
9 from cubicweb.vregistry import autoselectors |
|
10 |
|
11 from cubicweb.common.registerers import accepts_registerer |
9 from cubicweb.common.registerers import accepts_registerer |
12 from cubicweb.common.appobject import AppObject |
10 from cubicweb.common.appobject import AppObject |
13 |
11 |
14 |
12 |
15 def rgx(pattern, flags=0): |
13 def rgx(pattern, flags=0): |
16 """this is just a convenient shortcout to add the $ sign""" |
14 """this is just a convenient shortcout to add the $ sign""" |
17 return re.compile(pattern+'$', flags) |
15 return re.compile(pattern+'$', flags) |
18 |
16 |
19 class metarewriter(autoselectors): |
17 class metarewriter(type): |
20 """auto-extend rules dictionnary""" |
18 """auto-extend rules dictionnary""" |
21 def __new__(mcs, name, bases, classdict): |
19 def __new__(mcs, name, bases, classdict): |
22 # collect baseclass' rules |
20 # collect baseclass' rules |
23 rules = [] |
21 rules = [] |
24 ignore_baseclass_rules = classdict.get('ignore_baseclass_rules', False) |
22 ignore_baseclass_rules = classdict.get('ignore_baseclass_rules', False) |