]> granicus.if.org Git - python/commitdiff
Properties (like enums) are not in the global namespace but only valid
authorJack Jansen <jack.jansen@cwi.nl>
Tue, 1 Apr 2003 22:01:58 +0000 (22:01 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Tue, 1 Apr 2003 22:01:58 +0000 (22:01 +0000)
within a certain context. Give them an _Prop_ prefix, so they don't
accidentally obscure an element from another suite (as happened with
the Finder). Comparisons I'm not sure about, so I left them as global
names.

Also got rid of the lists if declarations, they serve no useful purpose.

Lib/plat-mac/gensuitemodule.py

index 1e604fcbab1b8dc4e6eb218284e4307a0861e07b..0fcd1c410e68d51fc9936fa68a64032c5e908ac4 100644 (file)
@@ -973,10 +973,10 @@ class ObjectCompiler:
                        if pname == othername:
                                return
                        if self.fp:
-                               self.fp.write("\n%s = %s\n"%(pname, othername))
+                               self.fp.write("\n_Prop_%s = _Prop_%s\n"%(pname, othername))
                else:
                        if self.fp:
-                               self.fp.write("class %s(aetools.NProperty):\n" % pname)
+                               self.fp.write("class _Prop_%s(aetools.NProperty):\n" % pname)
                                self.fp.write('\t"""%s - %s """\n' % (ascii(name), ascii(what[1])))
                                self.fp.write("\twhich = %s\n" % `code`)
                                self.fp.write("\twant = %s\n" % `what[0]`)
@@ -1041,7 +1041,7 @@ class ObjectCompiler:
                if self.fp:
                        self.fp.write("%s._privpropdict = {\n"%cname)
                        for n in plist:
-                               self.fp.write("\t'%s' : %s,\n"%(n, n))
+                               self.fp.write("\t'%s' : _Prop_%s,\n"%(n, n))
                        self.fp.write("}\n")
                        self.fp.write("%s._privelemdict = {\n"%cname)
                        for n, fulln in elist:
@@ -1094,26 +1094,26 @@ class ObjectCompiler:
                        self.fp.write("\t%s : %s,\n" % (`k`, v))
                self.fp.write("}\n")
                
-               self.fp.write("\n_propdeclarations = {\n")
-               proplist = self.namemappers[0].getall('property')
-               proplist.sort()
-               for k, v in proplist:
-                       self.fp.write("\t%s : %s,\n" % (`k`, v))
-               self.fp.write("}\n")
-               
-               self.fp.write("\n_compdeclarations = {\n")
-               complist = self.namemappers[0].getall('comparison')
-               complist.sort()
-               for k, v in complist:
-                       self.fp.write("\t%s : %s,\n" % (`k`, v))
-               self.fp.write("}\n")
-               
-               self.fp.write("\n_enumdeclarations = {\n")
-               enumlist = self.namemappers[0].getall('enum')
-               enumlist.sort()
-               for k, v in enumlist:
-                       self.fp.write("\t%s : %s,\n" % (`k`, v))
-               self.fp.write("}\n")
+##             self.fp.write("\n_propdeclarations = {\n")
+##             proplist = self.namemappers[0].getall('property')
+##             proplist.sort()
+##             for k, v in proplist:
+##                     self.fp.write("\t%s : _Prop_%s,\n" % (`k`, v))
+##             self.fp.write("}\n")
+##             
+##             self.fp.write("\n_compdeclarations = {\n")
+##             complist = self.namemappers[0].getall('comparison')
+##             complist.sort()
+##             for k, v in complist:
+##                     self.fp.write("\t%s : %s,\n" % (`k`, v))
+##             self.fp.write("}\n")
+##             
+##             self.fp.write("\n_enumdeclarations = {\n")
+##             enumlist = self.namemappers[0].getall('enum')
+##             enumlist.sort()
+##             for k, v in enumlist:
+##                     self.fp.write("\t%s : %s,\n" % (`k`, v))
+##             self.fp.write("}\n")
 
 def compiledata(data):
        [type, description, flags] = data