def connect(self): """Initialises application target and terminology lookup tables. Called automatically the first time clients retrieve target, typebycode, typebyname, referencebycode, referencebyname; clients should not need to call it themselves. """ # initialise target (by default an aem.Application instance) if self.constructor == 'aemapp': t = self._target = self.identifier elif self.constructor == 'current': t = self._target = self._aemapplicationclass() else: t = self._target = self._aemapplicationclass( **{self.constructor: self.identifier}) # initialise translation tables if self._terms == True: # obtain terminology from application self._terms = terminology.tablesforapp(t) elif self._terms == False: # use built-in terminology only (e.g. use this when running AppleScript applets) self._terms = terminology.defaulttables elif not isinstance(self._terms, tuple): # use user-supplied terminology module self._terms = terminology.tablesformodule(self._terms) d1, d2, d3, d4 = self._typebycode, self._typebyname, \ self._referencebycode, self._referencebyname = self._terms self.target = lambda: t self.typebycode = lambda: d1 self.typebyname = lambda: d2 self.referencebycode = lambda: d3 self.referencebyname = lambda: d4
def connect(self): """Initialises application target and terminology lookup tables. Called automatically the first time clients retrieve target, typebycode, typebyname, referencebycode, referencebyname; clients should not need to call it themselves. """ # initialise target (by default an aem.Application instance) if self.constructor == 'aemapp': t = self._target = self.identifier elif self.constructor == 'current': t = self._target = self._aemapplicationclass() else: kargs = {self.constructor: self.identifier} kargs.update(self.aemconstructoroptions) t = self._target = self._aemapplicationclass(**kargs) # initialise translation tables if self._terms == True: # obtain terminology from application self._terms = terminology.tablesforapp(t) elif self._terms == False: # use built-in terminology only (e.g. use this when running AppleScript applets) self._terms = terminology.defaulttables elif not isinstance(self._terms, tuple): # use user-supplied terminology module self._terms = terminology.tablesformodule(self._terms) d1, d2, d3, d4 = self._typebycode, self._typebyname, \ self._referencebycode, self._referencebyname = self._terms self.target = lambda: t self.typebycode = lambda: d1 self.typebyname = lambda: d2 self.referencebycode = lambda: d3 self.referencebyname = lambda: d4 self._isconnected = True
def connect(self): """Initialises application target and terminology lookup tables. Called automatically the first time clients retrieve target, typebycode, typebyname, referencebycode, referencebyname; clients should not need to call it themselves. """ # initialise target (by default an aem.Application instance) if self.constructor == 'aemapp': self.target = self.identifier elif self.constructor == 'current': self.target = self._aemApplicationClass() else: self.target = self._aemApplicationClass(**{self.constructor: self.identifier}) # initialise translation tables if self._terms == True: # obtain terminology from application self._terms = terminology.tablesforapp(self.target) elif self._terms == False: # use built-in terminology only (e.g. use this when running AppleScript applets) self._terms = terminology.defaulttables elif not isinstance(self._terms, tuple): # use user-supplied terminology module self._terms = terminology.tablesformodule(self._terms) self.typebycode, self.typebyname, self.referencebycode, self.referencebyname = self._terms return self