[Python-checkins] python/dist/src/Lib/plat-mac aetools.py,1.5,1.6

jackjansen@users.sourceforge.net jackjansen@users.sourceforge.net
Tue, 01 Apr 2003 14:27:22 -0800


Update of /cvsroot/python/python/dist/src/Lib/plat-mac
In directory sc8-pr-cvs1:/tmp/cvs-serv31003

Modified Files:
	aetools.py 
Log Message:
Sigh... The get() and set() commands are not declared in the aete for
the Standard_Suite, but various other suites do expect it (the Finder
implements get() without declaring it itself). It is probably another
case of OSA magic. Adding them to the global base class.


Index: aetools.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/aetools.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** aetools.py	31 Mar 2003 13:29:32 -0000	1.5
--- aetools.py	1 Apr 2003 22:27:18 -0000	1.6
***************
*** 255,278 ****
  				item.__class__ = as
  			return item
  
! 	def _set(self, _object, _arguments = {}, _attributes = {}):
! 		""" _set: set data for an object
! 		Required argument: the object
! 		Keyword argument _parameters: Parameter dictionary for the set operation
  		Keyword argument _attributes: AppleEvent attribute dictionary
- 		Returns: the data
  		"""
  		_code = 'core'
  		_subcode = 'setd'
! 		
  		_arguments['----'] = _object
  
  		_reply, _arguments, _attributes = self.send(_code, _subcode,
  				_arguments, _attributes)
! 		if _arguments.has_key('errn'):
  			raise Error, decodeerror(_arguments)
! 
  		if _arguments.has_key('----'):
  			return _arguments['----']
  
  # Tiny Finder class, for local use only
--- 255,287 ----
  				item.__class__ = as
  			return item
+ 	
+ 	get = _get
+ 			
+ 	_argmap_set = {
+ 		'to' : 'data',
+ 	}
  
! 	def _set(self, _object, _attributes={}, **_arguments):
! 		"""set: Set an object's data.
! 		Required argument: the object for the command
! 		Keyword argument to: The new value.
  		Keyword argument _attributes: AppleEvent attribute dictionary
  		"""
  		_code = 'core'
  		_subcode = 'setd'
! 
! 		keysubst(_arguments, self._argmap_set)
  		_arguments['----'] = _object
  
+ 
  		_reply, _arguments, _attributes = self.send(_code, _subcode,
  				_arguments, _attributes)
! 		if _arguments.get('errn', 0):
  			raise Error, decodeerror(_arguments)
! 		# XXXX Optionally decode result
  		if _arguments.has_key('----'):
  			return _arguments['----']
+ 			
+ 	set = _set
  
  # Tiny Finder class, for local use only