summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorPaul Prescod <prescod@prescod.net>2000-07-01 19:21:47 (GMT)
committerPaul Prescod <prescod@prescod.net>2000-07-01 19:21:47 (GMT)
commit1e68827c8fa95d10df3c805e5dd8383b19048b18 (patch)
tree5b597682b770617034ddd8b5ff88321a01e2f707 /Lib
parentbd8c2ae758893956acd8b6ba393a8b482fff12ae (diff)
downloadcpython-1e68827c8fa95d10df3c805e5dd8383b19048b18.zip
cpython-1e68827c8fa95d10df3c805e5dd8383b19048b18.tar.gz
cpython-1e68827c8fa95d10df3c805e5dd8383b19048b18.tar.bz2
Misc fixes and improvements.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/xml/dom/minidom.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/Lib/xml/dom/minidom.py b/Lib/xml/dom/minidom.py
index 0283fee..337ff03 100644
--- a/Lib/xml/dom/minidom.py
+++ b/Lib/xml/dom/minidom.py
@@ -40,7 +40,8 @@ class Node:
index=repr( id( self ))+repr( self.__class__ )
Node.allnodes[index]=repr( self.__dict__ )
if Node.debug==None:
- Node.debug=open( "debug4.out", "w" )
+ Node.debug=StringIO()
+ #open( "debug4.out", "w" )
Node.debug.write( "create %s\n"%index )
def __getattr__( self, key ):
@@ -216,13 +217,24 @@ dictionary"""
#FIXME: is it appropriate to return .value?
def __getitem__( self, attname_or_tuple ):
- if type( attname_or_tuple ) == type( () ):
+ if type( attname_or_tuple ) == types.TupleType:
return self._attrsNS[attname_or_tuple]
else:
return self._attrs[attname_or_tuple]
- def __setitem__( self, attname ):
- raise TypeError, "object does not support item assignment"
+ # same as set
+ def __setitem__( self, attname, value ):
+ if type( value ) == types.StringType:
+ node=Attr( attname )
+ node.value=value
+ else:
+ assert isinstance( value, Attr ) or type( value )==types.StringType
+ node=value
+ old=self._attrs.get( attname, None)
+ if old:
+ old.unlink()
+ self._attrs[node.name]=node
+ self._attrsNS[(node.namespaceURI,node.localName)]=node
def __delitem__( self, attname_or_tuple ):
node=self[attname_or_tuple]