]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Enums we cannot find are set to None, and enumsubst understands this (no substitution...
authorJack Jansen <jack.jansen@cwi.nl>
Sun, 20 Aug 2000 19:42:52 +0000 (19:42 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Sun, 20 Aug 2000 19:42:52 +0000 (19:42 +0000)
Mac/Lib/lib-toolbox/aetools.py
Mac/scripts/gensuitemodule.py

index 792cb728fa69df257eb8496d9220f21211e0d7ee..42b6b76b377420c91dfd6198e89f4f1e1893cff1 100644 (file)
@@ -103,7 +103,7 @@ def keysubst(arguments, keydict):
                        
 def enumsubst(arguments, key, edict):
        """Substitute a single enum keyword argument, if it occurs"""
-       if not arguments.has_key(key):
+       if not arguments.has_key(key) or edict is None:
                return
        v = arguments[key]
        ok = edict.values()
@@ -129,8 +129,9 @@ def decodeerror(arguments):
 
 class TalkTo:
        """An AE connection to an application"""
+       _signature = None       # Can be overridden by subclasses
        
-       def __init__(self, signature, start=0, timeout=0):
+       def __init__(self, signature=None, start=0, timeout=0):
                """Create a communication channel with a particular application.
                
                Addressing the application is done by specifying either a
@@ -138,6 +139,8 @@ class TalkTo:
                to an AEDesc.
                """
                self.target_signature = None
+               if signature is None:
+                       signature = self._signature
                if type(signature) == AEDescType:
                        self.target = signature
                elif type(signature) == InstanceType and hasattr(signature, '__aepack__'):
index df1e4553ca1879aaeeefe3a29b27150ca3715890..8059cc7b60424c71a14cc9c9d5f24e7fefa927f3 100644 (file)
@@ -667,16 +667,17 @@ class ObjectCompiler:
                        return
                pname = identify(name)
                if self.namemappers[0].hascode('property', code):
-                       # XXXX Why don't we handle these the same as classes??
+                       # plural forms and such
+                       othername, dummy, dummy = self.namemappers[0].findcodename('property', code)
                        if self.fp:
-                               self.fp.write("# repeated property %s %s\n"%(pname, what[1]))
+                               self.fp.write("\n%s = %s\n"%(pname, othername))
                else:
                        if self.fp:
                                self.fp.write("class %s(aetools.NProperty):\n" % pname)
                                self.fp.write('\t"""%s - %s """\n' % (name, what[1]))
                                self.fp.write("\twhich = %s\n" % `code`)
                                self.fp.write("\twant = %s\n" % `what[0]`)
-                       self.namemappers[0].addnamecode('property', pname, code)
+               self.namemappers[0].addnamecode('property', pname, code)
        
        def compileelement(self, elem):
                [code, keyform] = elem
@@ -747,7 +748,7 @@ class ObjectCompiler:
                name, fullname, module = self.findcodename('enum', enum)
                if not name:
                        if self.fp:
-                               self.fp.write("# XXXX enum %s not found!!\n"%(enum))
+                               self.fp.write("_Enum_%s = None # XXXX enum %s not found!!\n"%(identify(enum), enum))
                        return
                if module:
                        if self.fp: