pylintext.py
changeset 8061 88ca47ceb9f2
parent 7941 018b5deca73e
child 8190 2a3c1b787688
child 8198 ce9c6ae03c2d
--- a/pylintext.py	Mon Nov 07 10:55:15 2011 +0100
+++ b/pylintext.py	Mon Nov 07 10:56:39 2011 +0100
@@ -1,6 +1,7 @@
 """https://pastebin.logilab.fr/show/860/"""
 
 from logilab.astng import MANAGER, nodes, scoped_nodes
+from logilab.astng.builder import ASTNGBuilder
 
 def turn_function_to_class(node):
     """turn a Function node into a Class node (in-place)"""
@@ -33,9 +34,15 @@
         from yams import BASE_TYPES
         for etype in BASE_TYPES:
             module.locals[etype] = [scoped_nodes.Class(etype, None)]
-
-MANAGER.register_transformer(cubicweb_transform)
+    # add data() to uiprops module
+    if module.name.endswith('.uiprops'):
+        fake = ASTNGBuilder(MANAGER).string_build('''
+def data(string):
+  return u''
+''')
+        module.locals['data'] = fake.locals['data']
 
 def register(linter):
     """called when loaded by pylint --load-plugins, nothing to do here"""
+    MANAGER.register_transformer(cubicweb_transform)